All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] sfc: couple of fixes
@ 2017-03-03 15:20 Edward Cree
  2017-03-03 15:22 ` [PATCH net 1/2] sfc: avoid max() in array size Edward Cree
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Edward Cree @ 2017-03-03 15:20 UTC (permalink / raw)
  To: linux-net-drivers, davem; +Cc: netdev

First patch addresses a construct that causes sparse to error out.
With that fixed, sparse makes some warnings on ef10.c, second patch
 fixes one of them.

Edward Cree (2):
  sfc: avoid max() in array size
  sfc: fix IPID endianness in TSOv2

 drivers/net/ethernet/sfc/ef10.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

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

* [PATCH net 1/2] sfc: avoid max() in array size
  2017-03-03 15:20 [PATCH net 0/2] sfc: couple of fixes Edward Cree
@ 2017-03-03 15:22 ` Edward Cree
  2017-03-03 15:22 ` [PATCH net 2/2] sfc: fix IPID endianness in TSOv2 Edward Cree
  2017-03-03 18:06 ` [PATCH net 0/2] sfc: couple of fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Edward Cree @ 2017-03-03 15:22 UTC (permalink / raw)
  To: linux-net-drivers, davem; +Cc: netdev

It confuses sparse, which thinks the size isn't constant.  Let's achieve
 the same thing with a BUILD_BUG_ON, since we know which one should be
 bigger and don't expect them ever to change.

Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 92e1c6d..4d88e85 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -828,9 +828,7 @@ static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n)
 static int efx_ef10_link_piobufs(struct efx_nic *efx)
 {
 	struct efx_ef10_nic_data *nic_data = efx->nic_data;
-	_MCDI_DECLARE_BUF(inbuf,
-			  max(MC_CMD_LINK_PIOBUF_IN_LEN,
-			      MC_CMD_UNLINK_PIOBUF_IN_LEN));
+	MCDI_DECLARE_BUF(inbuf, MC_CMD_LINK_PIOBUF_IN_LEN);
 	struct efx_channel *channel;
 	struct efx_tx_queue *tx_queue;
 	unsigned int offset, index;
@@ -839,8 +837,6 @@ static int efx_ef10_link_piobufs(struct efx_nic *efx)
 	BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_OUT_LEN != 0);
 	BUILD_BUG_ON(MC_CMD_UNLINK_PIOBUF_OUT_LEN != 0);
 
-	memset(inbuf, 0, sizeof(inbuf));
-
 	/* Link a buffer to each VI in the write-combining mapping */
 	for (index = 0; index < nic_data->n_piobufs; ++index) {
 		MCDI_SET_DWORD(inbuf, LINK_PIOBUF_IN_PIOBUF_HANDLE,
@@ -920,6 +916,10 @@ static int efx_ef10_link_piobufs(struct efx_nic *efx)
 	return 0;
 
 fail:
+	/* inbuf was defined for MC_CMD_LINK_PIOBUF.  We can use the same
+	 * buffer for MC_CMD_UNLINK_PIOBUF because it's shorter.
+	 */
+	BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_IN_LEN < MC_CMD_UNLINK_PIOBUF_IN_LEN);
 	while (index--) {
 		MCDI_SET_DWORD(inbuf, UNLINK_PIOBUF_IN_TXQ_INSTANCE,
 			       nic_data->pio_write_vi_base + index);

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

* [PATCH net 2/2] sfc: fix IPID endianness in TSOv2
  2017-03-03 15:20 [PATCH net 0/2] sfc: couple of fixes Edward Cree
  2017-03-03 15:22 ` [PATCH net 1/2] sfc: avoid max() in array size Edward Cree
@ 2017-03-03 15:22 ` Edward Cree
  2017-03-03 18:06 ` [PATCH net 0/2] sfc: couple of fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Edward Cree @ 2017-03-03 15:22 UTC (permalink / raw)
  To: linux-net-drivers, davem; +Cc: netdev

The value we read from the header is in network byte order, whereas
 EFX_POPULATE_QWORD_* takes values in host byte order (which it then
 converts to little-endian, as MCDI is little-endian).

Fixes: e9117e5099ea ("sfc: Firmware-Assisted TSO version 2")
Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 4d88e85..c60c2d4 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -2183,7 +2183,7 @@ static int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue,
 		/* Modify IPv4 header if needed. */
 		ip->tot_len = 0;
 		ip->check = 0;
-		ipv4_id = ip->id;
+		ipv4_id = ntohs(ip->id);
 	} else {
 		/* Modify IPv6 header if needed. */
 		struct ipv6hdr *ipv6 = ipv6_hdr(skb);

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

* Re: [PATCH net 0/2] sfc: couple of fixes
  2017-03-03 15:20 [PATCH net 0/2] sfc: couple of fixes Edward Cree
  2017-03-03 15:22 ` [PATCH net 1/2] sfc: avoid max() in array size Edward Cree
  2017-03-03 15:22 ` [PATCH net 2/2] sfc: fix IPID endianness in TSOv2 Edward Cree
@ 2017-03-03 18:06 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-03-03 18:06 UTC (permalink / raw)
  To: ecree; +Cc: linux-net-drivers, netdev

From: Edward Cree <ecree@solarflare.com>
Date: Fri, 3 Mar 2017 15:20:44 +0000

> First patch addresses a construct that causes sparse to error out.
> With that fixed, sparse makes some warnings on ef10.c, second patch
>  fixes one of them.

Series applied, thanks.

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

end of thread, other threads:[~2017-03-03 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 15:20 [PATCH net 0/2] sfc: couple of fixes Edward Cree
2017-03-03 15:22 ` [PATCH net 1/2] sfc: avoid max() in array size Edward Cree
2017-03-03 15:22 ` [PATCH net 2/2] sfc: fix IPID endianness in TSOv2 Edward Cree
2017-03-03 18:06 ` [PATCH net 0/2] sfc: couple of fixes David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.