All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Kumar Thangavel <kumarthangavel.hcl@gmail.com>
Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, openbmc@lists.ozlabs.org,
	linux-aspeed@lists.ozlabs.org, patrickw3@fb.com,
	Amithash Prasad <amithash@fb.com>,
	velumanit@hcl.com, sdasari@fb.com
Subject: Re: [PATCH v2] Add payload to be 32-bit aligned to fix dropped packets
Date: Tue, 19 Oct 2021 07:52:41 -0700	[thread overview]
Message-ID: <20211019075241.7ba9fd0a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20211019144127.GA12978@gmail.com>

On Tue, 19 Oct 2021 20:11:27 +0530 Kumar Thangavel wrote:
>  	len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
> -	if (nca->payload < 26)
> +	payload = ALIGN(nca->payload, 4)
> +	if (payload < 26)
>  		len += 26;
>  	else
> -		len += nca->payload;
> +		len += payload;

You round up to 4 and then add 26 if the result is smaller.  26 is not
a multiple of 4. Is this intentional?

Also you can write this on one line:

	len += max(payload, 26);

WARNING: multiple messages have this Message-ID (diff)
From: Jakub Kicinski <kuba@kernel.org>
To: Kumar Thangavel <kumarthangavel.hcl@gmail.com>
Cc: linux-aspeed@lists.ozlabs.org, netdev@vger.kernel.org,
	openbmc@lists.ozlabs.org, Amithash Prasad <amithash@fb.com>,
	patrickw3@fb.com, Samuel Mendoza-Jonas <sam@mendozajonas.com>,
	velumanit@hcl.com, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2] Add payload to be 32-bit aligned to fix dropped packets
Date: Tue, 19 Oct 2021 07:52:41 -0700	[thread overview]
Message-ID: <20211019075241.7ba9fd0a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20211019144127.GA12978@gmail.com>

On Tue, 19 Oct 2021 20:11:27 +0530 Kumar Thangavel wrote:
>  	len += sizeof(struct ncsi_cmd_pkt_hdr) + 4;
> -	if (nca->payload < 26)
> +	payload = ALIGN(nca->payload, 4)
> +	if (payload < 26)
>  		len += 26;
>  	else
> -		len += nca->payload;
> +		len += payload;

You round up to 4 and then add 26 if the result is smaller.  26 is not
a multiple of 4. Is this intentional?

Also you can write this on one line:

	len += max(payload, 26);

  reply	other threads:[~2021-10-19 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 14:41 [PATCH v2] Add payload to be 32-bit aligned to fix dropped packets Kumar Thangavel
2021-10-19 14:41 ` Kumar Thangavel
2021-10-19 14:52 ` Jakub Kicinski [this message]
2021-10-19 14:52   ` Jakub Kicinski
2021-10-20  7:48   ` Kumar Thangavel
2021-10-19 19:07 ` Jakub Kicinski
2021-10-19 19:07   ` Jakub Kicinski
2021-10-20  7:49   ` Kumar Thangavel
2021-10-20  0:27 ` kernel test robot
2021-10-20  0:27   ` kernel test robot
2021-10-20  0:27   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019075241.7ba9fd0a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=amithash@fb.com \
    --cc=davem@davemloft.net \
    --cc=kumarthangavel.hcl@gmail.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=patrickw3@fb.com \
    --cc=sam@mendozajonas.com \
    --cc=sdasari@fb.com \
    --cc=velumanit@hcl.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.