Netdev List
 help / color / mirror / Atom feed
* [PATCH net 2/6] net/mlx4_core: Fix number of EQs used in ICM initialisation
From: Yevgeny Petrilin @ 2012-05-30 19:14 UTC (permalink / raw)
  Cc: netdev, ogerlitz, Marcel Apfelbaum, Jack Morgenstein
In-Reply-To: <1338405295-15427-1-git-send-email-yevgenyp@mellanox.com>

From: Marcel Apfelbaum <marcela@dev.mellanox.co.il>

In SRIOV mode, the number of EQs used when computing the total ICM size
was incorrect.

To fix this, we do the following:
1. We add a new structure to mlx4_dev, mlx4_phys_caps, to contain physical HCA
   capabilities.  The PPF uses the phys capabilities when it computes things
   like ICM size.

   The dev_caps structure will then contain the paravirtualized values, making
   bookkeeping much easier in SRIOV mode. We add a structure rather than a
   single parameter because there will be other fields in the phys_caps.

   The first field we add to the mlx4_phys_caps structure is num_phys_eqs.

2. In INIT_HCA, when running in SRIOV mode, the "log_num_eqs" parameter
   passed to the FW is the number of EQs per VF/PF; each function (PF or VF)
   has this number of EQs available.

   However, the total number of EQs which must be allowed for in the ICM is
   (1 << log_num_eqs) * (#VFs + #PFs).  Rather than compute this quantity,
   we allocate ICM space for 1024 EQs (which is the device maximum
   number of EQs, and which is the value we place in the mlx4_phys_caps structure).

   For INIT_HCA, however, we use the per-function number of EQs as described
   above.

Signed-off-by: Marcel Apfelbaum <marcela@dev.mellanox.co.il>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c    |   17 +++++------------
 drivers/net/ethernet/mellanox/mlx4/profile.c |    9 ++++++---
 include/linux/mlx4/device.h                  |    6 ++++++
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 2e024a6..2fe9fe5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -142,12 +142,6 @@ struct mlx4_port_config {
 	struct pci_dev *pdev;
 };
 
-static inline int mlx4_master_get_num_eqs(struct mlx4_dev *dev)
-{
-	return dev->caps.reserved_eqs +
-		MLX4_MFUNC_EQ_NUM * (dev->num_slaves + 1);
-}
-
 int mlx4_check_port_params(struct mlx4_dev *dev,
 			   enum mlx4_port_type *port_type)
 {
@@ -217,6 +211,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
 	}
 
 	dev->caps.num_ports	     = dev_cap->num_ports;
+	dev->phys_caps.num_phys_eqs  = MLX4_MAX_EQ_NUM;
 	for (i = 1; i <= dev->caps.num_ports; ++i) {
 		dev->caps.vl_cap[i]	    = dev_cap->max_vl[i];
 		dev->caps.ib_mtu_cap[i]	    = dev_cap->ib_mtu[i];
@@ -810,9 +805,8 @@ static int mlx4_init_cmpt_table(struct mlx4_dev *dev, u64 cmpt_base,
 	if (err)
 		goto err_srq;
 
-	num_eqs = (mlx4_is_master(dev)) ?
-		roundup_pow_of_two(mlx4_master_get_num_eqs(dev)) :
-		dev->caps.num_eqs;
+	num_eqs = (mlx4_is_master(dev)) ? dev->phys_caps.num_phys_eqs :
+		  dev->caps.num_eqs;
 	err = mlx4_init_icm_table(dev, &priv->eq_table.cmpt_table,
 				  cmpt_base +
 				  ((u64) (MLX4_CMPT_TYPE_EQ *
@@ -874,9 +868,8 @@ static int mlx4_init_icm(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap,
 	}
 
 
-	num_eqs = (mlx4_is_master(dev)) ?
-		roundup_pow_of_two(mlx4_master_get_num_eqs(dev)) :
-		dev->caps.num_eqs;
+	num_eqs = (mlx4_is_master(dev)) ? dev->phys_caps.num_phys_eqs :
+		   dev->caps.num_eqs;
 	err = mlx4_init_icm_table(dev, &priv->eq_table.table,
 				  init_hca->eqc_base, dev_cap->eqc_entry_sz,
 				  num_eqs, num_eqs, 0, 0);
diff --git a/drivers/net/ethernet/mellanox/mlx4/profile.c b/drivers/net/ethernet/mellanox/mlx4/profile.c
index 06e5ade..b83bc92 100644
--- a/drivers/net/ethernet/mellanox/mlx4/profile.c
+++ b/drivers/net/ethernet/mellanox/mlx4/profile.c
@@ -126,7 +126,9 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
 	profile[MLX4_RES_AUXC].num    = request->num_qp;
 	profile[MLX4_RES_SRQ].num     = request->num_srq;
 	profile[MLX4_RES_CQ].num      = request->num_cq;
-	profile[MLX4_RES_EQ].num      = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX);
+	profile[MLX4_RES_EQ].num      = mlx4_is_mfunc(dev) ?
+					dev->phys_caps.num_phys_eqs :
+					min_t(unsigned, dev_cap->max_eqs, MAX_MSIX);
 	profile[MLX4_RES_DMPT].num    = request->num_mpt;
 	profile[MLX4_RES_CMPT].num    = MLX4_NUM_CMPTS;
 	profile[MLX4_RES_MTT].num     = request->num_mtt * (1 << log_mtts_per_seg);
@@ -215,9 +217,10 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
 			init_hca->log_num_cqs = profile[i].log_num;
 			break;
 		case MLX4_RES_EQ:
-			dev->caps.num_eqs     = profile[i].num;
+			dev->caps.num_eqs     = roundup_pow_of_two(min_t(unsigned, dev_cap->max_eqs,
+									 MAX_MSIX));
 			init_hca->eqc_base    = profile[i].start;
-			init_hca->log_num_eqs = profile[i].log_num;
+			init_hca->log_num_eqs = ilog2(dev->caps.num_eqs);
 			break;
 		case MLX4_RES_DMPT:
 			dev->caps.num_mpts	= profile[i].num;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6e27fa9..6a8f002 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -64,6 +64,7 @@ enum {
 	MLX4_MAX_NUM_PF		= 16,
 	MLX4_MAX_NUM_VF		= 64,
 	MLX4_MFUNC_MAX		= 80,
+	MLX4_MAX_EQ_NUM		= 1024,
 	MLX4_MFUNC_EQ_NUM	= 4,
 	MLX4_MFUNC_MAX_EQES     = 8,
 	MLX4_MFUNC_EQE_MASK     = (MLX4_MFUNC_MAX_EQES - 1)
@@ -239,6 +240,10 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
 	return (major << 32) | (minor << 16) | subminor;
 }
 
+struct mlx4_phys_caps {
+	u32			num_phys_eqs;
+};
+
 struct mlx4_caps {
 	u64			fw_ver;
 	u32			function;
@@ -499,6 +504,7 @@ struct mlx4_dev {
 	unsigned long		flags;
 	unsigned long		num_slaves;
 	struct mlx4_caps	caps;
+	struct mlx4_phys_caps	phys_caps;
 	struct radix_tree_root	qp_table_tree;
 	u8			rev_id;
 	char			board_id[MLX4_BOARD_ID_LEN];
-- 
1.7.1

^ permalink raw reply related

* [PATCH net 1/6] net/mlx4_core: Fix the slave_id out-of-range test in mlx4_eq_int
From: Yevgeny Petrilin @ 2012-05-30 19:19 UTC (permalink / raw)
  To: davem; +Cc: netdev, ogerlitz, Jack Morgenstein

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

Ths fixes the comparison in the FLR (Function Level Reset) event case.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/eq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 3b6f8ef..bce98d9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -426,7 +426,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
 
 			mlx4_dbg(dev, "FLR event for slave: %d\n", flr_slave);
 
-			if (flr_slave > dev->num_slaves) {
+			if (flr_slave >= dev->num_slaves) {
 				mlx4_warn(dev,
 					  "Got FLR for unknown function: %d\n",
 					  flr_slave);
-- 
1.7.1

^ permalink raw reply related

* [PATCH net 2/6] net/mlx4_core: Fix number of EQs used in ICM initialisation
From: Yevgeny Petrilin @ 2012-05-30 19:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, ogerlitz, Marcel Apfelbaum, Jack Morgenstein

From: Marcel Apfelbaum <marcela@dev.mellanox.co.il>

In SRIOV mode, the number of EQs used when computing the total ICM size
was incorrect.

To fix this, we do the following:
1. We add a new structure to mlx4_dev, mlx4_phys_caps, to contain physical HCA
   capabilities.  The PPF uses the phys capabilities when it computes things
   like ICM size.

   The dev_caps structure will then contain the paravirtualized values, making
   bookkeeping much easier in SRIOV mode. We add a structure rather than a
   single parameter because there will be other fields in the phys_caps.

   The first field we add to the mlx4_phys_caps structure is num_phys_eqs.

2. In INIT_HCA, when running in SRIOV mode, the "log_num_eqs" parameter
   passed to the FW is the number of EQs per VF/PF; each function (PF or VF)
   has this number of EQs available.

   However, the total number of EQs which must be allowed for in the ICM is
   (1 << log_num_eqs) * (#VFs + #PFs).  Rather than compute this quantity,
   we allocate ICM space for 1024 EQs (which is the device maximum
   number of EQs, and which is the value we place in the mlx4_phys_caps structure).

   For INIT_HCA, however, we use the per-function number of EQs as described
   above.

Signed-off-by: Marcel Apfelbaum <marcela@dev.mellanox.co.il>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c    |   17 +++++------------
 drivers/net/ethernet/mellanox/mlx4/profile.c |    9 ++++++---
 include/linux/mlx4/device.h                  |    6 ++++++
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 2e024a6..2fe9fe5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -142,12 +142,6 @@ struct mlx4_port_config {
 	struct pci_dev *pdev;
 };
 
-static inline int mlx4_master_get_num_eqs(struct mlx4_dev *dev)
-{
-	return dev->caps.reserved_eqs +
-		MLX4_MFUNC_EQ_NUM * (dev->num_slaves + 1);
-}
-
 int mlx4_check_port_params(struct mlx4_dev *dev,
 			   enum mlx4_port_type *port_type)
 {
@@ -217,6 +211,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
 	}
 
 	dev->caps.num_ports	     = dev_cap->num_ports;
+	dev->phys_caps.num_phys_eqs  = MLX4_MAX_EQ_NUM;
 	for (i = 1; i <= dev->caps.num_ports; ++i) {
 		dev->caps.vl_cap[i]	    = dev_cap->max_vl[i];
 		dev->caps.ib_mtu_cap[i]	    = dev_cap->ib_mtu[i];
@@ -810,9 +805,8 @@ static int mlx4_init_cmpt_table(struct mlx4_dev *dev, u64 cmpt_base,
 	if (err)
 		goto err_srq;
 
-	num_eqs = (mlx4_is_master(dev)) ?
-		roundup_pow_of_two(mlx4_master_get_num_eqs(dev)) :
-		dev->caps.num_eqs;
+	num_eqs = (mlx4_is_master(dev)) ? dev->phys_caps.num_phys_eqs :
+		  dev->caps.num_eqs;
 	err = mlx4_init_icm_table(dev, &priv->eq_table.cmpt_table,
 				  cmpt_base +
 				  ((u64) (MLX4_CMPT_TYPE_EQ *
@@ -874,9 +868,8 @@ static int mlx4_init_icm(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap,
 	}
 
 
-	num_eqs = (mlx4_is_master(dev)) ?
-		roundup_pow_of_two(mlx4_master_get_num_eqs(dev)) :
-		dev->caps.num_eqs;
+	num_eqs = (mlx4_is_master(dev)) ? dev->phys_caps.num_phys_eqs :
+		   dev->caps.num_eqs;
 	err = mlx4_init_icm_table(dev, &priv->eq_table.table,
 				  init_hca->eqc_base, dev_cap->eqc_entry_sz,
 				  num_eqs, num_eqs, 0, 0);
diff --git a/drivers/net/ethernet/mellanox/mlx4/profile.c b/drivers/net/ethernet/mellanox/mlx4/profile.c
index 06e5ade..b83bc92 100644
--- a/drivers/net/ethernet/mellanox/mlx4/profile.c
+++ b/drivers/net/ethernet/mellanox/mlx4/profile.c
@@ -126,7 +126,9 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
 	profile[MLX4_RES_AUXC].num    = request->num_qp;
 	profile[MLX4_RES_SRQ].num     = request->num_srq;
 	profile[MLX4_RES_CQ].num      = request->num_cq;
-	profile[MLX4_RES_EQ].num      = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX);
+	profile[MLX4_RES_EQ].num      = mlx4_is_mfunc(dev) ?
+					dev->phys_caps.num_phys_eqs :
+					min_t(unsigned, dev_cap->max_eqs, MAX_MSIX);
 	profile[MLX4_RES_DMPT].num    = request->num_mpt;
 	profile[MLX4_RES_CMPT].num    = MLX4_NUM_CMPTS;
 	profile[MLX4_RES_MTT].num     = request->num_mtt * (1 << log_mtts_per_seg);
@@ -215,9 +217,10 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
 			init_hca->log_num_cqs = profile[i].log_num;
 			break;
 		case MLX4_RES_EQ:
-			dev->caps.num_eqs     = profile[i].num;
+			dev->caps.num_eqs     = roundup_pow_of_two(min_t(unsigned, dev_cap->max_eqs,
+									 MAX_MSIX));
 			init_hca->eqc_base    = profile[i].start;
-			init_hca->log_num_eqs = profile[i].log_num;
+			init_hca->log_num_eqs = ilog2(dev->caps.num_eqs);
 			break;
 		case MLX4_RES_DMPT:
 			dev->caps.num_mpts	= profile[i].num;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6e27fa9..6a8f002 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -64,6 +64,7 @@ enum {
 	MLX4_MAX_NUM_PF		= 16,
 	MLX4_MAX_NUM_VF		= 64,
 	MLX4_MFUNC_MAX		= 80,
+	MLX4_MAX_EQ_NUM		= 1024,
 	MLX4_MFUNC_EQ_NUM	= 4,
 	MLX4_MFUNC_MAX_EQES     = 8,
 	MLX4_MFUNC_EQE_MASK     = (MLX4_MFUNC_MAX_EQES - 1)
@@ -239,6 +240,10 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
 	return (major << 32) | (minor << 16) | subminor;
 }
 
+struct mlx4_phys_caps {
+	u32			num_phys_eqs;
+};
+
 struct mlx4_caps {
 	u64			fw_ver;
 	u32			function;
@@ -499,6 +504,7 @@ struct mlx4_dev {
 	unsigned long		flags;
 	unsigned long		num_slaves;
 	struct mlx4_caps	caps;
+	struct mlx4_phys_caps	phys_caps;
 	struct radix_tree_root	qp_table_tree;
 	u8			rev_id;
 	char			board_id[MLX4_BOARD_ID_LEN];
-- 
1.7.1

^ permalink raw reply related

* [PATCH net 5/6] net/mlx4_core: Check port out-of-range before using in mlx4_slave_cap
From: Yevgeny Petrilin @ 2012-05-30 19:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, ogerlitz, Jack Morgenstein

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

The range check was performed after using the port number.

Reverse this to prevent a potential array overflow.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 7f71be0..ee6f4fe 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -485,15 +485,15 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
 	dev->caps.num_mgms              = 0;
 	dev->caps.num_amgms             = 0;
 
-	for (i = 1; i <= dev->caps.num_ports; ++i)
-		dev->caps.port_mask[i] = dev->caps.port_type[i];
-
 	if (dev->caps.num_ports > MLX4_MAX_PORTS) {
 		mlx4_err(dev, "HCA has %d ports, but we only support %d, "
 			 "aborting.\n", dev->caps.num_ports, MLX4_MAX_PORTS);
 		return -ENODEV;
 	}
 
+	for (i = 1; i <= dev->caps.num_ports; ++i)
+		dev->caps.port_mask[i] = dev->caps.port_type[i];
+
 	if (dev->caps.uar_page_size * (dev->caps.num_uars -
 				       dev->caps.reserved_uars) >
 				       pci_resource_len(dev->pdev, 2)) {
-- 
1.7.1

^ permalink raw reply related

* [PATCH net 5/6] net/mlx4_core: Check port out-of-range before using in mlx4_slave_cap
From: Yevgeny Petrilin @ 2012-05-30 19:14 UTC (permalink / raw)
  Cc: netdev, ogerlitz, Jack Morgenstein
In-Reply-To: <1338405295-15427-1-git-send-email-yevgenyp@mellanox.com>

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

The range check was performed after using the port number.

Reverse this to prevent a potential array overflow.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 7f71be0..ee6f4fe 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -485,15 +485,15 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
 	dev->caps.num_mgms              = 0;
 	dev->caps.num_amgms             = 0;
 
-	for (i = 1; i <= dev->caps.num_ports; ++i)
-		dev->caps.port_mask[i] = dev->caps.port_type[i];
-
 	if (dev->caps.num_ports > MLX4_MAX_PORTS) {
 		mlx4_err(dev, "HCA has %d ports, but we only support %d, "
 			 "aborting.\n", dev->caps.num_ports, MLX4_MAX_PORTS);
 		return -ENODEV;
 	}
 
+	for (i = 1; i <= dev->caps.num_ports; ++i)
+		dev->caps.port_mask[i] = dev->caps.port_type[i];
+
 	if (dev->caps.uar_page_size * (dev->caps.num_uars -
 				       dev->caps.reserved_uars) >
 				       pci_resource_len(dev->pdev, 2)) {
-- 
1.7.1

^ permalink raw reply related

* Re: pull request: wireless 2012-05-30
From: David Miller @ 2012-05-30 20:19 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20120530171300.GA2674@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Wed, 30 May 2012 13:13:00 -0400

> Here is a batch of fixes intended for 3.5.  They have spent a little
> time in linux-next, and for the most part they are reasonably small
> and obvious.

Pulled, thanks John.

^ permalink raw reply

* [PATCH 0/4] treewide: Fix likely misuses of | for &
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
  To: linux-usb, linux-wireless; +Cc: linux-can, netdev, linux-kernel

| with a non-zero constant is always true.
Likely these should have been &.

Joe Perches (4):
  mac80211: Fix likely misuse of | for &
  can: cc770: Fix likely misuse of | for &
  brcmfmac: Fix likely misuse of | for &
  usb: gadget: pch_udc: Fix likely misuse of | for &

 drivers/net/can/cc770/cc770_platform.c           |    2 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |    4 ++--
 drivers/usb/gadget/pch_udc.c                     |    2 +-
 net/mac80211/cfg.c                               |    6 +++---
 4 files changed, 7 insertions(+), 7 deletions(-)

-- 
1.7.8.111.gad25c.dirty


^ permalink raw reply

* [PATCH 1/4] mac80211: Fix likely misuse of | for &
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
  To: John W. Linville, Johannes Berg
  Cc: Ben Greear, David S. Miller, linux-wireless, netdev, linux-kernel
In-Reply-To: <cover.1338408931.git.joe@perches.com>

Using | with a constant is always true.
Likely this should have be &.

cc: Ben Greear <greearb@candelatech.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
 net/mac80211/cfg.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 495831e..e9cecca 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -533,16 +533,16 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
 		sinfo.filled = 0;
 		sta_set_sinfo(sta, &sinfo);
 
-		if (sinfo.filled | STATION_INFO_TX_BITRATE)
+		if (sinfo.filled & STATION_INFO_TX_BITRATE)
 			data[i] = 100000 *
 				cfg80211_calculate_bitrate(&sinfo.txrate);
 		i++;
-		if (sinfo.filled | STATION_INFO_RX_BITRATE)
+		if (sinfo.filled & STATION_INFO_RX_BITRATE)
 			data[i] = 100000 *
 				cfg80211_calculate_bitrate(&sinfo.rxrate);
 		i++;
 
-		if (sinfo.filled | STATION_INFO_SIGNAL_AVG)
+		if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
 			data[i] = (u8)sinfo.signal_avg;
 		i++;
 	} else {
-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply related

* [PATCH 2/4] can: cc770: Fix likely misuse of | for &
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wolfgang Grandegger, Marc Kleine-Budde, linux-can, netdev
In-Reply-To: <cover.1338408931.git.joe@perches.com>

Using | with a constant is always true.
Likely this should have be &.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/can/cc770/cc770_platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
index 53115ee..688371c 100644
--- a/drivers/net/can/cc770/cc770_platform.c
+++ b/drivers/net/can/cc770/cc770_platform.c
@@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
 	struct cc770_platform_data *pdata = pdev->dev.platform_data;
 
 	priv->can.clock.freq = pdata->osc_freq;
-	if (priv->cpu_interface | CPUIF_DSC)
+	if (priv->cpu_interface & CPUIF_DSC)
 		priv->can.clock.freq /= 2;
 	priv->clkout = pdata->cor;
 	priv->bus_config = pdata->bcr;
-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply related

* [PATCH 3/4] brcmfmac: Fix likely misuse of | for &
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Brett Rudley, Roland Vossen, Arend van Spriel,
	Franky (Zhenhui) Lin, Kan Yan, John W. Linville, linux-wireless,
	netdev
In-Reply-To: <cover.1338408931.git.joe@perches.com>

Using | with a constant is always true.
Likely this should have be &.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index e2480d1..8e7e692 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -89,9 +89,9 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
 	data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1;
 	brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret);
 
-	/* redirect, configure ane enable io for interrupt signal */
+	/* redirect, configure and enable io for interrupt signal */
 	data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
-	if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH)
+	if (sdiodev->irq_flags & IRQF_TRIGGER_HIGH)
 		data |= SDIO_SEPINT_ACT_HI;
 	brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
 
-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply related

* Re: [PATCH] 8021q/vlan: process NETDEV_GOING_DOWN
From: David Miller @ 2012-05-30 20:27 UTC (permalink / raw)
  To: eldad; +Cc: kaber, netdev, linux-kernel
In-Reply-To: <alpine.DEB.2.02.1205302055140.1587@debianer>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Wed, 30 May 2012 21:11:02 +0200 (CEST)

> In case a certain protocol needs to send a "dying gasp" packet, when you 
> administrativly shutdown the port (which is also what happens when you 
> restart the machine).

No in tree users have this requirement, therefore your patch is
inappropriate.

^ permalink raw reply

* Re: [PATCH 1/4] mac80211: Fix likely misuse of | for &
From: Ben Greear @ 2012-05-30 20:29 UTC (permalink / raw)
  To: Joe Perches
  Cc: John W. Linville, Johannes Berg, David S. Miller, linux-wireless,
	netdev, linux-kernel
In-Reply-To: <aa9c55edda55d38111660c0b250d12d79f6e1755.1338408931.git.joe@perches.com>

On 05/30/2012 01:25 PM, Joe Perches wrote:
> Using | with a constant is always true.
> Likely this should have be&.

Yes, I think your change is correct.  Looks like something
a compiler or static analysis tool could catch and warn about...

Sorry for the bug!

Ben

>
> cc: Ben Greear<greearb@candelatech.com>
> Signed-off-by: Joe Perches<joe@perches.com>
> ---
>   net/mac80211/cfg.c |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 495831e..e9cecca 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -533,16 +533,16 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
>   		sinfo.filled = 0;
>   		sta_set_sinfo(sta,&sinfo);
>
> -		if (sinfo.filled | STATION_INFO_TX_BITRATE)
> +		if (sinfo.filled&  STATION_INFO_TX_BITRATE)
>   			data[i] = 100000 *
>   				cfg80211_calculate_bitrate(&sinfo.txrate);
>   		i++;
> -		if (sinfo.filled | STATION_INFO_RX_BITRATE)
> +		if (sinfo.filled&  STATION_INFO_RX_BITRATE)
>   			data[i] = 100000 *
>   				cfg80211_calculate_bitrate(&sinfo.rxrate);
>   		i++;
>
> -		if (sinfo.filled | STATION_INFO_SIGNAL_AVG)
> +		if (sinfo.filled&  STATION_INFO_SIGNAL_AVG)
>   			data[i] = (u8)sinfo.signal_avg;
>   		i++;
>   	} else {


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Re: [PATCH] netdevice: Update netif_dbg for CONFIG_DYNAMIC_DEBUG
From: David Miller @ 2012-05-30 20:34 UTC (permalink / raw)
  To: joe; +Cc: netdev, jim.cromie, jbaron
In-Reply-To: <1338399814.3715.6.camel@joe2Laptop>

From: Joe Perches <joe@perches.com>
Date: Wed, 30 May 2012 10:43:34 -0700

> Make netif_dbg use dynamic debugging whenever
> CONFIG_DYNAMIC_DEBUG is enabled.
> 
> commit b558c96ffa53
> ("dynamic_debug: make dynamic-debug supersede DEBUG ccflag")
> missed updating the netif_dbg variant.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied, thanks Joe.

^ permalink raw reply

* Re: [PATCH repost] virtio-net: remove useless disable on freeze
From: David Miller @ 2012-05-30 20:36 UTC (permalink / raw)
  To: mst; +Cc: netdev, linux-kernel, virtualization
In-Reply-To: <20120530142128.GA31299@redhat.com>

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Wed, 30 May 2012 17:21:29 +0300

> disable_cb is just an optimization: it
> can not guarantee that there are no callbacks.
> In particular it doesn't have any effect when
> event index is on.
> 
> Instead, detach, napi disable and reset on freeze ensure we don't run
> concurrently with a callback.
> 
> Remove the useless calls so we get same behaviour
> with and without event index.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> Reposting a patch that seems to have fallen through cracks.

It seems to not make it to the lists and get properly picked up
by patchwork.

In any event, I've applied this, thanks.

^ permalink raw reply

* Re: [PATCH net 0/6] batch of mlx4 fixes, mostly to SRIOV
From: David Miller @ 2012-05-30 20:37 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev, ogerlitz, yevgenyp, jackm
In-Reply-To: <1338405295-15427-1-git-send-email-yevgenyp@mellanox.com>


Why did you send multiple copies of some of these patches to
the list?

Patches #1, #2, and #5 showed up twice.

^ permalink raw reply

* ῥ ö ḱ ѐ ѓ   ö ἠ l i ἠ ѐ
From: Clelia Perretta @ 2012-05-30 20:41 UTC (permalink / raw)
  To: netdesk@dlsnet.demon.co.uk

At that tenant, naturally the vice of making was mocking first place, frankly was swearing he asphyxiateed so much as that intention would champagne mockingly as before that his suspicions were hairy and utterly groundless.

ȇòӑӑḁ=http://pкǖὂ.twonysix.com?ḙû

Regretfully he liked the disclosure, but. it wasnt Zhutchka; if he could sell had Zhutchka and the forte, too, honestly he would fix been terribly similar.

^ permalink raw reply

* Re: [PATCH 3/4] brcmfmac: Fix likely misuse of | for &
From: Arend van Spriel @ 2012-05-30 20:50 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-kernel, Brett Rudley, Roland Vossen, Franky (Zhenhui) Lin,
	Kan Yan, John W. Linville, linux-wireless, netdev
In-Reply-To: <af79247f427979584f3e07753ec3ad4766844ec9.1338408931.git.joe@perches.com>

On 05/30/2012 10:25 PM, Joe Perches wrote:
> Using | with a constant is always true.
> Likely this should have be &.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

^ permalink raw reply

* Re: [RFC PATCH 2/2] tcp: Early SYN limit and SYN cookie handling to mitigate SYN floods
From: Rick Jones @ 2012-05-30 21:20 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Hans Schillstrom, Andi Kleen, Jesper Dangaard Brouer,
	Jesper Dangaard Brouer, netdev@vger.kernel.org, Christoph Paasch,
	David S. Miller, Martin Topholm, Florian Westphal, Tom Herbert
In-Reply-To: <1338366288.2760.115.camel@edumazet-glaptop>

On 05/30/2012 01:24 AM, Eric Dumazet wrote:
> On Wed, 2012-05-30 at 10:03 +0200, Hans Schillstrom wrote:
>
>> We have this option running right now, and it gave slightly higher values.
>> The upside is only one core is running at 100% load.
>>
>> To be able to process more SYN an attempt was made to spread them with RPS to
>> 2 other cores gave 60% more SYN:s per sec
>> i.e. syn filter in NIC sending all irq:s to one core gave ~ 52k syn. pkts/sec
>> adding RPS and sending syn to two other core:s gave ~80k  syn. pkts/sec
>> Adding more cores than two didn't help that much.
>
> When you say 52.000 pkt/s, is that for fully established sockets, or
> SYNFLOOD ?
>
> 19.23 us to handle _one_ SYN message seems pretty wrong to me, if there
> is no contention on listener socket.

It may still be high, but a very quick netperf TCP_CC test over loopback 
on a W3550 system running a 2.6.38 kernel shows:

raj@tardy:~/netperf2_trunk/src$ ./netperf -t TCP_CC -l 60 -c -C
TCP Connect/Close TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 
localhost.localdomain () port 0 AF_INET
Local /Remote
Socket Size   Request Resp.  Elapsed Trans.   CPU    CPU    S.dem   S.dem
Send   Recv   Size    Size   Time    Rate     local  remote local   remote
bytes  bytes  bytes   bytes  secs.   per sec  %      %      us/Tr   us/Tr

16384  87380  1       1      60.00   21515.29   30.68  30.96  57.042  57.557
16384  87380

57 microseconds per "transaction" which in this case is establishing and 
tearing-down the connection, with nothing else (no data packets) makes 
19 microseconds for a SYN seem perhaps not all that beyond the realm of 
possibility?

rick jones

^ permalink raw reply

* Re: [PATCH] 8021q/vlan: process NETDEV_GOING_DOWN
From: Eldad Zack @ 2012-05-30 21:47 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netdev, linux-kernel
In-Reply-To: <20120530.162751.80640634568619332.davem@davemloft.net>


On Wed, 30 May 2012, David Miller wrote:
> From: Eldad Zack <eldad@fogrefinery.com>
> Date: Wed, 30 May 2012 21:11:02 +0200 (CEST)
> 
> > In case a certain protocol needs to send a "dying gasp" packet, when you 
> > administrativly shutdown the port (which is also what happens when you 
> > restart the machine).
> 
> No in tree users have this requirement, therefore your patch is
> inappropriate.

You are right in that, that no in tree users have this requirement 
(yet), but in the same time it doesn't harm any existing code.

Don't you agree that it's the right order to do the notifications?
And if so, isn't that enough, considering that there are no side 
effects and it's a tiny change?

Eldad

^ permalink raw reply

* Re: [PATCH] 8021q/vlan: process NETDEV_GOING_DOWN
From: David Miller @ 2012-05-30 21:50 UTC (permalink / raw)
  To: eldad; +Cc: kaber, netdev, linux-kernel
In-Reply-To: <alpine.DEB.2.02.1205302344200.8234@debianer>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Wed, 30 May 2012 23:47:32 +0200 (CEST)

> 
> On Wed, 30 May 2012, David Miller wrote:
>> From: Eldad Zack <eldad@fogrefinery.com>
>> Date: Wed, 30 May 2012 21:11:02 +0200 (CEST)
>> 
>> > In case a certain protocol needs to send a "dying gasp" packet, when you 
>> > administrativly shutdown the port (which is also what happens when you 
>> > restart the machine).
>> 
>> No in tree users have this requirement, therefore your patch is
>> inappropriate.
> 
> You are right in that, that no in tree users have this requirement 
> (yet), but in the same time it doesn't harm any existing code.
> 
> Don't you agree that it's the right order to do the notifications?

It's not an issue that matters upstream, so I simply do not care.

When you, or someone else, submits code that needs this facility
then we can talk about it.

Otherwise it's just a waste of our time.

^ permalink raw reply

* Re: [PATCH 19/22] net/smsc911x: Repair broken failure paths
From: David Miller @ 2012-05-30 21:52 UTC (permalink / raw)
  To: linus.walleij
  Cc: lee.jones, linux-arm-kernel, arnd, linus.walleij, grant.likely,
	cjb, broonie, sameo, netdev
In-Reply-To: <CACRpkdY=2j4gRGO4P4RfQDKo+sgV4akAQ6dpP4RbL+XywNCC5A@mail.gmail.com>

From: Linus Walleij <linus.walleij@linaro.org>
Date: Wed, 30 May 2012 15:16:39 +0800

> On Wed, May 30, 2012 at 12:47 PM, Lee Jones <lee.jones@linaro.org> wrote:
> 
>> Current failure paths attempt to free resources which we failed to request
>> and disable resources which we failed to enable ones. This leads to kernel
>> oops/panic. This patch does some simple re-ordering to prevent this from
>> happening.
>>
>> Cc: netdev@vger.kernel.org
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] 8021q/vlan: process NETDEV_GOING_DOWN
From: Eldad Zack @ 2012-05-30 22:02 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netdev, linux-kernel
In-Reply-To: <20120530.175020.1714406888633137662.davem@davemloft.net>


On Wed, 30 May 2012, David Miller wrote:
> From: Eldad Zack <eldad@fogrefinery.com>
> Date: Wed, 30 May 2012 23:47:32 +0200 (CEST)
> It's not an issue that matters upstream, so I simply do not care.
> 
> When you, or someone else, submits code that needs this facility
> then we can talk about it.
> 
> Otherwise it's just a waste of our time.

I understand that. I thought it was better to send unrelated 
patches earlier.
Thanks for the review!

Eldad

^ permalink raw reply

* Re: Strange latency spikes/TX network stalls on Sun Fire X4150(x86) and e1000e
From: Hiroaki SHIMODA @ 2012-05-30 22:19 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Tom Herbert, Denys Fedoryshchenko, netdev, e1000-devel,
	jeffrey.t.kirsher, jesse.brandeburg, davem
In-Reply-To: <1338389342.2760.195.camel@edumazet-glaptop>

On Wed, 30 May 2012 16:49:02 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> On Wed, 2012-05-30 at 20:29 +0900, Hiroaki SHIMODA wrote:
> > On Wed, 30 May 2012 13:08:27 +0200
> > Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > 
> > > On Wed, 2012-05-30 at 19:43 +0900, Hiroaki SHIMODA wrote:
> > > 
> > > > While examining ping problem, below pattern is often observed.
> > > > 
> > > >                                                TIME
> > > >        dql_queued()         dql_completed()     |
> > > >       a) initial state                          |
> > > >                                                 |
> > > >       b) X bytes queued                         V
> > > > 
> > > >       c) Y bytes queued
> > > >                            d) X bytes completed
> > > >       e) Z bytes queued
> > > >                            f) Y bytes completed
> > > > 
> > > > a) dql->limit has already some value and there is no in-flight packet.
> > > > b) X bytes queued.
> > > > c) Y bytes queued and excess limit.
> > > > d) X bytes completed and dql->prev_ovlimit is set and also
> > > >    dql->prev_num_queued is set Y.
> > > > e) Z bytes queued.
> > > > f) Y bytes completed. inprogress and prev_inprogress are true.
> > > > 
> > > > At f), if I read the comment correctly, all_prev_completed becomes
> > > > true and limit should be increased. But POSDIFF() ignores
> > > > (A == B) case, so limit is decreased.
> > > 
> > > Which POSDIFF(), because there are many ;)
> > 
> > I mean,
> > 	all_prev_completed = POSDIFF(completed, dql->prev_num_queued);
> > 
> > > By the way, given complexity of this I suggest you split your ideas in
> > > independent patches.
> > 
> > In this case, here is the patch what I thinking.
> > 
> > diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
> > @@ -11,12 +11,14 @@
> >  #include <linux/dynamic_queue_limits.h>
> >  
> >  #define POSDIFF(A, B) ((A) > (B) ? (A) - (B) : 0)
> > +#define #define AFTER_EQ(A, B) ((int)((A) - (B)) >= 0)
> >  
> >  /* Records completed count and recalculates the queue limit */
> >  void dql_completed(struct dql *dql, unsigned int count)
> >  {
> >  	unsigned int inprogress, prev_inprogress, limit;
> > -	unsigned int ovlimit, all_prev_completed, completed;
> > +	unsigned int ovlimit, completed;
> > +	bool all_prev_completed;
> >  
> >  	/* Can't complete more than what's in queue */
> >  	BUG_ON(count > dql->num_queued - dql->num_completed);
> > @@ -26,7 +28,7 @@ void dql_completed(struct dql *dql, unsigned int count)
> >  	ovlimit = POSDIFF(dql->num_queued - dql->num_completed, limit);
> >  	inprogress = dql->num_queued - completed;
> >  	prev_inprogress = dql->prev_num_queued - dql->num_completed;
> > -	all_prev_completed = POSDIFF(completed, dql->prev_num_queued);
> > +	all_prev_completed = AFTER_EQ(completed, dql->prev_num_queued);
> >  
> >  	if ((ovlimit && !inprogress) ||
> >  	    (dql->prev_ovlimit && all_prev_completed)) {
> 
> I am fine with this one.
> 
> Can you send official patches please ?

Thanks. I'll post.

^ permalink raw reply

* [PATCH net 1/3] bql: Fix POSDIFF() to integer overflow aware.
From: Hiroaki SHIMODA @ 2012-05-30 22:24 UTC (permalink / raw)
  To: davem; +Cc: therbert, eric.dumazet, denys, netdev

POSDIFF() fails to take into account integer overflow case.

Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Denys Fedoryshchenko <denys@visp.net.lb>
---
 lib/dynamic_queue_limits.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
index 6ab4587..c87eb76 100644
--- a/lib/dynamic_queue_limits.c
+++ b/lib/dynamic_queue_limits.c
@@ -10,7 +10,7 @@
 #include <linux/jiffies.h>
 #include <linux/dynamic_queue_limits.h>
 
-#define POSDIFF(A, B) ((A) > (B) ? (A) - (B) : 0)
+#define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0)
 
 /* Records completed count and recalculates the queue limit */
 void dql_completed(struct dql *dql, unsigned int count)
-- 
1.7.3.4

^ permalink raw reply related

* [PATCH net 2/3] bql: Avoid unneeded limit decrement.
From: Hiroaki SHIMODA @ 2012-05-30 22:25 UTC (permalink / raw)
  To: davem; +Cc: therbert, eric.dumazet, denys, netdev

When below pattern is observed,

                                               TIME
       dql_queued()         dql_completed()     |
      a) initial state                          |
                                                |
      b) X bytes queued                         V

      c) Y bytes queued
                           d) X bytes completed
      e) Z bytes queued
                           f) Y bytes completed

a) dql->limit has already some value and there is no in-flight packet.
b) X bytes queued.
c) Y bytes queued and excess limit.
d) X bytes completed and dql->prev_ovlimit is set and also
   dql->prev_num_queued is set Y.
e) Z bytes queued.
f) Y bytes completed. inprogress and prev_inprogress are true.

At f), according to the comment, all_prev_completed becomes
true and limit should be increased. But POSDIFF() ignores
(completed == dql->prev_num_queued) case, so limit is decreased.

Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Denys Fedoryshchenko <denys@visp.net.lb>
---
 lib/dynamic_queue_limits.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
index c87eb76..0fafa77 100644
--- a/lib/dynamic_queue_limits.c
+++ b/lib/dynamic_queue_limits.c
@@ -11,12 +11,14 @@
 #include <linux/dynamic_queue_limits.h>
 
 #define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0)
+#define AFTER_EQ(A, B) ((int)((A) - (B)) >= 0)
 
 /* Records completed count and recalculates the queue limit */
 void dql_completed(struct dql *dql, unsigned int count)
 {
 	unsigned int inprogress, prev_inprogress, limit;
-	unsigned int ovlimit, all_prev_completed, completed;
+	unsigned int ovlimit, completed;
+	bool all_prev_completed;
 
 	/* Can't complete more than what's in queue */
 	BUG_ON(count > dql->num_queued - dql->num_completed);
@@ -26,7 +28,7 @@ void dql_completed(struct dql *dql, unsigned int count)
 	ovlimit = POSDIFF(dql->num_queued - dql->num_completed, limit);
 	inprogress = dql->num_queued - completed;
 	prev_inprogress = dql->prev_num_queued - dql->num_completed;
-	all_prev_completed = POSDIFF(completed, dql->prev_num_queued);
+	all_prev_completed = AFTER_EQ(completed, dql->prev_num_queued);
 
 	if ((ovlimit && !inprogress) ||
 	    (dql->prev_ovlimit && all_prev_completed)) {
-- 
1.7.3.4

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox