[dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host

Zhao1, Wei wei.zhao1 at intel.com
Wed Feb 13 04:42:44 CET 2019



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, February 13, 2019 11:42 AM
> To: Zhao1, Wei <wei.zhao1 at intel.com>; dev at dpdk.org
> Cc: stable at dpdk.org; Lu, Wenzhuo <wenzhuo.lu at intel.com>
> Subject: RE: [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Wednesday, January 16, 2019 1:02 PM
> > To: dev at dpdk.org
> > Cc: stable at dpdk.org; Lu, Wenzhuo <wenzhuo.lu at intel.com>; Zhang, Qi Z
> > <qi.z.zhang at intel.com>; Zhao1, Wei <wei.zhao1 at intel.com>
> > Subject: [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
> >
> 
> The title is misleading, we are going to support VF's promiscuous mode but
> not PF.
> 
> How about "Add VF promiscuous mode support when PF as host"

Get, update in v3

> 
> > There is need to PF host promiscuous mode enable. For ixgbe, in order
> > to support VF vlan promiscuous or unicast promiscuous, we need to set
> > PF host register PFVML2FLT of bit UPE and VPE.
> > It also align to ixgbe kernel code version 5.5.3.
> >
> > Fixes: 72dec9e37a84 ("ixgbe: support multicast promiscuous mode on
> > VF")
> 
> Same to previous patch, not a fix.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1 at intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
> >  drivers/net/ixgbe/ixgbe_pf.c     | 78
> > ++++++++++++++++++++++++++++------------
> >  2 files changed, 57 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > index d0b9396..e81f152 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > @@ -265,6 +265,7 @@ struct ixgbe_vf_info {
> >  	uint8_t spoofchk_enabled;
> >  	uint8_t api_version;
> >  	uint16_t switch_domain_id;
> > +	uint16_t xcast_mode;
> >  };
> >
> >  /*
> > diff --git a/drivers/net/ixgbe/ixgbe_pf.c
> > b/drivers/net/ixgbe/ixgbe_pf.c index 4b833ff..c9d1a1c 100644
> > --- a/drivers/net/ixgbe/ixgbe_pf.c
> > +++ b/drivers/net/ixgbe/ixgbe_pf.c
> > @@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev,
> > uint16_t
> > vf)  }
> >
> >  static int
> > -ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf) -{
> > -	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > -	uint32_t vmolr;
> > -
> > -	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> > -
> > -	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
> > -
> > -	vmolr |= IXGBE_VMOLR_MPE;
> > -
> > -	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> > -
> > -	return 0;
> > -}
> > -
> > -static int
> >  ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)  {
> >  	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > @@ -688,19 +671,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev
> *dev,
> > uint32_t vf, uint32_t *msgbuf)  {
> >  	struct ixgbe_vf_info *vfinfo =
> >  		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
> >dev_private));
> > -	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable
> */
> > +	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable
> */
> > +	u32 vmolr, fctrl, disable, enable;
> >
> >  	switch (vfinfo[vf].api_version) {
> >  	case ixgbe_mbox_api_12:
> > +		/* promisc introduced in 1.3 version */
> > +		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
> > +			return -EOPNOTSUPP;
> > +		break;
> > +		/* Fall threw */
> > +	case ixgbe_mbox_api_13:
> >  		break;
> >  	default:
> >  		return -1;
> >  	}
> >
> > -	if (enable)
> > -		return ixgbe_enable_vf_mc_promisc(dev, vf);
> > -	else
> > -		return ixgbe_disable_vf_mc_promisc(dev, vf);
> > +	if (vfinfo[vf].xcast_mode == xcast_mode)
> > +		goto out;
> > +
> > +	switch (xcast_mode) {
> > +	case IXGBEVF_XCAST_MODE_NONE:
> > +		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> > +			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> > IXGBE_VMOLR_VPE;
> > +		enable = 0;
> > +		break;
> > +	case IXGBEVF_XCAST_MODE_MULTI:
> > +		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> > IXGBE_VMOLR_VPE;
> > +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
> > +		break;
> > +	case IXGBEVF_XCAST_MODE_ALLMULTI:
> > +		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
> > +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> > IXGBE_VMOLR_MPE;
> > +		break;
> > +	case IXGBEVF_XCAST_MODE_PROMISC:
> > +		if (hw->mac.type <= ixgbe_mac_82599EB)
> > +			return -1;
> > +
> > +		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
> > +		if (!(fctrl & IXGBE_FCTRL_UPE)) {
> > +			/* VF promisc requires PF in promisc */
> > +			RTE_LOG(ERR, PMD,
> > +			       "Enabling VF promisc requires PF in promisc\n");
> > +			return -1;
> > +		}
> > +
> > +		disable = 0;
> > +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> > +			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> > IXGBE_VMOLR_VPE;
> > +		break;
> > +	default:
> > +		return -1;
> > +	}
> > +
> > +	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> > +	vmolr &= ~disable;
> > +	vmolr |= enable;
> > +	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> > +	vfinfo[vf].xcast_mode = xcast_mode;
> > +
> > +out:
> > +	msgbuf[1] = xcast_mode;
> > +
> > +	return 0;
> >  }
> >
> >  static int
> > --
> > 2.7.5



More information about the dev mailing list