[dpdk-dev] e1000: enable allmulticast support for VF

Message ID 1432824407-11415-1-git-send-email-yury.kylulin@intel.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Yury Kylulin May 28, 2015, 2:46 p.m. UTC
  Add support to enable and disable reception of all multicast packets by the VF using standard API
rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable().

Signed-off-by: Yury Kylulin <yury.kylulin@intel.com>
---
 drivers/net/e1000/igb_ethdev.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Comments

Thomas Monjalon June 15, 2015, 3:09 p.m. UTC | #1
We still have no maintainer for e1000.
Anyone to double-check this short patch?

2015-05-28 17:46, Yury Kylulin:
> Add support to enable and disable reception of all multicast packets by the VF using standard API
> rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable().
> 
> Signed-off-by: Yury Kylulin <yury.kylulin@intel.com>
[...]
> +static void
> +igbvf_allmulticast_enable(struct rte_eth_dev *dev)
> +{
> +	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	e1000_promisc_set_vf(hw, e1000_promisc_multicast);
> +}
> +
> +static void
> +igbvf_allmulticast_disable(struct rte_eth_dev *dev)
> +{
> +	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	e1000_promisc_set_vf(hw, e1000_promisc_disabled);
> +}

The values come from this enum:
enum e1000_promisc_type {
	e1000_promisc_disabled = 0,   /* all promisc modes disabled */
	e1000_promisc_unicast = 1,    /* unicast promiscuous enabled */
	e1000_promisc_multicast = 2,  /* multicast promiscuous enabled */
	e1000_promisc_enabled = 3,    /* both uni and multicast promisc */
  
Wenzhuo Lu July 14, 2015, 12:59 a.m. UTC | #2
Hi Yury,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yury Kylulin
> Sent: Thursday, May 28, 2015 10:47 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] e1000: enable allmulticast support for VF
> 
> Add support to enable and disable reception of all multicast packets by the VF
> using standard API rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable().
> 
> Signed-off-by: Yury Kylulin <yury.kylulin@intel.com>
> ---
>  drivers/net/e1000/igb_ethdev.c |   20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index e4b370d..5196bd5 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -135,6 +135,8 @@ static int igbvf_dev_configure(struct rte_eth_dev *dev);
> static int igbvf_dev_start(struct rte_eth_dev *dev);  static void
> igbvf_dev_stop(struct rte_eth_dev *dev);  static void igbvf_dev_close(struct
> rte_eth_dev *dev);
> +static void igbvf_allmulticast_enable(struct rte_eth_dev *dev); static
> +void igbvf_allmulticast_disable(struct rte_eth_dev *dev);
>  static int eth_igbvf_link_update(struct e1000_hw *hw);  static void
> eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats);
> static void eth_igbvf_stats_reset(struct rte_eth_dev *dev); @@ -280,6 +282,8
> @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
>  	.dev_start            = igbvf_dev_start,
>  	.dev_stop             = igbvf_dev_stop,
>  	.dev_close            = igbvf_dev_close,
> +	.allmulticast_enable  = igbvf_allmulticast_enable,
> +	.allmulticast_disable = igbvf_allmulticast_disable,
>  	.link_update          = eth_igb_link_update,
>  	.stats_get            = eth_igbvf_stats_get,
>  	.stats_reset          = eth_igbvf_stats_reset,
> @@ -2272,6 +2276,22 @@ igbvf_dev_close(struct rte_eth_dev *dev)
>  	igbvf_dev_stop(dev);
>  }
> 
> +static void
> +igbvf_allmulticast_enable(struct rte_eth_dev *dev) {
> +	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +
> +	e1000_promisc_set_vf(hw, e1000_promisc_multicast); }
> +
> +static void
> +igbvf_allmulticast_disable(struct rte_eth_dev *dev) {
> +	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +
> +	e1000_promisc_set_vf(hw, e1000_promisc_disabled); }
This function disables both multicast and unicast. The PF function eth_igb_allmulticast_disable disables multicast but not unicast. I think it's better that VF and PF have the behavior.

Wenzhuo

> +
>  static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)  {
>  	struct e1000_mbx_info *mbx = &hw->mbx;
> --
> 1.7.9.5
  

Patch

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index e4b370d..5196bd5 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -135,6 +135,8 @@  static int igbvf_dev_configure(struct rte_eth_dev *dev);
 static int igbvf_dev_start(struct rte_eth_dev *dev);
 static void igbvf_dev_stop(struct rte_eth_dev *dev);
 static void igbvf_dev_close(struct rte_eth_dev *dev);
+static void igbvf_allmulticast_enable(struct rte_eth_dev *dev);
+static void igbvf_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_igbvf_link_update(struct e1000_hw *hw);
 static void eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats);
 static void eth_igbvf_stats_reset(struct rte_eth_dev *dev);
@@ -280,6 +282,8 @@  static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.dev_start            = igbvf_dev_start,
 	.dev_stop             = igbvf_dev_stop,
 	.dev_close            = igbvf_dev_close,
+	.allmulticast_enable  = igbvf_allmulticast_enable,
+	.allmulticast_disable = igbvf_allmulticast_disable,
 	.link_update          = eth_igb_link_update,
 	.stats_get            = eth_igbvf_stats_get,
 	.stats_reset          = eth_igbvf_stats_reset,
@@ -2272,6 +2276,22 @@  igbvf_dev_close(struct rte_eth_dev *dev)
 	igbvf_dev_stop(dev);
 }
 
+static void
+igbvf_allmulticast_enable(struct rte_eth_dev *dev)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	e1000_promisc_set_vf(hw, e1000_promisc_multicast);
+}
+
+static void
+igbvf_allmulticast_disable(struct rte_eth_dev *dev)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	e1000_promisc_set_vf(hw, e1000_promisc_disabled);
+}
+
 static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
 {
 	struct e1000_mbx_info *mbx = &hw->mbx;