From: Jakub Kicinski <kuba@kernel.org>
To: Richard Gobert <richardbgobert@gmail.com>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
brouer@redhat.com, imagedong@tencent.com,
vasily.averin@linux.dev, talalahmad@google.com,
luiz.von.dentz@intel.com, jk@codeconstruct.com.au,
netdev@vger.kernel.org
Subject: Re: [PATCH] net: helper function for skb_shift
Date: Thu, 16 Jun 2022 09:54:55 -0700 [thread overview]
Message-ID: <20220616095455.012db786@kernel.org> (raw)
In-Reply-To: <20220616122617.GA2237@debian>
On Thu, 16 Jun 2022 14:26:29 +0200 Richard Gobert wrote:
> Move the len fields manipulation in the skbs to a helper function.
> There is a comment specifically requesting this. This improves the
> readability of skb_shift.
>
> Signed-off-by: Richard Gobert <richardbgobert@gmail.com>
> ---
> net/core/skbuff.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 30b523fa4ad2..8a0a941915e8 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3508,6 +3508,19 @@ static int skb_prepare_for_shift(struct sk_buff *skb)
> }
>
> /**
> + * skb_shift_len - Update length fields of skbs when shifting.
> + */
1) this is not a valid kdoc
2) I don't see the point unless we have another user of this helper
> +static inline void skb_shift_len(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
> +{
> + skb->len -= shiftlen;
> + skb->data_len -= shiftlen;
> + skb->truesize -= shiftlen;
> + tgt->len += shiftlen;
> + tgt->data_len += shiftlen;
> + tgt->truesize += shiftlen;
> +}
> +
> +/**
> * skb_shift - Shifts paged data partially from skb to another
> * @tgt: buffer into which tail data gets added
> * @skb: buffer from which the paged data comes from
> @@ -3634,14 +3647,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
> tgt->ip_summed = CHECKSUM_PARTIAL;
> skb->ip_summed = CHECKSUM_PARTIAL;
>
> - /* Yak, is it really working this way? Some helper please? */
> - skb->len -= shiftlen;
> - skb->data_len -= shiftlen;
> - skb->truesize -= shiftlen;
> - tgt->len += shiftlen;
> - tgt->data_len += shiftlen;
> - tgt->truesize += shiftlen;
> -
> + skb_shift_len(tgt, skb, shiftlen);
> return shiftlen;
> }
>
prev parent reply other threads:[~2022-06-16 16:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 12:26 [PATCH] net: helper function for skb_shift Richard Gobert
2022-06-16 16:54 ` Jakub Kicinski [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=20220616095455.012db786@kernel.org \
--to=kuba@kernel.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imagedong@tencent.com \
--cc=jk@codeconstruct.com.au \
--cc=luiz.von.dentz@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardbgobert@gmail.com \
--cc=talalahmad@google.com \
--cc=vasily.averin@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).