* [dpdk-dev] [PATCH] net/enic: add primary mac address handler @ 2018-02-19 12:42 David Marchand 2018-02-20 5:41 ` Hyong Youb Kim 2018-04-16 9:40 ` [dpdk-dev] [PATCH v2] " David Marchand 0 siblings, 2 replies; 9+ messages in thread From: David Marchand @ 2018-02-19 12:42 UTC (permalink / raw) To: dev; +Cc: johndale, neescoba Reused the .mac_addr_add and .mac_addr_del callbacks code to implement primary mac address handler. Signed-off-by: David Marchand <david.marchand@6wind.com> --- drivers/net/enic/enic_ethdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 669dbf336..802fd3623 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -610,6 +610,13 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) enic_del_mac_address(enic, index); } +static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, + struct ether_addr *addr) +{ + enicpmd_remove_mac_addr(eth_dev, 0); + enicpmd_add_mac_addr(eth_dev, addr, 0, 0); +} + static int enicpmd_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) { struct enic *enic = pmd_priv(eth_dev); @@ -657,6 +664,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = { .priority_flow_ctrl_set = NULL, .mac_addr_add = enicpmd_add_mac_addr, .mac_addr_remove = enicpmd_remove_mac_addr, + .mac_addr_set = enicpmd_set_mac_addr, .filter_ctrl = enicpmd_dev_filter_ctrl, }; -- 2.11.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] net/enic: add primary mac address handler 2018-02-19 12:42 [dpdk-dev] [PATCH] net/enic: add primary mac address handler David Marchand @ 2018-02-20 5:41 ` Hyong Youb Kim 2018-02-20 9:17 ` David Marchand 2018-04-16 9:40 ` [dpdk-dev] [PATCH v2] " David Marchand 1 sibling, 1 reply; 9+ messages in thread From: Hyong Youb Kim @ 2018-02-20 5:41 UTC (permalink / raw) To: David Marchand; +Cc: dev, johndale, neescoba On Mon, Feb 19, 2018 at 01:42:27PM +0100, David Marchand wrote: > Reused the .mac_addr_add and .mac_addr_del callbacks code to implement > primary mac address handler. > > Signed-off-by: David Marchand <david.marchand@6wind.com> Hi, thanks for taking a stab at this. > +static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, > + struct ether_addr *addr) > +{ > + enicpmd_remove_mac_addr(eth_dev, 0); > + enicpmd_add_mac_addr(eth_dev, addr, 0, 0); > +} Unfortunately, this does not work as expected. The caller updates mac_addrs[0] prior to calling mac_addr_set. int rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) { [...] /* Update default address in NIC data structure */ ether_addr_copy(addr, &dev->data->mac_addrs[0]); (*dev->dev_ops->mac_addr_set)(dev, addr); [...] So, enicpmd_remove_mac_addr tries to remove mac_addrs[0], which is the 'new' default address and does not exist on the NIC. Then, enicpmd_add_mac_addr adds the new address to the NIC. At the end, the NIC ends up with both the old and the new addresses. I think the driver would have to treat the 'default' mac address differently. I can submit a new patch as part of our next upstream patch set. Or you are welcome to spin a new version. Up to you. Thanks. -Hyong ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] net/enic: add primary mac address handler 2018-02-20 5:41 ` Hyong Youb Kim @ 2018-02-20 9:17 ` David Marchand 2018-02-20 12:16 ` Hyong Youb Kim 0 siblings, 1 reply; 9+ messages in thread From: David Marchand @ 2018-02-20 9:17 UTC (permalink / raw) To: Hyong Youb Kim; +Cc: dev, John Daley (johndale), Nelson Escobar, Olivier Matz Hello, On Tue, Feb 20, 2018 at 6:41 AM, Hyong Youb Kim <hyonkim@cisco.com> wrote: > On Mon, Feb 19, 2018 at 01:42:27PM +0100, David Marchand wrote: >> Reused the .mac_addr_add and .mac_addr_del callbacks code to implement >> primary mac address handler. >> >> Signed-off-by: David Marchand <david.marchand@6wind.com> > > Hi, thanks for taking a stab at this. > >> +static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, >> + struct ether_addr *addr) >> +{ >> + enicpmd_remove_mac_addr(eth_dev, 0); >> + enicpmd_add_mac_addr(eth_dev, addr, 0, 0); >> +} > > Unfortunately, this does not work as expected. The caller updates > mac_addrs[0] prior to calling mac_addr_set. Indeed. Btw, I had forgotten about the deprecation notice [1] sent by Olivier. Just discussed it with him, let's wait for this change before looking at the issue again. 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5 -- David Marchand ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] net/enic: add primary mac address handler 2018-02-20 9:17 ` David Marchand @ 2018-02-20 12:16 ` Hyong Youb Kim 2018-04-06 17:33 ` Ferruh Yigit 0 siblings, 1 reply; 9+ messages in thread From: Hyong Youb Kim @ 2018-02-20 12:16 UTC (permalink / raw) To: David Marchand; +Cc: dev, John Daley (johndale), Nelson Escobar, Olivier Matz On Tue, Feb 20, 2018 at 10:17:34AM +0100, David Marchand wrote: [...] > Btw, I had forgotten about the deprecation notice [1] sent by Olivier. > Just discussed it with him, let's wait for this change before looking > at the issue again. > > > 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5 Makes sense. Will wait. Thanks. -Hyong ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] net/enic: add primary mac address handler 2018-02-20 12:16 ` Hyong Youb Kim @ 2018-04-06 17:33 ` Ferruh Yigit 2018-04-13 17:34 ` Ferruh Yigit 0 siblings, 1 reply; 9+ messages in thread From: Ferruh Yigit @ 2018-04-06 17:33 UTC (permalink / raw) To: Hyong Youb Kim, David Marchand Cc: dev, John Daley (johndale), Nelson Escobar, Olivier Matz On 2/20/2018 12:16 PM, Hyong Youb Kim wrote: > On Tue, Feb 20, 2018 at 10:17:34AM +0100, David Marchand wrote: > [...] >> Btw, I had forgotten about the deprecation notice [1] sent by Olivier. >> Just discussed it with him, let's wait for this change before looking >> at the issue again. >> >> >> 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5 > > Makes sense. Will wait. Thanks. Latest version of Olivier's patch: https://dpdk.org/dev/patchwork/patch/37427/ , FYI. > > -Hyong > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] net/enic: add primary mac address handler 2018-04-06 17:33 ` Ferruh Yigit @ 2018-04-13 17:34 ` Ferruh Yigit 0 siblings, 0 replies; 9+ messages in thread From: Ferruh Yigit @ 2018-04-13 17:34 UTC (permalink / raw) To: Hyong Youb Kim, David Marchand Cc: dev, John Daley (johndale), Nelson Escobar, Olivier Matz On 4/6/2018 6:33 PM, Ferruh Yigit wrote: > On 2/20/2018 12:16 PM, Hyong Youb Kim wrote: >> On Tue, Feb 20, 2018 at 10:17:34AM +0100, David Marchand wrote: >> [...] >>> Btw, I had forgotten about the deprecation notice [1] sent by Olivier. >>> Just discussed it with him, let's wait for this change before looking >>> at the issue again. >>> >>> >>> 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5 >> >> Makes sense. Will wait. Thanks. > > Latest version of Olivier's patch: https://dpdk.org/dev/patchwork/patch/37427/ , > FYI. Hi David, Olivier's patch is merged into next-net, can you please re-make this patch based on latest code? Thanks, ferruh ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2] net/enic: add primary mac address handler 2018-02-19 12:42 [dpdk-dev] [PATCH] net/enic: add primary mac address handler David Marchand 2018-02-20 5:41 ` Hyong Youb Kim @ 2018-04-16 9:40 ` David Marchand 2018-04-17 5:12 ` Hyong Youb Kim 1 sibling, 1 reply; 9+ messages in thread From: David Marchand @ 2018-04-16 9:40 UTC (permalink / raw) To: dev; +Cc: johndale, hyonkim, ferruh.yigit, neescoba Modified enic_del_mac_address() to get a return value from the vnic layer. Reused the .mac_addr_add and .mac_addr_del callbacks code to implement primary mac address handler. Signed-off-by: David Marchand <david.marchand@6wind.com> --- Changes since v1: - rebased on dpdk-next-net following mac_addr_set rework, - since enicpmd_remove_mac_addr() does not return an error code, I chose to expose the return value from enic_del_mac_address() so that an error can be detected in the mac_addr_set callback. The log message in enicpmd_remove_mac_addr() has been preserved. --- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_ethdev.c | 20 +++++++++++++++++++- drivers/net/enic/enic_main.c | 5 ++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 751ddc7..5f15e44 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -284,7 +284,7 @@ int enic_dev_stats_get(struct enic *enic, void enic_dev_stats_clear(struct enic *enic); void enic_add_packet_filter(struct enic *enic); int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr); -void enic_del_mac_address(struct enic *enic, int mac_index); +int enic_del_mac_address(struct enic *enic, int mac_index); unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq); void enic_send_pkt(struct enic *enic, struct vnic_wq *wq, struct rte_mbuf *tx_pkt, unsigned short len, diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 801f470..f503398 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -583,7 +583,24 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) return; ENICPMD_FUNC_TRACE(); - enic_del_mac_address(enic, index); + if (enic_del_mac_address(enic, index)) + dev_err(enic, "del mac addr failed\n"); +} + +static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, + struct ether_addr *addr) +{ + struct enic *enic = pmd_priv(eth_dev); + int ret; + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + + ENICPMD_FUNC_TRACE(); + ret = enic_del_mac_address(enic, 0); + if (ret) + return ret; + return enic_set_mac_address(enic, addr->addr_bytes); } static int enicpmd_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) @@ -799,6 +816,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = { .priority_flow_ctrl_set = NULL, .mac_addr_add = enicpmd_add_mac_addr, .mac_addr_remove = enicpmd_remove_mac_addr, + .mac_addr_set = enicpmd_set_mac_addr, .filter_ctrl = enicpmd_dev_filter_ctrl, .reta_query = enicpmd_dev_rss_reta_query, .reta_update = enicpmd_dev_rss_reta_update, diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 98d4775..d9bc7fd 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -162,13 +162,12 @@ int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) return 0; } -void enic_del_mac_address(struct enic *enic, int mac_index) +int enic_del_mac_address(struct enic *enic, int mac_index) { struct rte_eth_dev *eth_dev = enic->rte_dev; uint8_t *mac_addr = eth_dev->data->mac_addrs[mac_index].addr_bytes; - if (vnic_dev_del_addr(enic->vdev, mac_addr)) - dev_err(enic, "del mac addr failed\n"); + return vnic_dev_del_addr(enic->vdev, mac_addr); } int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr) -- 2.7.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/enic: add primary mac address handler 2018-04-16 9:40 ` [dpdk-dev] [PATCH v2] " David Marchand @ 2018-04-17 5:12 ` Hyong Youb Kim 2018-04-17 17:23 ` Ferruh Yigit 0 siblings, 1 reply; 9+ messages in thread From: Hyong Youb Kim @ 2018-04-17 5:12 UTC (permalink / raw) To: David Marchand; +Cc: dev, johndale, ferruh.yigit, neescoba On Mon, Apr 16, 2018 at 11:40:17AM +0200, David Marchand wrote: > Modified enic_del_mac_address() to get a return value from the vnic layer. > Reused the .mac_addr_add and .mac_addr_del callbacks code to implement > primary mac address handler. > > Signed-off-by: David Marchand <david.marchand@6wind.com> > --- Thanks. The patch looks good to me. I've tested it on top of dpdk-net-next. It works as expected. Acked-by: Hyong Youb Kim <hyonkim@cisco.com> > > Changes since v1: > - rebased on dpdk-next-net following mac_addr_set rework, > - since enicpmd_remove_mac_addr() does not return an error code, I chose to > expose the return value from enic_del_mac_address() so that an error > can be detected in the mac_addr_set callback. The log message in > enicpmd_remove_mac_addr() has been preserved. > > --- > drivers/net/enic/enic.h | 2 +- > drivers/net/enic/enic_ethdev.c | 20 +++++++++++++++++++- > drivers/net/enic/enic_main.c | 5 ++--- > 3 files changed, 22 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h > index 751ddc7..5f15e44 100644 > --- a/drivers/net/enic/enic.h > +++ b/drivers/net/enic/enic.h > @@ -284,7 +284,7 @@ int enic_dev_stats_get(struct enic *enic, > void enic_dev_stats_clear(struct enic *enic); > void enic_add_packet_filter(struct enic *enic); > int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr); > -void enic_del_mac_address(struct enic *enic, int mac_index); > +int enic_del_mac_address(struct enic *enic, int mac_index); > unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq); > void enic_send_pkt(struct enic *enic, struct vnic_wq *wq, > struct rte_mbuf *tx_pkt, unsigned short len, > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index 801f470..f503398 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -583,7 +583,24 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) > return; > > ENICPMD_FUNC_TRACE(); > - enic_del_mac_address(enic, index); > + if (enic_del_mac_address(enic, index)) > + dev_err(enic, "del mac addr failed\n"); > +} > + > +static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, > + struct ether_addr *addr) > +{ > + struct enic *enic = pmd_priv(eth_dev); > + int ret; > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return -E_RTE_SECONDARY; > + > + ENICPMD_FUNC_TRACE(); > + ret = enic_del_mac_address(enic, 0); > + if (ret) > + return ret; > + return enic_set_mac_address(enic, addr->addr_bytes); > } > > static int enicpmd_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) > @@ -799,6 +816,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = { > .priority_flow_ctrl_set = NULL, > .mac_addr_add = enicpmd_add_mac_addr, > .mac_addr_remove = enicpmd_remove_mac_addr, > + .mac_addr_set = enicpmd_set_mac_addr, > .filter_ctrl = enicpmd_dev_filter_ctrl, > .reta_query = enicpmd_dev_rss_reta_query, > .reta_update = enicpmd_dev_rss_reta_update, > diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c > index 98d4775..d9bc7fd 100644 > --- a/drivers/net/enic/enic_main.c > +++ b/drivers/net/enic/enic_main.c > @@ -162,13 +162,12 @@ int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) > return 0; > } > > -void enic_del_mac_address(struct enic *enic, int mac_index) > +int enic_del_mac_address(struct enic *enic, int mac_index) > { > struct rte_eth_dev *eth_dev = enic->rte_dev; > uint8_t *mac_addr = eth_dev->data->mac_addrs[mac_index].addr_bytes; > > - if (vnic_dev_del_addr(enic->vdev, mac_addr)) > - dev_err(enic, "del mac addr failed\n"); > + return vnic_dev_del_addr(enic->vdev, mac_addr); > } > > int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr) > -- > 2.7.4 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/enic: add primary mac address handler 2018-04-17 5:12 ` Hyong Youb Kim @ 2018-04-17 17:23 ` Ferruh Yigit 0 siblings, 0 replies; 9+ messages in thread From: Ferruh Yigit @ 2018-04-17 17:23 UTC (permalink / raw) To: Hyong Youb Kim, David Marchand; +Cc: dev, johndale, neescoba On 4/17/2018 6:12 AM, Hyong Youb Kim wrote: > On Mon, Apr 16, 2018 at 11:40:17AM +0200, David Marchand wrote: >> Modified enic_del_mac_address() to get a return value from the vnic layer. >> Reused the .mac_addr_add and .mac_addr_del callbacks code to implement >> primary mac address handler. >> >> Signed-off-by: David Marchand <david.marchand@6wind.com> >> --- > > Thanks. > > The patch looks good to me. I've tested it on top of dpdk-net-next. It > works as expected. > > Acked-by: Hyong Youb Kim <hyonkim@cisco.com> Applied to dpdk-next-net/master, thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-04-17 17:23 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-02-19 12:42 [dpdk-dev] [PATCH] net/enic: add primary mac address handler David Marchand 2018-02-20 5:41 ` Hyong Youb Kim 2018-02-20 9:17 ` David Marchand 2018-02-20 12:16 ` Hyong Youb Kim 2018-04-06 17:33 ` Ferruh Yigit 2018-04-13 17:34 ` Ferruh Yigit 2018-04-16 9:40 ` [dpdk-dev] [PATCH v2] " David Marchand 2018-04-17 5:12 ` Hyong Youb Kim 2018-04-17 17:23 ` Ferruh Yigit
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).