netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] net/mlx4: fixes for ndo VF control calls
@ 2013-05-08 12:30 Or Gerlitz
  2013-05-08 12:30 ` [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps Or Gerlitz
  2013-05-08 12:30 ` [PATCH net 2/2] net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode Or Gerlitz
  0 siblings, 2 replies; 5+ messages in thread
From: Or Gerlitz @ 2013-05-08 12:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, amirv, ronye, Or Gerlitz

Hi Dave,

These are two fixes to the mlx4 implementation of ndo_set_vf calls
we added in the 3.10 merge window.

Or.

Or Gerlitz (1):
  net/mlx4_core: Add missing report on VST and spoof-checking dev caps

Rony Efraim (1):
  net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode

 drivers/net/ethernet/mellanox/mlx4/en_resources.c  |    2 +-
 drivers/net/ethernet/mellanox/mlx4/fw.c            |    4 ++-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |   29 +++++++++++--------
 include/linux/mlx4/qp.h                            |   29 ++++++++++++++++++-
 4 files changed, 48 insertions(+), 16 deletions(-)

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

* [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps
  2013-05-08 12:30 [PATCH net 0/2] net/mlx4: fixes for ndo VF control calls Or Gerlitz
@ 2013-05-08 12:30 ` Or Gerlitz
  2013-05-08 15:58   ` Sergei Shtylyov
  2013-05-08 12:30 ` [PATCH net 2/2] net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode Or Gerlitz
  1 sibling, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2013-05-08 12:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, amirv, ronye, Or Gerlitz

Commits e6b6a23 "net/mlx4: Add VF MAC spoof checking support" and
3f7fb021 "net/mlx4: Add set VF default vlan ID and priority support"
missed reporting in the device capabilities dump when these features
are actually supported. Also two too noisy debug messages which produce
message on every QP opened by a VF, were left in the code, fix that.

Signed-off-by: Rony Efraim <ronye@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/fw.c            |    4 +++-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |    9 ---------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index b147bdd..5444a1a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -131,7 +131,9 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
 		[2] = "RSS XOR Hash Function support",
 		[3] = "Device manage flow steering support",
 		[4] = "Automatic MAC reassignment support",
-		[5] = "Time stamping support"
+		[5] = "Time stamping support",
+		[6] = "VST (control vlan insertion/stripping) support",
+		[7] = "FSM (MAC unti-spoofing) support"
 	};
 	int i;
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index e12e0d2..d4a9de6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -377,19 +377,10 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
 		qpc->pri_path.feup |= 1 << 3; /* set fvl bit */
 		qpc->pri_path.sched_queue &= 0xC7;
 		qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3;
-		mlx4_dbg(dev, "qp %d  port %d Q 0x%x set vlan to %d vidx %d feup %x fl %x\n",
-			 be32_to_cpu(qpc->local_qpn) & 0xffffff, port,
-			 (int)(qpc->pri_path.sched_queue), vp_oper->state.default_vlan,
-			 vp_oper->vlan_idx, (int)(qpc->pri_path.feup),
-			 (int)(qpc->pri_path.fl));
 	}
 	if (vp_oper->state.spoofchk) {
 		qpc->pri_path.feup |= 1 << 5; /* set fsm bit */;
 		qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx;
-		mlx4_dbg(dev, "spoof qp %d  port %d feup  0x%x, myLmc 0x%x mindx %d\n",
-			 be32_to_cpu(qpc->local_qpn) & 0xffffff, port,
-			 (int)qpc->pri_path.feup, (int)qpc->pri_path.grh_mylmc,
-			 vp_oper->mac_idx);
 	}
 	return 0;
 }
-- 
1.7.1

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

* [PATCH net 2/2] net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode
  2013-05-08 12:30 [PATCH net 0/2] net/mlx4: fixes for ndo VF control calls Or Gerlitz
  2013-05-08 12:30 ` [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps Or Gerlitz
@ 2013-05-08 12:30 ` Or Gerlitz
  1 sibling, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2013-05-08 12:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, amirv, ronye, Or Gerlitz

From: Rony Efraim <ronye@mellanox.com>

Make sure that the following steps are taken:

- drop packets sent by the VF with vlan tag
- block packets with vlan tag which are steered to the VF
- drop/block tagged packets when the policy is priority-tagged
- make sure VLAN stripping for received packets is set
- make sure force UP bit for the VF QP is set

Use enum values for all the above instead of numerical bit offsets.

Signed-off-by: Rony Efraim <ronye@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_resources.c  |    2 +-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |   20 +++++++++++--
 include/linux/mlx4/qp.h                            |   29 ++++++++++++++++++-
 3 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
index 91f2b2c..d3f5086 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
@@ -60,7 +60,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
 	context->pri_path.sched_queue = 0x83 | (priv->port - 1) << 6;
 	if (user_prio >= 0) {
 		context->pri_path.sched_queue |= user_prio << 3;
-		context->pri_path.feup = 1 << 6;
+		context->pri_path.feup = MLX4_FEUP_FORCE_ETH_UP;
 	}
 	context->pri_path.counter_index = 0xff;
 	context->cqn_send = cpu_to_be32(cqn);
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index d4a9de6..1157f02 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -372,14 +372,28 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
 		if (MLX4_QP_ST_RC == qp_type)
 			return -EINVAL;
 
+		/* force strip vlan by clear vsd */
+		qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN);
+		if (0 != vp_oper->state.default_vlan) {
+			qpc->pri_path.vlan_control =
+				MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
+				MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED |
+				MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
+		} else { /* priority tagged */
+			qpc->pri_path.vlan_control =
+				MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
+				MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED;
+		}
+
+		qpc->pri_path.fvl_rx |= MLX4_FVL_RX_FORCE_ETH_VLAN;
 		qpc->pri_path.vlan_index = vp_oper->vlan_idx;
-		qpc->pri_path.fl = (1 << 6) | (1 << 2); /* set cv bit and hide_cqe_vlan bit*/
-		qpc->pri_path.feup |= 1 << 3; /* set fvl bit */
+		qpc->pri_path.fl |= MLX4_FL_CV | MLX4_FL_ETH_HIDE_CQE_VLAN;
+		qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN;
 		qpc->pri_path.sched_queue &= 0xC7;
 		qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3;
 	}
 	if (vp_oper->state.spoofchk) {
-		qpc->pri_path.feup |= 1 << 5; /* set fsm bit */;
+		qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC;
 		qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx;
 	}
 	return 0;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 67f46ad..1a0ea47 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -126,7 +126,7 @@ struct mlx4_rss_context {
 
 struct mlx4_qp_path {
 	u8			fl;
-	u8			reserved1[1];
+	u8			vlan_control;
 	u8			disable_pkey_check;
 	u8			pkey_index;
 	u8			counter_index;
@@ -141,11 +141,32 @@ struct mlx4_qp_path {
 	u8			sched_queue;
 	u8			vlan_index;
 	u8			feup;
-	u8			reserved3;
+	u8			fvl_rx;
 	u8			reserved4[2];
 	u8			dmac[6];
 };
 
+enum { /* fl */
+	MLX4_FL_CV      = 1 << 6,
+	MLX4_FL_ETH_HIDE_CQE_VLAN       = 1 << 2
+};
+enum { /* vlan_control */
+	MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED	= 1 << 6,
+	MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED	= 1 << 2,
+	MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED	= 1 << 1,/* 802.1p priorty tag*/
+	MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED	= 1 << 0
+};
+
+enum { /* feup */
+	MLX4_FEUP_FORCE_ETH_UP          = 1 << 6, /* force Eth UP */
+	MLX4_FSM_FORCE_ETH_SRC_MAC      = 1 << 5, /* force Source MAC */
+	MLX4_FVL_FORCE_ETH_VLAN         = 1 << 3  /* force Eth vlan */
+};
+
+enum { /* fvl_rx */
+	MLX4_FVL_RX_FORCE_ETH_VLAN      = 1 << 0 /* enforce Eth rx vlan */
+};
+
 struct mlx4_qp_context {
 	__be32			flags;
 	__be32			pd;
@@ -185,6 +206,10 @@ struct mlx4_qp_context {
 	u32			reserved5[10];
 };
 
+enum { /* param3 */
+	MLX4_STRIP_VLAN = 1 << 30
+};
+
 /* Which firmware version adds support for NEC (NoErrorCompletion) bit */
 #define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232)
 
-- 
1.7.1

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

* Re: [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps
  2013-05-08 12:30 ` [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps Or Gerlitz
@ 2013-05-08 15:58   ` Sergei Shtylyov
  2013-05-09  8:14     ` Or Gerlitz
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2013-05-08 15:58 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: davem, netdev, amirv, ronye

Hello.

On 08-05-2013 16:30, Or Gerlitz wrote:

> Commits e6b6a23 "net/mlx4: Add VF MAC spoof checking support" and
> 3f7fb021 "net/mlx4: Add set VF default vlan ID and priority support"
> missed reporting in the device capabilities dump when these features
> are actually supported. Also two too noisy debug messages which produce
> message on every QP opened by a VF, were left in the code, fix that.

> Signed-off-by: Rony Efraim <ronye@mellanox.com>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/fw.c            |    4 +++-
>   .../net/ethernet/mellanox/mlx4/resource_tracker.c  |    9 ---------
>   2 files changed, 3 insertions(+), 10 deletions(-)

> diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
> index b147bdd..5444a1a 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/fw.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
> @@ -131,7 +131,9 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
>   		[2] = "RSS XOR Hash Function support",
>   		[3] = "Device manage flow steering support",
>   		[4] = "Automatic MAC reassignment support",
> -		[5] = "Time stamping support"
> +		[5] = "Time stamping support",
> +		[6] = "VST (control vlan insertion/stripping) support",
> +		[7] = "FSM (MAC unti-spoofing) support"

     Perhaps "anti-"?

WBR, Sergei

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

* Re: [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps
  2013-05-08 15:58   ` Sergei Shtylyov
@ 2013-05-09  8:14     ` Or Gerlitz
  0 siblings, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2013-05-09  8:14 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: davem, netdev, amirv, ronye

On 08/05/2013 18:58, Sergei Shtylyov wrote:
>> +        [7] = "FSM (MAC unti-spoofing) support"
>
>     Perhaps "anti-"?

sure, fixing and will send V1, thanks spotting this over

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

end of thread, other threads:[~2013-05-09  8:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 12:30 [PATCH net 0/2] net/mlx4: fixes for ndo VF control calls Or Gerlitz
2013-05-08 12:30 ` [PATCH net 1/2] net/mlx4_core: Add missing report on VST and spoof-checking dev caps Or Gerlitz
2013-05-08 15:58   ` Sergei Shtylyov
2013-05-09  8:14     ` Or Gerlitz
2013-05-08 12:30 ` [PATCH net 2/2] net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode Or Gerlitz

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