[dpdk-dev] [EXT] Re: [PATCH] net/af_packet: append system error to error msgs
Ferruh Yigit
ferruh.yigit at intel.com
Mon Jul 8 20:04:46 CEST 2019
On 7/5/2019 10:35 AM, Krzysztof Kanas wrote:
> On 19-07-04 19:59, Ferruh Yigit wrote:
>> External Email
>>
>> ----------------------------------------------------------------------
>> On 7/4/2019 3:39 PM, kkanas at marvell.com wrote:
>>> From: Krzysztof Kanas <kkanas at marvell.com>
>>>
>>> Print system error to make easier diagnosis of errors with af_packet.
>>>
>>> Signed-off-by: Krzysztof Kanas <kkanas at marvell.com>
>>> ---
>>> drivers/net/af_packet/rte_eth_af_packet.c | 47 ++++++++++++-----------
>>> 1 file changed, 24 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
>>> index f396f8b22a55..94ae4b13398d 100644
>>> --- a/drivers/net/af_packet/rte_eth_af_packet.c
>>> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
>>> @@ -13,7 +13,9 @@
>>> #include <rte_malloc.h>
>>> #include <rte_kvargs.h>
>>> #include <rte_bus_vdev.h>
>>> +#include <rte_errno.h>
>>>
>>> +#include <errno.h>
>>> #include <linux/if_ether.h>
>>> #include <linux/if_packet.h>
>>> #include <arpa/inet.h>
>>> @@ -605,8 +607,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
>>> }
>>> if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) {
>>> PMD_LOG(ERR,
>>> - "%s: ioctl failed (SIOCGIFINDEX)",
>>> - name);
>>> + "%s: ioctl failed (SIOCGIFINDEX):%s",
>>> + name, rte_strerror(errno));
>>
>> What do you think adding an new macro that adds ":%s, rte_strerror(errno)" part
>> automatically and just change the macro on selected logs?
>>
> I would rather not, as adding macro adds another indirection, and the
> purpose of rte_strerror(errno) was just to help debugging wrong
> arguments etc..
>
> Also if in macro somebody uses function that changes errno, the
> rte_strerror would give bad result.
I am just talking about something like "PMD_LOG_ERRNO" which appends
"rte_strerror(errno)" additional to "PMD_LOG", so there is no additional
indirection or there is nothing that can change "errno", so still doesn't make
sense?
>
> But no strong opinion on above.
>
More information about the dev
mailing list