[dpdk-dev] [PATCH v4 2/2] net: added macro to extract MAC address bytes

Ferruh Yigit ferruh.yigit at intel.com
Tue Aug 17 18:44:51 CEST 2021


On 8/17/2021 4:25 PM, Stephen Hemminger wrote:
> On Tue, 17 Aug 2021 09:11:17 +0100
> Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> 
>> On 8/17/2021 12:03 AM, Stephen Hemminger wrote:
>>> On Mon, 16 Aug 2021 15:27:28 +0530
>>> Aman Singh <aman.deep.singh at intel.com> wrote:
>>>   
>>>> Added macros to simplify print of MAC address.
>>>> The six bytes of a MAC address are extracted in
>>>> a macro here, to improve code readablity.
>>>>
>>>> Signed-off-by: Aman Singh <aman.deep.singh at intel.com>
>>>> Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
>>>> ---
>>>> The change in the document will be done in seperate patch.
>>>> To ensure document has direct reference of the code as shown in
>>>> commit 413c75c33c40 ("doc: show how to include code in guides").  
>>>
>>> NAK
>>> The DPDK already has rte_ether_format_addr()
>>> why does so much code not use it?
>>>   
>>
>> 'rte_ether_format_addr()' formats string to a buffer, but most of the times the
>> need is just to log and having a buffer for it is unnecessary.
>>
>> Both macros look useful to me.
> 
> Yes, but it would be good if same format was used everywhere.
> 

Agree, and 'RTE_ETHER_ADDR_PRT_FMT' macro helps to unify the format without
forcing to create the buffer.

We can use 'RTE_ETHER_ADDR_PRT_FMT' in the 'rte_ether_format_addr()' to unify
all output, the downside is it may change the output of the API, which may cause
trouble for some customers.
Other option is define 'RTE_ETHER_ADDR_PRT_FMT' as whatever
'rte_ether_format_addr()' has, to not cause a change in the API, what do you think?


More information about the dev mailing list