[dpdk-dev] [PATCH] net/i40e: fix VSI MAC filter on primary address change

Zhang, Helin helin.zhang at intel.com
Mon Jan 8 07:36:26 CET 2018


Hi Developers and maintainers

Could you help to address the comments from Igor?

Regards,
Helin

> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Igor Ryzhov
> Sent: Friday, January 5, 2018 8:35 PM
> To: Olivier Matz
> Cc: dev at dpdk.org; Wu, Jingjing; Xing, Beilei; stable at dpdk.org; Laurent Hardy
> Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix VSI MAC filter on primary address
> change
> 
> Thank you for the patch! Comments inline.
> 
> On Wed, Jan 3, 2018 at 5:29 PM, Olivier Matz <olivier.matz at 6wind.com>
> wrote:
> >
> >  drivers/net/i40e/i40e_ethdev.c | 29 +++++++++++++++++++++++++++++
> >  1 file changed, 29 insertions(+)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_
> > ethdev.c index 811cc9ffe..e7d070879 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10818,12 +10818,41 @@ static void i40e_set_default_mac_addr(struct
> > rte_eth_dev *dev,
> >                                       struct ether_addr *mac_addr)  {
> >         struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->
> > data->dev_private);
> > +       struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->
> > data->dev_private);
> > +       struct i40e_vsi *vsi = pf->main_vsi;
> > +       struct i40e_mac_filter_info mac_filter;
> > +       struct i40e_mac_filter *f;
> > +       int ret;
> >
> >         if (!is_valid_assigned_ether_addr(mac_addr)) {
> >                 PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
> >                 return;
> >         }
> >
> >
> Is following check really necessary here?
> i40e_vsi_delete_mac(vsi, &pf->dev_addr) will do absolutely the same.
> 
> +       TAILQ_FOREACH(f, &vsi->mac_list, next) {
> > +               if (is_same_ether_addr(&pf->dev_addr,
> > &f->mac_info.mac_addr))
> > +                       break;
> > +       }
> > +
> > +       if (f == NULL) {
> > +               PMD_DRV_LOG(ERR, "Failed to find filter for default mac");
> > +               return;
> > +       }
> > +
> > +       mac_filter = f->mac_info;
> > +       ret = i40e_vsi_delete_mac(vsi, &mac_filter.mac_addr);
> > +       if (ret != I40E_SUCCESS) {
> > +               PMD_DRV_LOG(ERR, "Failed to delete mac filter");
> > +               return;
> > +       }
> > +       memcpy(&mac_filter.mac_addr, mac_addr, ETH_ADDR_LEN);
> >
> 
> Shouldn't mac_filter.filter_type be set to RTE_MACVLAN_PERFECT_MATCH?
> 
> 
> > +       ret = i40e_vsi_add_mac(vsi, &mac_filter);
> > +       if (ret != I40E_SUCCESS) {
> > +               PMD_DRV_LOG(ERR, "Failed to add mac filter");
> > +               return;
> > +       }
> > +       memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN);
> > +
> >         /* Flags: 0x3 updates port address */
> >
> 
> In Linux driver I40E_AQC_WRITE_TYPE_LAA_WOL is used as a flag instead of
> 0x3.
> Shouldn't we use the same flag?
> 
> 
> >         i40e_aq_mac_address_write(hw, 0x3, mac_addr->addr_bytes,
> > NULL);  }
> > --
> > 2.11.0
> >
> >
> Best regards,
> Igor


More information about the dev mailing list