* [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
@ 2021-11-15 14:48 ` Kumar Thangavel
0 siblings, 0 replies; 7+ messages in thread
From: Kumar Thangavel @ 2021-11-15 14:48 UTC (permalink / raw)
To: Samuel Mendoza-Jonas, David S. Miller, Jakub Kicinski
Cc: openbmc, linux-aspeed, netdev, patrickw3, Amithash Prasad,
sdasari, velumanit
Update NC-SI command handler (both standard and OEM) to take into
account of payload paddings in allocating skb (in case of payload
size is not 32-bit aligned).
The checksum field follows payload field, without taking payload
padding into account can cause checksum being truncated, leading to
dropped packets.
Fixes: fb4ee67529ff ("net/ncsi: Add NCSI OEM command support")
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Acked-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
v5:
- Added Fixes tag
- Added const variable for padding_bytes
v4:
- Used existing macro for max function
v3:
- Added Macro for MAX
- Fixed the missed semicolon
v2:
- Added NC-SI spec version and section
- Removed blank line
- corrected spellings
v1:
- Initial draft
---
---
net/ncsi/ncsi-cmd.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c
index ba9ae482141b..9571bb4dd991 100644
--- a/net/ncsi/ncsi-cmd.c
+++ b/net/ncsi/ncsi-cmd.c
@@ -18,6 +18,8 @@
#include "internal.h"
#include "ncsi-pkt.h"
+const unsigned short padding_bytes = 26;
+
u32 ncsi_calculate_checksum(unsigned char *data, int len)
{
u32 checksum = 0;
@@ -213,12 +215,16 @@ static int ncsi_cmd_handler_oem(struct sk_buff *skb,
{
struct ncsi_cmd_oem_pkt *cmd;
unsigned int len;
+ /* NC-SI spec DSP_0222_1.2.0, section 8.2.2.2
+ * requires payload to be padded with 0 to
+ * 32-bit boundary before the checksum field.
+ * Ensure the padding bytes are accounted for in
+ * skb allocation
+ */
+ unsigned short payload = ALIGN(nca->payload, 4);
len = sizeof(struct ncsi_cmd_pkt_hdr) + 4;
- if (nca->payload < 26)
- len += 26;
- else
- len += nca->payload;
+ len += max(payload, padding_bytes);
cmd = skb_put_zero(skb, len);
memcpy(&cmd->mfr_id, nca->data, nca->payload);
@@ -272,6 +278,7 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
struct net_device *dev = nd->dev;
int hlen = LL_RESERVED_SPACE(dev);
int tlen = dev->needed_tailroom;
+ int payload;
int len = hlen + tlen;
struct sk_buff *skb;
struct ncsi_request *nr;
@@ -281,14 +288,14 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
return NULL;
/* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
+ * Payload needs padding so that the checksum field following payload is
+ * aligned to 32-bit boundary.
* The packet needs padding if its payload is less than 26 bytes to
* meet 64 bytes minimal ethernet frame length.
*/
len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
- if (nca->payload < 26)
- len += 26;
- else
- len += nca->payload;
+ payload = ALIGN(nca->payload, 4);
+ len += max(payload, padding_bytes);
/* Allocate skb */
skb = alloc_skb(len, GFP_ATOMIC);
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
@ 2021-11-15 14:48 ` Kumar Thangavel
0 siblings, 0 replies; 7+ messages in thread
From: Kumar Thangavel @ 2021-11-15 14:48 UTC (permalink / raw)
To: Samuel Mendoza-Jonas, David S. Miller, Jakub Kicinski
Cc: linux-aspeed, netdev, openbmc, Amithash Prasad, velumanit, patrickw3
Update NC-SI command handler (both standard and OEM) to take into
account of payload paddings in allocating skb (in case of payload
size is not 32-bit aligned).
The checksum field follows payload field, without taking payload
padding into account can cause checksum being truncated, leading to
dropped packets.
Fixes: fb4ee67529ff ("net/ncsi: Add NCSI OEM command support")
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Acked-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
v5:
- Added Fixes tag
- Added const variable for padding_bytes
v4:
- Used existing macro for max function
v3:
- Added Macro for MAX
- Fixed the missed semicolon
v2:
- Added NC-SI spec version and section
- Removed blank line
- corrected spellings
v1:
- Initial draft
---
---
net/ncsi/ncsi-cmd.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c
index ba9ae482141b..9571bb4dd991 100644
--- a/net/ncsi/ncsi-cmd.c
+++ b/net/ncsi/ncsi-cmd.c
@@ -18,6 +18,8 @@
#include "internal.h"
#include "ncsi-pkt.h"
+const unsigned short padding_bytes = 26;
+
u32 ncsi_calculate_checksum(unsigned char *data, int len)
{
u32 checksum = 0;
@@ -213,12 +215,16 @@ static int ncsi_cmd_handler_oem(struct sk_buff *skb,
{
struct ncsi_cmd_oem_pkt *cmd;
unsigned int len;
+ /* NC-SI spec DSP_0222_1.2.0, section 8.2.2.2
+ * requires payload to be padded with 0 to
+ * 32-bit boundary before the checksum field.
+ * Ensure the padding bytes are accounted for in
+ * skb allocation
+ */
+ unsigned short payload = ALIGN(nca->payload, 4);
len = sizeof(struct ncsi_cmd_pkt_hdr) + 4;
- if (nca->payload < 26)
- len += 26;
- else
- len += nca->payload;
+ len += max(payload, padding_bytes);
cmd = skb_put_zero(skb, len);
memcpy(&cmd->mfr_id, nca->data, nca->payload);
@@ -272,6 +278,7 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
struct net_device *dev = nd->dev;
int hlen = LL_RESERVED_SPACE(dev);
int tlen = dev->needed_tailroom;
+ int payload;
int len = hlen + tlen;
struct sk_buff *skb;
struct ncsi_request *nr;
@@ -281,14 +288,14 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
return NULL;
/* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
+ * Payload needs padding so that the checksum field following payload is
+ * aligned to 32-bit boundary.
* The packet needs padding if its payload is less than 26 bytes to
* meet 64 bytes minimal ethernet frame length.
*/
len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
- if (nca->payload < 26)
- len += 26;
- else
- len += nca->payload;
+ payload = ALIGN(nca->payload, 4);
+ len += max(payload, padding_bytes);
/* Allocate skb */
skb = alloc_skb(len, GFP_ATOMIC);
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
2021-11-15 14:48 ` Kumar Thangavel
@ 2021-11-15 18:02 ` Jakub Kicinski
-1 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-15 18:02 UTC (permalink / raw)
To: Kumar Thangavel
Cc: linux-aspeed, netdev, openbmc, Amithash Prasad, patrickw3,
Samuel Mendoza-Jonas, velumanit, David S. Miller
On Mon, 15 Nov 2021 20:18:46 +0530 Kumar Thangavel wrote:
> @@ -213,12 +215,16 @@ static int ncsi_cmd_handler_oem(struct sk_buff *skb,
> {
> struct ncsi_cmd_oem_pkt *cmd;
> unsigned int len;
> + /* NC-SI spec DSP_0222_1.2.0, section 8.2.2.2
> + * requires payload to be padded with 0 to
> + * 32-bit boundary before the checksum field.
> + * Ensure the padding bytes are accounted for in
> + * skb allocation
> + */
>
> + unsigned short payload = ALIGN(nca->payload, 4);
> len = sizeof(struct ncsi_cmd_pkt_hdr) + 4;
This looks like mixing code and declarations.
If a piece of code is important enough to warrant a comment it should
not be placed as variable init.
> @@ -272,6 +278,7 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
> struct net_device *dev = nd->dev;
> int hlen = LL_RESERVED_SPACE(dev);
> int tlen = dev->needed_tailroom;
> + int payload;
> int len = hlen + tlen;
> struct sk_buff *skb;
> struct ncsi_request *nr;
> @@ -281,14 +288,14 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
> return NULL;
>
> /* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
> + * Payload needs padding so that the checksum field following payload is
> + * aligned to 32-bit boundary.
> * The packet needs padding if its payload is less than 26 bytes to
> * meet 64 bytes minimal ethernet frame length.
> */
> len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
> - if (nca->payload < 26)
> - len += 26;
> - else
> - len += nca->payload;
> + payload = ALIGN(nca->payload, 4);
> + len += max(payload, padding_bytes);
payload is int here, and padding_bytes is unsigned short, you either
have to use max_t() or change the types to agree.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
@ 2021-11-15 18:02 ` Jakub Kicinski
0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-15 18:02 UTC (permalink / raw)
To: Kumar Thangavel
Cc: Samuel Mendoza-Jonas, David S. Miller, openbmc, linux-aspeed,
netdev, patrickw3, Amithash Prasad, sdasari, velumanit
On Mon, 15 Nov 2021 20:18:46 +0530 Kumar Thangavel wrote:
> @@ -213,12 +215,16 @@ static int ncsi_cmd_handler_oem(struct sk_buff *skb,
> {
> struct ncsi_cmd_oem_pkt *cmd;
> unsigned int len;
> + /* NC-SI spec DSP_0222_1.2.0, section 8.2.2.2
> + * requires payload to be padded with 0 to
> + * 32-bit boundary before the checksum field.
> + * Ensure the padding bytes are accounted for in
> + * skb allocation
> + */
>
> + unsigned short payload = ALIGN(nca->payload, 4);
> len = sizeof(struct ncsi_cmd_pkt_hdr) + 4;
This looks like mixing code and declarations.
If a piece of code is important enough to warrant a comment it should
not be placed as variable init.
> @@ -272,6 +278,7 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
> struct net_device *dev = nd->dev;
> int hlen = LL_RESERVED_SPACE(dev);
> int tlen = dev->needed_tailroom;
> + int payload;
> int len = hlen + tlen;
> struct sk_buff *skb;
> struct ncsi_request *nr;
> @@ -281,14 +288,14 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
> return NULL;
>
> /* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
> + * Payload needs padding so that the checksum field following payload is
> + * aligned to 32-bit boundary.
> * The packet needs padding if its payload is less than 26 bytes to
> * meet 64 bytes minimal ethernet frame length.
> */
> len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
> - if (nca->payload < 26)
> - len += 26;
> - else
> - len += nca->payload;
> + payload = ALIGN(nca->payload, 4);
> + len += max(payload, padding_bytes);
payload is int here, and padding_bytes is unsigned short, you either
have to use max_t() or change the types to agree.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
2021-11-15 14:48 ` Kumar Thangavel
(?)
@ 2021-11-16 1:01 ` kernel test robot
-1 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-11-16 1:01 UTC (permalink / raw)
To: Kumar Thangavel, Samuel Mendoza-Jonas, David S. Miller, Jakub Kicinski
Cc: llvm, kbuild-all, netdev, openbmc, linux-aspeed, patrickw3,
Amithash Prasad, sdasari, velumanit
[-- Attachment #1: Type: text/plain, Size: 4277 bytes --]
Hi Kumar,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc1 next-20211115]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kumar-Thangavel/Add-payload-to-be-32-bit-aligned-to-fix-dropped-packets/20211115-224945
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8ab774587903771821b59471cc723bba6d893942
config: riscv-randconfig-r026-20211115 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/dc2cde90f4de825ff92f0ad81bc70e132c6ad6ec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kumar-Thangavel/Add-payload-to-be-32-bit-aligned-to-fix-dropped-packets/20211115-224945
git checkout dc2cde90f4de825ff92f0ad81bc70e132c6ad6ec
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/ncsi/ncsi-cmd.c:298:9: warning: comparison of distinct pointer types ('typeof (payload) *' (aka 'int *') and 'typeof (padding_bytes) *' (aka 'const unsigned short *')) [-Wcompare-distinct-pointer-types]
len += max(payload, padding_bytes);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:52:19: note: expanded from macro 'max'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
1 warning generated.
vim +298 net/ncsi/ncsi-cmd.c
273
274 static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
275 {
276 struct ncsi_dev_priv *ndp = nca->ndp;
277 struct ncsi_dev *nd = &ndp->ndev;
278 struct net_device *dev = nd->dev;
279 int hlen = LL_RESERVED_SPACE(dev);
280 int tlen = dev->needed_tailroom;
281 int payload;
282 int len = hlen + tlen;
283 struct sk_buff *skb;
284 struct ncsi_request *nr;
285
286 nr = ncsi_alloc_request(ndp, nca->req_flags);
287 if (!nr)
288 return NULL;
289
290 /* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
291 * Payload needs padding so that the checksum field following payload is
292 * aligned to 32-bit boundary.
293 * The packet needs padding if its payload is less than 26 bytes to
294 * meet 64 bytes minimal ethernet frame length.
295 */
296 len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
297 payload = ALIGN(nca->payload, 4);
> 298 len += max(payload, padding_bytes);
299
300 /* Allocate skb */
301 skb = alloc_skb(len, GFP_ATOMIC);
302 if (!skb) {
303 ncsi_free_request(nr);
304 return NULL;
305 }
306
307 nr->cmd = skb;
308 skb_reserve(skb, hlen);
309 skb_reset_network_header(skb);
310
311 skb->dev = dev;
312 skb->protocol = htons(ETH_P_NCSI);
313
314 return nr;
315 }
316
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43898 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
@ 2021-11-16 1:01 ` kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-11-16 1:01 UTC (permalink / raw)
To: Kumar Thangavel, Samuel Mendoza-Jonas, David S. Miller, Jakub Kicinski
Cc: kbuild-all, linux-aspeed, netdev, openbmc, llvm, Amithash Prasad,
velumanit, patrickw3
[-- Attachment #1: Type: text/plain, Size: 4277 bytes --]
Hi Kumar,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc1 next-20211115]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kumar-Thangavel/Add-payload-to-be-32-bit-aligned-to-fix-dropped-packets/20211115-224945
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8ab774587903771821b59471cc723bba6d893942
config: riscv-randconfig-r026-20211115 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/dc2cde90f4de825ff92f0ad81bc70e132c6ad6ec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kumar-Thangavel/Add-payload-to-be-32-bit-aligned-to-fix-dropped-packets/20211115-224945
git checkout dc2cde90f4de825ff92f0ad81bc70e132c6ad6ec
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/ncsi/ncsi-cmd.c:298:9: warning: comparison of distinct pointer types ('typeof (payload) *' (aka 'int *') and 'typeof (padding_bytes) *' (aka 'const unsigned short *')) [-Wcompare-distinct-pointer-types]
len += max(payload, padding_bytes);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:52:19: note: expanded from macro 'max'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
1 warning generated.
vim +298 net/ncsi/ncsi-cmd.c
273
274 static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
275 {
276 struct ncsi_dev_priv *ndp = nca->ndp;
277 struct ncsi_dev *nd = &ndp->ndev;
278 struct net_device *dev = nd->dev;
279 int hlen = LL_RESERVED_SPACE(dev);
280 int tlen = dev->needed_tailroom;
281 int payload;
282 int len = hlen + tlen;
283 struct sk_buff *skb;
284 struct ncsi_request *nr;
285
286 nr = ncsi_alloc_request(ndp, nca->req_flags);
287 if (!nr)
288 return NULL;
289
290 /* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
291 * Payload needs padding so that the checksum field following payload is
292 * aligned to 32-bit boundary.
293 * The packet needs padding if its payload is less than 26 bytes to
294 * meet 64 bytes minimal ethernet frame length.
295 */
296 len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
297 payload = ALIGN(nca->payload, 4);
> 298 len += max(payload, padding_bytes);
299
300 /* Allocate skb */
301 skb = alloc_skb(len, GFP_ATOMIC);
302 if (!skb) {
303 ncsi_free_request(nr);
304 return NULL;
305 }
306
307 nr->cmd = skb;
308 skb_reserve(skb, hlen);
309 skb_reset_network_header(skb);
310
311 skb->dev = dev;
312 skb->protocol = htons(ETH_P_NCSI);
313
314 return nr;
315 }
316
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43898 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets
@ 2021-11-16 1:01 ` kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-11-16 1:01 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4378 bytes --]
Hi Kumar,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc1 next-20211115]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kumar-Thangavel/Add-payload-to-be-32-bit-aligned-to-fix-dropped-packets/20211115-224945
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8ab774587903771821b59471cc723bba6d893942
config: riscv-randconfig-r026-20211115 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/dc2cde90f4de825ff92f0ad81bc70e132c6ad6ec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kumar-Thangavel/Add-payload-to-be-32-bit-aligned-to-fix-dropped-packets/20211115-224945
git checkout dc2cde90f4de825ff92f0ad81bc70e132c6ad6ec
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/ncsi/ncsi-cmd.c:298:9: warning: comparison of distinct pointer types ('typeof (payload) *' (aka 'int *') and 'typeof (padding_bytes) *' (aka 'const unsigned short *')) [-Wcompare-distinct-pointer-types]
len += max(payload, padding_bytes);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:52:19: note: expanded from macro 'max'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
1 warning generated.
vim +298 net/ncsi/ncsi-cmd.c
273
274 static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
275 {
276 struct ncsi_dev_priv *ndp = nca->ndp;
277 struct ncsi_dev *nd = &ndp->ndev;
278 struct net_device *dev = nd->dev;
279 int hlen = LL_RESERVED_SPACE(dev);
280 int tlen = dev->needed_tailroom;
281 int payload;
282 int len = hlen + tlen;
283 struct sk_buff *skb;
284 struct ncsi_request *nr;
285
286 nr = ncsi_alloc_request(ndp, nca->req_flags);
287 if (!nr)
288 return NULL;
289
290 /* NCSI command packet has 16-bytes header, payload, 4 bytes checksum.
291 * Payload needs padding so that the checksum field following payload is
292 * aligned to 32-bit boundary.
293 * The packet needs padding if its payload is less than 26 bytes to
294 * meet 64 bytes minimal ethernet frame length.
295 */
296 len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
297 payload = ALIGN(nca->payload, 4);
> 298 len += max(payload, padding_bytes);
299
300 /* Allocate skb */
301 skb = alloc_skb(len, GFP_ATOMIC);
302 if (!skb) {
303 ncsi_free_request(nr);
304 return NULL;
305 }
306
307 nr->cmd = skb;
308 skb_reserve(skb, hlen);
309 skb_reset_network_header(skb);
310
311 skb->dev = dev;
312 skb->protocol = htons(ETH_P_NCSI);
313
314 return nr;
315 }
316
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 43898 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-16 1:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 14:48 [PATCH v5] Add payload to be 32-bit aligned to fix dropped packets Kumar Thangavel
2021-11-15 14:48 ` Kumar Thangavel
2021-11-15 18:02 ` Jakub Kicinski
2021-11-15 18:02 ` Jakub Kicinski
2021-11-16 1:01 ` kernel test robot
2021-11-16 1:01 ` kernel test robot
2021-11-16 1:01 ` kernel test robot
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.