netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] Fix mlx4 static checker warnings
@ 2017-10-09 13:59 Tariq Toukan
  2017-10-09 13:59 ` [PATCH net-next 1/3] net/mlx4: Fix endianness issue in qp context params Tariq Toukan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tariq Toukan @ 2017-10-09 13:59 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan

Hi Dave,

This patchset contains fixes for static checker warnings
in the mlx4 Core and Eth drivers.

Patch 1 fixes an actual bug discovered by the checker.
Patches 2 and 3 fix the warnings without functional changes.

Series generated against net-next commit:
c49c777f9c87 qed: Delete redundant check on dcb_app priority

Thanks,
Tariq.


Tariq Toukan (3):
  net/mlx4: Fix endianness issue in qp context params
  net/mlx4_core: Fix cast warning in fw.c
  net/mlx4_en: Use __force to fix a sparse warning in TX datapath

 drivers/net/ethernet/mellanox/mlx4/en_resources.c     | 2 +-
 drivers/net/ethernet/mellanox/mlx4/en_tx.c            | 2 +-
 drivers/net/ethernet/mellanox/mlx4/fw.c               | 6 +++---
 drivers/net/ethernet/mellanox/mlx4/qp.c               | 2 +-
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

-- 
1.8.3.1

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

* [PATCH net-next 1/3] net/mlx4: Fix endianness issue in qp context params
  2017-10-09 13:59 [PATCH net-next 0/3] Fix mlx4 static checker warnings Tariq Toukan
@ 2017-10-09 13:59 ` Tariq Toukan
  2017-10-09 13:59 ` [PATCH net-next 2/3] net/mlx4_core: Fix cast warning in fw.c Tariq Toukan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2017-10-09 13:59 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan

Should take care of the endianness before assigning to params2 field.

Fixes: 53f33ae295a5 ("net/mlx4_core: Port aggregation upper layer interface")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_resources.c     | 2 +-
 drivers/net/ethernet/mellanox/mlx4/qp.c               | 2 +-
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
index 5a47f9669621..6883ac75d37f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
@@ -53,7 +53,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
 	if (is_tx) {
 		context->sq_size_stride = ilog2(size) << 3 | (ilog2(stride) - 4);
 		if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP)
-			context->params2 |= MLX4_QP_BIT_FPP;
+			context->params2 |= cpu_to_be32(MLX4_QP_BIT_FPP);
 
 	} else {
 		context->sq_size_stride = ilog2(TXBB_SIZE) - 4;
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 728a2fb1f5c0..203320923340 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -925,7 +925,7 @@ int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
 		context->flags &= cpu_to_be32(~(0xf << 28));
 		context->flags |= cpu_to_be32(states[i + 1] << 28);
 		if (states[i + 1] != MLX4_QP_STATE_RTR)
-			context->params2 &= ~MLX4_QP_BIT_FPP;
+			context->params2 &= ~cpu_to_be32(MLX4_QP_BIT_FPP);
 		err = mlx4_qp_modify(dev, mtt, states[i], states[i + 1],
 				     context, 0, 0, qp);
 		if (err) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index fabb53379727..04304dd894c6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -3185,7 +3185,7 @@ static int verify_qp_parameters(struct mlx4_dev *dev,
 	optpar	= be32_to_cpu(*(__be32 *) inbox->buf);
 
 	if (slave != mlx4_master_func_num(dev)) {
-		qp_ctx->params2 &= ~MLX4_QP_BIT_FPP;
+		qp_ctx->params2 &= ~cpu_to_be32(MLX4_QP_BIT_FPP);
 		/* setting QP rate-limit is disallowed for VFs */
 		if (qp_ctx->rate_limit_params)
 			return -EPERM;
-- 
1.8.3.1

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

* [PATCH net-next 2/3] net/mlx4_core: Fix cast warning in fw.c
  2017-10-09 13:59 [PATCH net-next 0/3] Fix mlx4 static checker warnings Tariq Toukan
  2017-10-09 13:59 ` [PATCH net-next 1/3] net/mlx4: Fix endianness issue in qp context params Tariq Toukan
@ 2017-10-09 13:59 ` Tariq Toukan
  2017-10-09 13:59 ` [PATCH net-next 3/3] net/mlx4_en: Use __force to fix a sparse warning in TX datapath Tariq Toukan
  2017-10-09 17:33 ` [PATCH net-next 0/3] Fix mlx4 static checker warnings David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2017-10-09 13:59 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan

Fix the following SPARSE warning, in MLX4_GET() macro:
drivers/net/ethernet/mellanox/mlx4/fw.c:233:9: warning: cast to restricted __be64

Fixes: 17d5ceb6e43e ("net/mlx4_core: Fix unaligned accesses")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/fw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 16c09949afd5..634f603f941c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -57,12 +57,12 @@ enum {
 #define MLX4_GET(dest, source, offset)				      \
 	do {							      \
 		void *__p = (char *) (source) + (offset);	      \
-		u64 val;                                              \
-		switch (sizeof(dest)) {			      \
+		__be64 val;                                           \
+		switch (sizeof(dest)) {				      \
 		case 1: (dest) = *(u8 *) __p;	    break;	      \
 		case 2: (dest) = be16_to_cpup(__p); break;	      \
 		case 4: (dest) = be32_to_cpup(__p); break;	      \
-		case 8: val = get_unaligned((u64 *)__p);              \
+		case 8: val = get_unaligned((__be64 *)__p);           \
 			(dest) = be64_to_cpu(val);  break;            \
 		default: __buggy_use_of_MLX4_GET();		      \
 		}						      \
-- 
1.8.3.1

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

* [PATCH net-next 3/3] net/mlx4_en: Use __force to fix a sparse warning in TX datapath
  2017-10-09 13:59 [PATCH net-next 0/3] Fix mlx4 static checker warnings Tariq Toukan
  2017-10-09 13:59 ` [PATCH net-next 1/3] net/mlx4: Fix endianness issue in qp context params Tariq Toukan
  2017-10-09 13:59 ` [PATCH net-next 2/3] net/mlx4_core: Fix cast warning in fw.c Tariq Toukan
@ 2017-10-09 13:59 ` Tariq Toukan
  2017-10-09 17:33 ` [PATCH net-next 0/3] Fix mlx4 static checker warnings David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2017-10-09 13:59 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan

In TX data-path, we intentionally do not byte-swap, as documented
in code and in the cited commit log.
This fixes sparse warning:
en_tx.c:720:23: warning: incorrect type in argument 1 (different base types)
en_tx.c:720:23:    expected unsigned int [unsigned] [usertype] <noident>
en_tx.c:720:23:    got restricted __be32 [usertype] doorbell_qpn

Fixes: 492f5add4be8 ("net/mlx4_en: Doorbell is byteswapped in Little Endian archs")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 8a32a8f7f9c0..2cc82dc07397 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -718,7 +718,7 @@ void mlx4_en_xmit_doorbell(struct mlx4_en_tx_ring *ring)
 #else
 	iowrite32be(
 #endif
-		  ring->doorbell_qpn,
+		  (__force u32)ring->doorbell_qpn,
 		  ring->bf.uar->map + MLX4_SEND_DOORBELL);
 }
 
-- 
1.8.3.1

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

* Re: [PATCH net-next 0/3] Fix mlx4 static checker warnings
  2017-10-09 13:59 [PATCH net-next 0/3] Fix mlx4 static checker warnings Tariq Toukan
                   ` (2 preceding siblings ...)
  2017-10-09 13:59 ` [PATCH net-next 3/3] net/mlx4_en: Use __force to fix a sparse warning in TX datapath Tariq Toukan
@ 2017-10-09 17:33 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-10-09 17:33 UTC (permalink / raw)
  To: tariqt; +Cc: netdev, eranbe

From: Tariq Toukan <tariqt@mellanox.com>
Date: Mon,  9 Oct 2017 16:59:47 +0300

> This patchset contains fixes for static checker warnings
> in the mlx4 Core and Eth drivers.
> 
> Patch 1 fixes an actual bug discovered by the checker.
> Patches 2 and 3 fix the warnings without functional changes.
> 
> Series generated against net-next commit:
> c49c777f9c87 qed: Delete redundant check on dcb_app priority

Series applied, thanks.

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

end of thread, other threads:[~2017-10-09 17:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09 13:59 [PATCH net-next 0/3] Fix mlx4 static checker warnings Tariq Toukan
2017-10-09 13:59 ` [PATCH net-next 1/3] net/mlx4: Fix endianness issue in qp context params Tariq Toukan
2017-10-09 13:59 ` [PATCH net-next 2/3] net/mlx4_core: Fix cast warning in fw.c Tariq Toukan
2017-10-09 13:59 ` [PATCH net-next 3/3] net/mlx4_en: Use __force to fix a sparse warning in TX datapath Tariq Toukan
2017-10-09 17:33 ` [PATCH net-next 0/3] Fix mlx4 static checker warnings David Miller

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