LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
@ 2015-02-20  1:01 Hiroshi Shimamoto
  2015-02-20  4:04 ` Jeff Kirsher
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hiroshi Shimamoto @ 2015-02-20  1:01 UTC (permalink / raw)
  To: Skidmore, Donald C, vyasevic, Kirsher, Jeffrey T
  Cc: Alexander Duyck, Bjørn Mork, e1000-devel, netdev, Choi,
	Sy Jong, linux-kernel, David Laight, Hayato Momma

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 5529 bytes --]

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Implements the new netdev op to allow VF multicast promiscuous mode.

The administrator can allow to VF multicast promiscuous mode for only
trusted VM. After allowing multicast promiscuous mode from the host,
we can use over 30 IPv6 addresses on VM.
 # ./ip link set dev eth0 vf 1 mc_promisc on

When disallowing multicast promiscuous mode, we can only use 30 IPv6 addresses.
 # ./ip link set dev eth0 vf 1 mc_promisc off

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
CC: Choi, Sy Jong <sy.jong.choi@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h       |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  7 ++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 35 ++++++++++++++++++++++++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h |  2 ++
 4 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 41ed5ab..05293d7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -152,6 +152,7 @@ struct vf_data_storage {
 	u16 tx_rate;
 	u16 vlan_count;
 	u8 spoofchk_enabled;
+	u8 mc_promisc_allowed;
 	unsigned int vf_api;
 };
 
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 70cc4c5..c169fba 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3604,6 +3604,12 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
 		if (hw->mac.ops.set_ethertype_anti_spoofing)
 			hw->mac.ops.set_ethertype_anti_spoofing(hw, true, i);
 	}
+
+	/* Reconfigure multicast promiscuous mode */
+	for (i = 0; i < adapter->num_vfs; i++) {
+		ixgbe_ndo_set_vf_mc_promisc(adapter->netdev, i,
+					adapter->vfinfo[i].mc_promisc_allowed);
+	}
 }
 
 static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
@@ -8052,6 +8058,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
 	.ndo_set_vf_vlan	= ixgbe_ndo_set_vf_vlan,
 	.ndo_set_vf_rate	= ixgbe_ndo_set_vf_bw,
 	.ndo_set_vf_spoofchk	= ixgbe_ndo_set_vf_spoofchk,
+	.ndo_set_vf_mc_promisc	= ixgbe_ndo_set_vf_mc_promisc,
 	.ndo_get_vf_config	= ixgbe_ndo_get_vf_config,
 	.ndo_get_stats64	= ixgbe_get_stats64,
 #ifdef CONFIG_IXGBE_DCB
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 965ad29..288f39f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -108,8 +108,11 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
 		for (i = 0; i < adapter->num_vfs; i++) {
 			/* Enable spoof checking for all VFs */
 			adapter->vfinfo[i].spoofchk_enabled = true;
-			/* Turn multicast promiscuous mode off for all VFs */
+			/* Disallow VF multicast promiscuous capability
+			 * and turn it off for all VFs
+			 */
 			adapter->vfinfo[i].mc_promisc = false;
+			adapter->vfinfo[i].mc_promisc_allowed = false;
 		}
 		return 0;
 	}
@@ -1016,7 +1019,7 @@ static int ixgbe_set_vf_mc_promisc(struct ixgbe_adapter *adapter,
 
 	adapter->vfinfo[vf].mc_promisc = enable;
 
-	if (enable)
+	if (enable && adapter->vfinfo[vf].mc_promisc_allowed)
 		return ixgbe_enable_vf_mc_promisc(adapter, vf);
 	else
 		return ixgbe_disable_vf_mc_promisc(adapter, vf);
@@ -1414,6 +1417,32 @@ int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
 	return 0;
 }
 
+int ixgbe_ndo_set_vf_mc_promisc(struct net_device *netdev, int vf, bool setting)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(netdev);
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 vmolr;
+
+	if (vf >= adapter->num_vfs)
+		return -EINVAL;
+
+	/* nothing to do */
+	if (adapter->vfinfo[vf].mc_promisc_allowed == setting)
+		return 0;
+
+	adapter->vfinfo[vf].mc_promisc_allowed = setting;
+
+	/* if VF requests multicast promiscuous */
+	if (adapter->vfinfo[vf].mc_promisc) {
+		if (setting)
+			ixgbe_enable_vf_mc_promisc(adapter, vf);
+		else
+			ixgbe_disable_vf_mc_promisc(adapter, vf);
+	}
+
+	return 0;
+}
+
 int ixgbe_ndo_get_vf_config(struct net_device *netdev,
 			    int vf, struct ifla_vf_info *ivi)
 {
@@ -1427,5 +1456,7 @@ int ixgbe_ndo_get_vf_config(struct net_device *netdev,
 	ivi->vlan = adapter->vfinfo[vf].pf_vlan;
 	ivi->qos = adapter->vfinfo[vf].pf_qos;
 	ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled;
+	ivi->mc_promisc = adapter->vfinfo[vf].mc_promisc_allowed;
+
 	return 0;
 }
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
index 32c26d5..cfed199 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
@@ -47,6 +47,8 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
 int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
 			int max_tx_rate);
 int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
+int ixgbe_ndo_set_vf_mc_promisc(struct net_device *netdev,
+				int vf, bool setting);
 int ixgbe_ndo_get_vf_config(struct net_device *netdev,
 			    int vf, struct ifla_vf_info *ivi);
 void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);
-- 
2.1.0

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
  2015-02-20  1:01 [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode Hiroshi Shimamoto
@ 2015-02-20  4:04 ` Jeff Kirsher
  2015-02-20  7:50 ` Or Gerlitz
  2015-02-24 20:29 ` [E1000-devel] " Tantilov, Emil S
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2015-02-20  4:04 UTC (permalink / raw)
  To: Hiroshi Shimamoto
  Cc: Skidmore, Donald C, vyasevic, Alexander Duyck, Bjørn Mork,
	e1000-devel, netdev, Choi, Sy Jong, linux-kernel, David Laight,
	Hayato Momma

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

On Fri, 2015-02-20 at 01:01 +0000, Hiroshi Shimamoto wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> Implements the new netdev op to allow VF multicast promiscuous mode.
> 
> The administrator can allow to VF multicast promiscuous mode for only
> trusted VM. After allowing multicast promiscuous mode from the host,
> we can use over 30 IPv6 addresses on VM.
>  # ./ip link set dev eth0 vf 1 mc_promisc on
> 
> When disallowing multicast promiscuous mode, we can only use 30 IPv6
> addresses.
>  # ./ip link set dev eth0 vf 1 mc_promisc off
> 
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
> CC: Choi, Sy Jong <sy.jong.choi@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe.h       |  1 +
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  7 ++++++
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 35
> ++++++++++++++++++++++++--
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h |  2 ++
>  4 files changed, 43 insertions(+), 2 deletions(-)

I have added this to my queue, thanks!

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
  2015-02-20  1:01 [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode Hiroshi Shimamoto
  2015-02-20  4:04 ` Jeff Kirsher
@ 2015-02-20  7:50 ` Or Gerlitz
  2015-02-24 20:29 ` [E1000-devel] " Tantilov, Emil S
  2 siblings, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2015-02-20  7:50 UTC (permalink / raw)
  To: Hiroshi Shimamoto
  Cc: Skidmore, Donald C, vyasevic, Kirsher, Jeffrey T,
	Alexander Duyck, Bjørn Mork, e1000-devel, netdev, Choi,
	Sy Jong, linux-kernel, David Laight, Hayato Momma

On Fri, Feb 20, 2015 at 3:01 AM, Hiroshi Shimamoto
<h-shimamoto@ct.jp.nec.com> wrote:

> The administrator can allow to VF multicast promiscuous mode for only
> trusted VM.
>  # ./ip link set dev eth0 vf 1 mc_promisc on
> When disallowing multicast promiscuous mode, we can only use 30 IPv6 addresses.
>  # ./ip link set dev eth0 vf 1 mc_promisc off

all the above text belongs to the change-log of the patch that
introduces the new ndo also use just "ip" not "./ip" and specify that
the default is off.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [E1000-devel] [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
  2015-02-20  1:01 [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode Hiroshi Shimamoto
  2015-02-20  4:04 ` Jeff Kirsher
  2015-02-20  7:50 ` Or Gerlitz
@ 2015-02-24 20:29 ` Tantilov, Emil S
  2015-02-24 23:43   ` Hiroshi Shimamoto
  2 siblings, 1 reply; 5+ messages in thread
From: Tantilov, Emil S @ 2015-02-24 20:29 UTC (permalink / raw)
  To: Hiroshi Shimamoto, Skidmore, Donald C, vyasevic, Kirsher, Jeffrey T
  Cc: e1000-devel, netdev, Choi, Sy Jong, linux-kernel, David Laight,
	Hayato Momma, Bjørn Mork

>-----Original Message-----
>From: Hiroshi Shimamoto [mailto:h-shimamoto@ct.jp.nec.com] 
>Sent: Thursday, February 19, 2015 5:01 PM
> Subject: [E1000-devel] [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
>
>From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
>Implements the new netdev op to allow VF multicast promiscuous mode.
>
>The administrator can allow to VF multicast promiscuous mode for only
>trusted VM. After allowing multicast promiscuous mode from the host,
>we can use over 30 IPv6 addresses on VM.
> # ./ip link set dev eth0 vf 1 mc_promisc on
>
>When disallowing multicast promiscuous mode, we can only use 30 IPv6 addresses.
> # ./ip link set dev eth0 vf 1 mc_promisc off
>
>Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
>CC: Choi, Sy Jong <sy.jong.choi@intel.com>

<snip>

+int ixgbe_ndo_set_vf_mc_promisc(struct net_device *netdev, int vf, bool setting)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(netdev);
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 vmolr;

vmolr is unused variable in this function.

+
+	if (vf >= adapter->num_vfs)
+		return -EINVAL;
+
+	/* nothing to do */
+	if (adapter->vfinfo[vf].mc_promisc_allowed == setting)
+		return 0;
+
+	adapter->vfinfo[vf].mc_promisc_allowed = setting;
+
+	/* if VF requests multicast promiscuous */
+	if (adapter->vfinfo[vf].mc_promisc) {
+		if (setting)
+			ixgbe_enable_vf_mc_promisc(adapter, vf);
+		else
+			ixgbe_disable_vf_mc_promisc(adapter, vf);
+	}
+
+	return 0;
+}

Thanks,
Emil


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [E1000-devel] [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
  2015-02-24 20:29 ` [E1000-devel] " Tantilov, Emil S
@ 2015-02-24 23:43   ` Hiroshi Shimamoto
  0 siblings, 0 replies; 5+ messages in thread
From: Hiroshi Shimamoto @ 2015-02-24 23:43 UTC (permalink / raw)
  To: Tantilov, Emil S, Skidmore, Donald C, vyasevic, Kirsher, Jeffrey T
  Cc: e1000-devel, netdev, Choi, Sy Jong, linux-kernel, David Laight,
	Hayato Momma, Bjørn Mork

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="ks_c_5601-1987", Size: 1890 bytes --]

> >-----Original Message-----
> >From: Hiroshi Shimamoto [mailto:h-shimamoto@ct.jp.nec.com]
> >Sent: Thursday, February 19, 2015 5:01 PM
> > Subject: [E1000-devel] [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode
> >
> >From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> >
> >Implements the new netdev op to allow VF multicast promiscuous mode.
> >
> >The administrator can allow to VF multicast promiscuous mode for only
> >trusted VM. After allowing multicast promiscuous mode from the host,
> >we can use over 30 IPv6 addresses on VM.
> > # ./ip link set dev eth0 vf 1 mc_promisc on
> >
> >When disallowing multicast promiscuous mode, we can only use 30 IPv6 addresses.
> > # ./ip link set dev eth0 vf 1 mc_promisc off
> >
> >Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> >Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
> >CC: Choi, Sy Jong <sy.jong.choi@intel.com>
> 
> <snip>
> 
> +int ixgbe_ndo_set_vf_mc_promisc(struct net_device *netdev, int vf, bool setting)
> +{
> +	struct ixgbe_adapter *adapter = netdev_priv(netdev);
> +	struct ixgbe_hw *hw = &adapter->hw;
> +	u32 vmolr;
> 
> vmolr is unused variable in this function.
> 
> +
> +	if (vf >= adapter->num_vfs)
> +		return -EINVAL;
> +
> +	/* nothing to do */
> +	if (adapter->vfinfo[vf].mc_promisc_allowed == setting)
> +		return 0;
> +
> +	adapter->vfinfo[vf].mc_promisc_allowed = setting;
> +
> +	/* if VF requests multicast promiscuous */
> +	if (adapter->vfinfo[vf].mc_promisc) {
> +		if (setting)
> +			ixgbe_enable_vf_mc_promisc(adapter, vf);
> +		else
> +			ixgbe_disable_vf_mc_promisc(adapter, vf);
> +	}
> +
> +	return 0;
> +}

thank you for pointing it.
I realized it and am preparing a patch.

thanks,
Hiroshi
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-24 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20  1:01 [PATCH v2 3/3] ixgbe: Add new ndo to allow VF multicast promiscuous mode Hiroshi Shimamoto
2015-02-20  4:04 ` Jeff Kirsher
2015-02-20  7:50 ` Or Gerlitz
2015-02-24 20:29 ` [E1000-devel] " Tantilov, Emil S
2015-02-24 23:43   ` Hiroshi Shimamoto

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).