From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Kalle Valo <kvalo@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev,
brcm80211-dev-list.pdl@broadcom.com
Subject: Re: [PATCH] brcmfmac: fwsignal: Use struct_size() to simplify brcmf_fws_rxreorder()
Date: Sun, 14 Jul 2024 20:54:05 +0200 [thread overview]
Message-ID: <0360afd2-8749-4be6-a451-78345dc44b12@broadcom.com> (raw)
In-Reply-To: <bd3ad239c4d1c49b94c1ba93e48c09df98ef86cb.1720951805.git.christophe.jaillet@wanadoo.fr>
[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]
On 7/14/2024 12:10 PM, Christophe JAILLET wrote:
> In the "struct brcmf_ampdu_rx_reorder", change the 'pktslots' field into
> flexible array.
>
> It saves the size of a pointer when the memory is allocated and avoids
> an indirection when the array is used.
> It also removes the usage of a pointer arithmetic and saves a few lines of
> code.
>
> Finally, struct_size() can be used. It is not a must have here, because
> it is easy to see that buf_size can not overflow, but still, it is a good
> practice.
Looks good to me with a minor nit (see below)...
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 4 ++--
> .../net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 8 ++------
> 2 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
> index ea76b8d33401..6ea2b677f047 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
> @@ -48,20 +48,20 @@
> /**
> * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info
> *
> - * @pktslots: dynamic allocated array for ordering AMPDU packets.
> * @flow_id: AMPDU flow identifier.
> * @cur_idx: last AMPDU index from firmware.
> * @exp_idx: expected next AMPDU index.
> * @max_idx: maximum amount of packets per AMPDU.
> * @pend_pkts: number of packets currently in @pktslots.
> + * @pktslots: dynamic allocated array for ordering AMPDU packets.
pktslots is not dynamic allocated, but just part of the structure. That
was already so before this patch through. Just drop the "dynamic
allocated" part.
> */
> struct brcmf_ampdu_rx_reorder {
> - struct sk_buff **pktslots;
> u8 flow_id;
> u8 cur_idx;
> u8 exp_idx;
> u8 max_idx;
> u8 pend_pkts;
> + struct sk_buff *pktslots[];
> };
>
> /* Forward decls for struct brcmf_pub (see below) */
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]
prev parent reply other threads:[~2024-07-14 18:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-14 10:10 Christophe JAILLET
2024-07-14 18:54 ` Arend van Spriel [this message]
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=0360afd2-8749-4be6-a451-78345dc44b12@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®