net: redefine array size macros
Checks
Commit Message
Replace copies of size(arr)/size(arr[0]) with RTE_DIM().
Eventually all of these macro definitions should be removed.
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
drivers/net/atlantic/atl_hw_regs.h | 2 +-
drivers/net/axgbe/axgbe_common.h | 2 +-
drivers/net/bnx2x/bnx2x.h | 2 +-
drivers/net/bnx2x/elink.h | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/enic/base/vnic_devcmd.h | 2 +-
drivers/net/hns3/hns3_ethdev.h | 2 +-
drivers/net/i40e/base/i40e_osdep.h | 2 +-
drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
drivers/net/thunderx/base/nicvf_hw.h | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)
Comments
29/01/2021 23:44, Andrew Boyer:
> Replace copies of size(arr)/size(arr[0]) with RTE_DIM().
> Eventually all of these macro definitions should be removed.
>
> Signed-off-by: Andrew Boyer <aboyer@pensando.io>
> ---
> drivers/net/atlantic/atl_hw_regs.h | 2 +-
> drivers/net/axgbe/axgbe_common.h | 2 +-
> drivers/net/bnx2x/bnx2x.h | 2 +-
> drivers/net/bnx2x/elink.h | 2 +-
> drivers/net/ena/ena_ethdev.c | 2 +-
> drivers/net/enic/base/vnic_devcmd.h | 2 +-
> drivers/net/hns3/hns3_ethdev.h | 2 +-
> drivers/net/i40e/base/i40e_osdep.h | 2 +-
> drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
> drivers/net/thunderx/base/nicvf_hw.h | 2 +-
> 10 files changed, 10 insertions(+), 10 deletions(-)
Thanks for the cleanup.
In the title, the prefix "net" means librte_net.
Here, it should be "drivers/net". I know it's confusing :)
Please check other patches in the series,
they are versioned as v2 and numbered 4/13 and 6/13.
> On Feb 1, 2021, at 5:28 PM, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 29/01/2021 23:44, Andrew Boyer:
>> Replace copies of size(arr)/size(arr[0]) with RTE_DIM().
>> Eventually all of these macro definitions should be removed.
>>
>> Signed-off-by: Andrew Boyer <aboyer@pensando.io>
>> ---
>> drivers/net/atlantic/atl_hw_regs.h | 2 +-
>> drivers/net/axgbe/axgbe_common.h | 2 +-
>> drivers/net/bnx2x/bnx2x.h | 2 +-
>> drivers/net/bnx2x/elink.h | 2 +-
>> drivers/net/ena/ena_ethdev.c | 2 +-
>> drivers/net/enic/base/vnic_devcmd.h | 2 +-
>> drivers/net/hns3/hns3_ethdev.h | 2 +-
>> drivers/net/i40e/base/i40e_osdep.h | 2 +-
>> drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
>> drivers/net/thunderx/base/nicvf_hw.h | 2 +-
>> 10 files changed, 10 insertions(+), 10 deletions(-)
>
> Thanks for the cleanup.
>
> In the title, the prefix "net" means librte_net.
> Here, it should be "drivers/net". I know it's confusing :)
>
> Please check other patches in the series,
> they are versioned as v2 and numbered 4/13 and 6/13.
Thank you for the review - do you want me to resend or can you fix it up yourself?
The 4/13 and 6/13 are fixups that Ferruh asked for, while he applied the rest of the series. I made the 4/13 a v2 replying to the original 4/13 and the 6/13 a v2 replying to the original 6/13. If I messed it up, my apologies!
-Andrew
On 2/1/2021 10:32 PM, Andrew Boyer wrote:
>
>
>> On Feb 1, 2021, at 5:28 PM, Thomas Monjalon <thomas@monjalon.net
>> <mailto:thomas@monjalon.net>> wrote:
>>
>> 29/01/2021 23:44, Andrew Boyer:
>>> Replace copies of size(arr)/size(arr[0]) with RTE_DIM().
>>> Eventually all of these macro definitions should be removed.
>>>
>>> Signed-off-by: Andrew Boyer <aboyer@pensando.io <mailto:aboyer@pensando.io>>
>>> ---
>>> drivers/net/atlantic/atl_hw_regs.h | 2 +-
>>> drivers/net/axgbe/axgbe_common.h | 2 +-
>>> drivers/net/bnx2x/bnx2x.h | 2 +-
>>> drivers/net/bnx2x/elink.h | 2 +-
>>> drivers/net/ena/ena_ethdev.c | 2 +-
>>> drivers/net/enic/base/vnic_devcmd.h | 2 +-
>>> drivers/net/hns3/hns3_ethdev.h | 2 +-
>>> drivers/net/i40e/base/i40e_osdep.h | 2 +-
>>> drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
>>> drivers/net/thunderx/base/nicvf_hw.h | 2 +-
>>> 10 files changed, 10 insertions(+), 10 deletions(-)
>>
>> Thanks for the cleanup.
>>
>> In the title, the prefix "net" means librte_net.
>> Here, it should be "drivers/net". I know it's confusing :)
>>
>> Please check other patches in the series,
>> they are versioned as v2 and numbered 4/13 and 6/13.
>
> Thank you for the review - do you want me to resend or can you fix it up yourself?
>
I can fix the title while merging, thanks for cleanup,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> The 4/13 and 6/13 are fixups that Ferruh asked for, while he applied the rest of
> the series. I made the 4/13 a v2 replying to the original 4/13 and the 6/13 a v2
> replying to the original 6/13. If I messed it up, my apologies!
>
> -Andrew
On 2/2/2021 12:30 PM, Ferruh Yigit wrote:
> On 2/1/2021 10:32 PM, Andrew Boyer wrote:
>>
>>
>>> On Feb 1, 2021, at 5:28 PM, Thomas Monjalon <thomas@monjalon.net
>>> <mailto:thomas@monjalon.net>> wrote:
>>>
>>> 29/01/2021 23:44, Andrew Boyer:
>>>> Replace copies of size(arr)/size(arr[0]) with RTE_DIM().
>>>> Eventually all of these macro definitions should be removed.
>>>>
>>>> Signed-off-by: Andrew Boyer <aboyer@pensando.io <mailto:aboyer@pensando.io>>
>>>> ---
>>>> drivers/net/atlantic/atl_hw_regs.h | 2 +-
>>>> drivers/net/axgbe/axgbe_common.h | 2 +-
>>>> drivers/net/bnx2x/bnx2x.h | 2 +-
>>>> drivers/net/bnx2x/elink.h | 2 +-
>>>> drivers/net/ena/ena_ethdev.c | 2 +-
>>>> drivers/net/enic/base/vnic_devcmd.h | 2 +-
>>>> drivers/net/hns3/hns3_ethdev.h | 2 +-
>>>> drivers/net/i40e/base/i40e_osdep.h | 2 +-
>>>> drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
>>>> drivers/net/thunderx/base/nicvf_hw.h | 2 +-
>>>> 10 files changed, 10 insertions(+), 10 deletions(-)
>>>
>>> Thanks for the cleanup.
>>>
>>> In the title, the prefix "net" means librte_net.
>>> Here, it should be "drivers/net". I know it's confusing :)
>>>
>>> Please check other patches in the series,
>>> they are versioned as v2 and numbered 4/13 and 6/13.
>>
>> Thank you for the review - do you want me to resend or can you fix it up
>> yourself?
>>
>
> I can fix the title while merging, thanks for cleanup,
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
Applied to dpdk-next-net/main, thanks.
Patch title updated as:
"drivers/net: redefine array size macros"
@@ -26,7 +26,7 @@
#define mdelay rte_delay_ms
#define udelay rte_delay_us
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
#define BIT(x) (1UL << (x))
#define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \
@@ -42,7 +42,7 @@
#define BIT(nr) (1 << (nr))
#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
#endif
#define AXGBE_HZ 250
@@ -81,7 +81,7 @@
#endif
#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
#endif
#ifndef DIV_ROUND_UP
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
@@ -86,7 +86,7 @@ extern void elink_cb_notify_link_changed(struct bnx2x_softc *sc);
#define ELINK_EVENT_ID_SFP_UNQUALIFIED_MODULE 1
#define ELINK_EVENT_ID_SFP_POWER_FAULT 2
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
/* Debug prints */
#ifdef ELINK_DEBUG
@@ -47,7 +47,7 @@
#define ENA_HASH_KEY_SIZE 40
#define ETH_GSTRING_LEN 32
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
#define ENA_MIN_RING_DESC 128
@@ -63,7 +63,7 @@
#define _CMD_VTYPE(cmd) (((cmd) >> _CMD_VTYPESHIFT) & _CMD_VTYPEMASK)
#define _CMD_N(cmd) (((cmd) >> _CMD_NSHIFT) & _CMD_NMASK)
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
enum vnic_devcmd_cmd {
CMD_NONE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_NONE, 0),
@@ -887,7 +887,7 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
#define hns3_read_dev(a, reg) \
hns3_read_reg((a)->io_base, (reg))
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
#define NEXT_ITEM_OF_ACTION(act, actions, index) \
do { \
@@ -175,7 +175,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr)
I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((a), (reg)), (value))
#define flush(a) i40e_read_addr(I40E_PCI_REG_ADDR((a), (I40E_GLGEN_STAT)))
-#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
/* memory allocation tracking */
struct i40e_dma_mem {
@@ -23,7 +23,7 @@
#endif
#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
#endif
#define NFP_ERRNO(err) (errno = (err), -1)
@@ -17,7 +17,7 @@
#define PCI_SUB_DEVICE_ID_CN81XX_NICVF 0xA234
#define PCI_SUB_DEVICE_ID_CN83XX_NICVF 0xA334
-#define NICVF_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define NICVF_ARRAY_SIZE(arr) RTE_DIM(arr)
#define NICVF_GET_RX_STATS(reg) \
nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (reg << 3))