[PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

Subsystems: mellanox ethernet driver (mlx4_en), mellanox mlx4 core vpi driver, networking drivers, the rest

STALE5136d

6 messages, 3 authors, 2012-07-25 · open the first message on its own page

[PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

From: Or Gerlitz <hidden>
Date: 2012-07-25 14:36:26

From: Amir Vadai <redacted>

RFS filter id can't have the special value RPS_NO_FILTER, 
need to skip it when allocating id's.

Also, changed an ifdef into a more elegant IS_DEFINED.

CC: Ben Hutchings <redacted>
Signed-off-by: Amir Vadai <redacted>
Signed-off-by: Or Gerlitz <redacted>
---

Addressing feedback from Ben Hutchings

resending as of typo in my signature... sorry

 drivers/net/ethernet/mellanox/mlx4/en_cq.c     |    8 ++------
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
index aa9c2f6..866829b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
@@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err = 0;
 	char name[25];
-	struct cpu_rmap *rmap =
-#ifdef CONFIG_RFS_ACCEL
-		priv->dev->rx_cpu_rmap;
-#else
-		NULL;
-#endif
+	struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
+		priv->dev->rx_cpu_rmap : NULL;
 
 	cq->dev = mdev->pndev[priv->port];
 	cq->mcq.set_ci_db  = cq->wqres.db.db;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 8864d8b..edd9cb8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -201,7 +201,7 @@ mlx4_en_filter_alloc(struct mlx4_en_priv *priv, int rxq_index, __be32 src_ip,
 
 	filter->flow_id = flow_id;
 
-	filter->id = priv->last_filter_id++;
+	filter->id = priv->last_filter_id++ % RPS_NO_FILTER;
 
 	list_add_tail(&filter->next, &priv->filters);
 	hlist_add_head(&filter->filter_chain,
-- 
1.7.8.2

Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

From: Ben Hutchings <hidden>
Date: 2012-07-25 14:57:15

On Wed, 2012-07-25 at 17:36 +0300, Or Gerlitz wrote:
From: Amir Vadai <redacted>

RFS filter id can't have the special value RPS_NO_FILTER, 
need to skip it when allocating id's.

Also, changed an ifdef into a more elegant IS_DEFINED.

CC: Ben Hutchings <redacted>
Signed-off-by: Amir Vadai <redacted>
Signed-off-by: Or Gerlitz <redacted>
---

Addressing feedback from Ben Hutchings

resending as of typo in my signature... sorry
--signoff is so much easier than typing it every time :-)
quoted hunk
 drivers/net/ethernet/mellanox/mlx4/en_cq.c     |    8 ++------
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
index aa9c2f6..866829b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
@@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err = 0;
 	char name[25];
-	struct cpu_rmap *rmap =
-#ifdef CONFIG_RFS_ACCEL
-		priv->dev->rx_cpu_rmap;
-#else
-		NULL;
-#endif
+	struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
+		priv->dev->rx_cpu_rmap : NULL;
This is a separate change.
 
quoted hunk
 	cq->dev = mdev->pndev[priv->port];
 	cq->mcq.set_ci_db  = cq->wqres.db.db;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 8864d8b..edd9cb8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -201,7 +201,7 @@ mlx4_en_filter_alloc(struct mlx4_en_priv *priv, int rxq_index, __be32 src_ip,
 
 	filter->flow_id = flow_id;
 
-	filter->id = priv->last_filter_id++;
+	filter->id = priv->last_filter_id++ % RPS_NO_FILTER;
This should do for now.

Ideally the filter ID would be based on the index used in hardware.  We
would need to change the API to allow for devices where this cannot be
determined synchronously, as in this driver.  (And the filter ID might
also need to be wider.)

Ben.
 
 	list_add_tail(&filter->next, &priv->filters);
 	hlist_add_head(&filter->filter_chain,
-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

From: Ben Hutchings <hidden>
Date: 2012-07-25 14:57:30

On Wed, 2012-07-25 at 17:36 +0300, Or Gerlitz wrote:
From: Amir Vadai <redacted>

RFS filter id can't have the special value RPS_NO_FILTER, 
need to skip it when allocating id's.

Also, changed an ifdef into a more elegant IS_DEFINED.

CC: Ben Hutchings <redacted>
Signed-off-by: Amir Vadai <redacted>
Signed-off-by: Or Gerlitz <redacted>
---

Addressing feedback from Ben Hutchings

resending as of typo in my signature... sorry
--signoff is so much easier than typing it every time :-)
quoted hunk
 drivers/net/ethernet/mellanox/mlx4/en_cq.c     |    8 ++------
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
index aa9c2f6..866829b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
@@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err = 0;
 	char name[25];
-	struct cpu_rmap *rmap =
-#ifdef CONFIG_RFS_ACCEL
-		priv->dev->rx_cpu_rmap;
-#else
-		NULL;
-#endif
+	struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
+		priv->dev->rx_cpu_rmap : NULL;
This ought to be a separate change really.
 
quoted hunk
 	cq->dev = mdev->pndev[priv->port];
 	cq->mcq.set_ci_db  = cq->wqres.db.db;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 8864d8b..edd9cb8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -201,7 +201,7 @@ mlx4_en_filter_alloc(struct mlx4_en_priv *priv, int rxq_index, __be32 src_ip,
 
 	filter->flow_id = flow_id;
 
-	filter->id = priv->last_filter_id++;
+	filter->id = priv->last_filter_id++ % RPS_NO_FILTER;
This should do for now.

Ideally the filter ID would be based on the index used in hardware.  We
would need to change the API to allow for devices where this cannot be
determined synchronously, as in this driver.  (And the filter ID might
also need to be wider.)

Ben.
 
 	list_add_tail(&filter->next, &priv->filters);
 	hlist_add_head(&filter->filter_chain,
-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

From: Or Gerlitz <hidden>
Date: 2012-07-25 15:08:08

On 25/07/2012 17:57, Ben Hutchings wrote:
resending as of typo in my signature... sorry

--signoff is so much easier than typing it every time :-)
I know and I do that on the regular basis, today did that differently 
and here's the result...

Or.
quoted
  drivers/net/ethernet/mellanox/mlx4/en_cq.c     |    8 ++------
  drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
  2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
index aa9c2f6..866829b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
@@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
  	struct mlx4_en_dev *mdev = priv->mdev;
  	int err = 0;
  	char name[25];
-	struct cpu_rmap *rmap =
-#ifdef CONFIG_RFS_ACCEL
-		priv->dev->rx_cpu_rmap;
-#else
-		NULL;
-#endif
+	struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
+		priv->dev->rx_cpu_rmap : NULL;
This is a separate change.
OK, will send two patches
quoted
  	cq->dev = mdev->pndev[priv->port];
  	cq->mcq.set_ci_db  = cq->wqres.db.db;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 8864d8b..edd9cb8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -201,7 +201,7 @@ mlx4_en_filter_alloc(struct mlx4_en_priv *priv, int rxq_index, __be32 src_ip,

  	filter->flow_id = flow_id;

-	filter->id = priv->last_filter_id++;
+	filter->id = priv->last_filter_id++ % RPS_NO_FILTER;
This should do for now.
thanks

Or.

Ideally the filter ID would be based on the index used in hardware.  We
would need to change the API to allow for devices where this cannot be
determined synchronously, as in this driver.  (And the filter ID might
also need to be wider.)

Ben.
quoted
  	list_add_tail(&filter->next,&priv->filters);
  	hlist_add_head(&filter->filter_chain,

Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

From: David Miller <davem@davemloft.net>
Date: 2012-07-25 22:23:38

From: Or Gerlitz <redacted>
Date: Wed, 25 Jul 2012 18:04:35 +0300
On 25/07/2012 17:57, Ben Hutchings wrote:
quoted
quoted
@@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv,
struct mlx4_en_cq *cq,
  	struct mlx4_en_dev *mdev = priv->mdev;
  	int err = 0;
  	char name[25];
-	struct cpu_rmap *rmap =
-#ifdef CONFIG_RFS_ACCEL
-		priv->dev->rx_cpu_rmap;
-#else
-		NULL;
-#endif
+	struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
+		priv->dev->rx_cpu_rmap : NULL;
This is a separate change.
OK, will send two patches
This change breaks the build.

You can't do this check at run-time, because the reason you need to
check CONFIG_RFS_ACCEL is because if that's disabled then the netdev
structure doesn't even have the ->rx_cpu_rmap member.

Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER

From: Ben Hutchings <hidden>
Date: 2012-07-25 22:29:58

On Wed, 2012-07-25 at 15:23 -0700, David Miller wrote:
From: Or Gerlitz <redacted>
Date: Wed, 25 Jul 2012 18:04:35 +0300
quoted
On 25/07/2012 17:57, Ben Hutchings wrote:
quoted
quoted
@@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv,
struct mlx4_en_cq *cq,
  	struct mlx4_en_dev *mdev = priv->mdev;
  	int err = 0;
  	char name[25];
-	struct cpu_rmap *rmap =
-#ifdef CONFIG_RFS_ACCEL
-		priv->dev->rx_cpu_rmap;
-#else
-		NULL;
-#endif
+	struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
+		priv->dev->rx_cpu_rmap : NULL;
This is a separate change.
OK, will send two patches
This change breaks the build.

You can't do this check at run-time, because the reason you need to
check CONFIG_RFS_ACCEL is because if that's disabled then the netdev
structure doesn't even have the ->rx_cpu_rmap member.
Yes, sorry for suggesting that, Or.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help