From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-f66.google.com (mail-ua1-f66.google.com [209.85.222.66]) by dpdk.org (Postfix) with ESMTP id D354A58EC for ; Thu, 16 May 2019 09:32:17 +0200 (CEST) Received: by mail-ua1-f66.google.com with SMTP id p13so898849uaa.11 for ; Thu, 16 May 2019 00:32:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XBrPaCLUtYK/Qstr7RkPVzItvBeYCaNlv7NP4GpaZMk=; b=KwgrwnUfpN5dY9GNkmi2d/tzlOOFb1BnkKSqYcJZiZYu2obB5Jpua9cpY5rlvZTCKh mXvVaz/kLksBgJe4s7AzSvWsj7hIQeq7WUZLm4ae7/iGl8f2RIhti/8ATT2R4WbJwidq ur+P++VAMMmLyCy6rXcjJemUhJxBGG5RTelnP3xDM44GOdwF+Pdji2SUfL41DhGdA43Z JvYFAwye/4pruXInxnm1SJmL2LKggPPlkCd5npxuRvOI5qR7N1Q3cjvuGYwq1lnLnIrI Slu3IRU3lq+Pre5cUV2aaMnfPH0v6QYfjIrW3dAcNpoemMpobH/Ba9+aU/LJ46fzghZe DOsQ== X-Gm-Message-State: APjAAAVeT5T8nqFug7cnTueWPFabxBY78SjIGDqiVBQYugEctQNvMvYu 2e2d7XmA2RpKQUN59u6hUr06HU2i14SwK9qkqkLeog== X-Google-Smtp-Source: APXvYqxTh4t19glIImueGTdHMssILQNF53ifQL+6QdxHTZ+8Ay7Kq1//3Uo+SBZNI7OxXaENdooquxj0rCL94L1GyQg= X-Received: by 2002:ab0:6419:: with SMTP id x25mr23115273uao.86.1557991937291; Thu, 16 May 2019 00:32:17 -0700 (PDT) MIME-Version: 1.0 References: <20190515221952.21959-1-stephen@networkplumber.org> <20190515221952.21959-4-stephen@networkplumber.org> In-Reply-To: <20190515221952.21959-4-stephen@networkplumber.org> From: David Marchand Date: Thu, 16 May 2019 09:32:06 +0200 Message-ID: To: Stephen Hemminger Cc: dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC 3/4] ethdev: use eth_unformat_addr X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 07:32:18 -0000 On Thu, May 16, 2019 at 12:20 AM Stephen Hemminger < stephen@networkplumber.org> wrote: > Use eth_unformat_addr, so that ethdev can be built and work > without the cmdline library. The dependency on cmdline was > an arrangement of convenience anyway. > > Signed-off-by: Stephen Hemminger > --- > lib/librte_ethdev/rte_class_eth.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/lib/librte_ethdev/rte_class_eth.c > b/lib/librte_ethdev/rte_class_eth.c > index cb99c92ece93..40ca936230c6 100644 > --- a/lib/librte_ethdev/rte_class_eth.c > +++ b/lib/librte_ethdev/rte_class_eth.c > @@ -4,7 +4,6 @@ > > #include > > -#include > #include > #include > #include > @@ -43,19 +42,13 @@ static int > eth_mac_cmp(const char *key __rte_unused, > const char *value, void *opaque) > { > - int ret; > struct ether_addr mac; > const struct rte_eth_dev_data *data = opaque; > struct rte_eth_dev_info dev_info; > uint32_t index; > > /* Parse devargs MAC address. */ > - /* > - * cannot use ether_aton_r(value, &mac) > - * because of include conflict with rte_ether.h > - */ > - ret = cmdline_parse_etheraddr(NULL, value, &mac, sizeof(mac)); > - if (ret < 0) > + if (ether_unformat_addr(value, &mac) < 0) > I had a look at cmdline_parse_etheraddr. I can see it supports a different format, like "XXXX:XXXX:XXXX" for a mac address. So here, we might be breaking some existing users assumptions. return -1; /* invalid devargs value */ > > /* Return 0 if devargs MAC is matching one of the device MACs. */ > -- > 2.20.1 > > -- David Marchand From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3381FA00E6 for ; Thu, 16 May 2019 09:32:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5B115942; Thu, 16 May 2019 09:32:18 +0200 (CEST) Received: from mail-ua1-f66.google.com (mail-ua1-f66.google.com [209.85.222.66]) by dpdk.org (Postfix) with ESMTP id D354A58EC for ; Thu, 16 May 2019 09:32:17 +0200 (CEST) Received: by mail-ua1-f66.google.com with SMTP id p13so898849uaa.11 for ; Thu, 16 May 2019 00:32:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XBrPaCLUtYK/Qstr7RkPVzItvBeYCaNlv7NP4GpaZMk=; b=KwgrwnUfpN5dY9GNkmi2d/tzlOOFb1BnkKSqYcJZiZYu2obB5Jpua9cpY5rlvZTCKh mXvVaz/kLksBgJe4s7AzSvWsj7hIQeq7WUZLm4ae7/iGl8f2RIhti/8ATT2R4WbJwidq ur+P++VAMMmLyCy6rXcjJemUhJxBGG5RTelnP3xDM44GOdwF+Pdji2SUfL41DhGdA43Z JvYFAwye/4pruXInxnm1SJmL2LKggPPlkCd5npxuRvOI5qR7N1Q3cjvuGYwq1lnLnIrI Slu3IRU3lq+Pre5cUV2aaMnfPH0v6QYfjIrW3dAcNpoemMpobH/Ba9+aU/LJ46fzghZe DOsQ== X-Gm-Message-State: APjAAAVeT5T8nqFug7cnTueWPFabxBY78SjIGDqiVBQYugEctQNvMvYu 2e2d7XmA2RpKQUN59u6hUr06HU2i14SwK9qkqkLeog== X-Google-Smtp-Source: APXvYqxTh4t19glIImueGTdHMssILQNF53ifQL+6QdxHTZ+8Ay7Kq1//3Uo+SBZNI7OxXaENdooquxj0rCL94L1GyQg= X-Received: by 2002:ab0:6419:: with SMTP id x25mr23115273uao.86.1557991937291; Thu, 16 May 2019 00:32:17 -0700 (PDT) MIME-Version: 1.0 References: <20190515221952.21959-1-stephen@networkplumber.org> <20190515221952.21959-4-stephen@networkplumber.org> In-Reply-To: <20190515221952.21959-4-stephen@networkplumber.org> From: David Marchand Date: Thu, 16 May 2019 09:32:06 +0200 Message-ID: To: Stephen Hemminger Cc: dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC 3/4] ethdev: use eth_unformat_addr X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190516073206.WrwCpqEQTBiTrDKZrvZCGJ3KLFUoQPLQP8qN83of7Ws@z> On Thu, May 16, 2019 at 12:20 AM Stephen Hemminger < stephen@networkplumber.org> wrote: > Use eth_unformat_addr, so that ethdev can be built and work > without the cmdline library. The dependency on cmdline was > an arrangement of convenience anyway. > > Signed-off-by: Stephen Hemminger > --- > lib/librte_ethdev/rte_class_eth.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/lib/librte_ethdev/rte_class_eth.c > b/lib/librte_ethdev/rte_class_eth.c > index cb99c92ece93..40ca936230c6 100644 > --- a/lib/librte_ethdev/rte_class_eth.c > +++ b/lib/librte_ethdev/rte_class_eth.c > @@ -4,7 +4,6 @@ > > #include > > -#include > #include > #include > #include > @@ -43,19 +42,13 @@ static int > eth_mac_cmp(const char *key __rte_unused, > const char *value, void *opaque) > { > - int ret; > struct ether_addr mac; > const struct rte_eth_dev_data *data = opaque; > struct rte_eth_dev_info dev_info; > uint32_t index; > > /* Parse devargs MAC address. */ > - /* > - * cannot use ether_aton_r(value, &mac) > - * because of include conflict with rte_ether.h > - */ > - ret = cmdline_parse_etheraddr(NULL, value, &mac, sizeof(mac)); > - if (ret < 0) > + if (ether_unformat_addr(value, &mac) < 0) > I had a look at cmdline_parse_etheraddr. I can see it supports a different format, like "XXXX:XXXX:XXXX" for a mac address. So here, we might be breaking some existing users assumptions. return -1; /* invalid devargs value */ > > /* Return 0 if devargs MAC is matching one of the device MACs. */ > -- > 2.20.1 > > -- David Marchand