[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231221171648.GC1056991@kernel.org>
Date: Thu, 21 Dec 2023 18:16:48 +0100
From: Simon Horman <horms@...nel.org>
To: Mina Almasry <almasrymina@...gle.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
kvm@...r.kernel.org, virtualization@...ts.linux.dev,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
Stefano Garzarella <sgarzare@...hat.com>,
David Howells <dhowells@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Christian König <christian.koenig@....com>,
Shakeel Butt <shakeelb@...gle.com>,
Yunsheng Lin <linyunsheng@...wei.com>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>
Subject: Re: [PATCH net-next v3 3/3] net: add netmem_ref to skb_frag_t
On Wed, Dec 20, 2023 at 01:45:02PM -0800, Mina Almasry wrote:
> Use netmem_ref instead of page in skb_frag_t. Currently netmem_ref
> is always a struct page underneath, but the abstraction allows efforts
> to add support for skb frags not backed by pages.
>
> There is unfortunately 1 instance where the skb_frag_t is assumed to be
> a bio_vec in kcm. For this case, add a debug assert that the skb frag is
> indeed backed by a page, and do a cast.
>
> Add skb[_frag]_fill_netmem_*() and skb_add_rx_frag_netmem() helpers so
> that the API can be used to create netmem skbs.
>
> Signed-off-by: Mina Almasry <almasrymina@...gle.com>
...
> diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
> index 65d1f6755f98..3180a54b2c68 100644
> --- a/net/kcm/kcmsock.c
> +++ b/net/kcm/kcmsock.c
> @@ -636,9 +636,15 @@ static int kcm_write_msgs(struct kcm_sock *kcm)
> for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
> msize += skb_shinfo(skb)->frags[i].bv_len;
>
> + /* The cast to struct bio_vec* here assumes the frags are
> + * struct page based. WARN if there is no page in this skb.
> + */
> + DEBUG_NET_WARN_ON_ONCE(
> + !skb_frag_page(&skb_shinfo(skb)->frags[0]));
> +
> iov_iter_bvec(&msg.msg_iter, ITER_SOURCE,
> - skb_shinfo(skb)->frags, skb_shinfo(skb)->nr_frags,
> - msize);
> + (const struct bio_vec *)skb_shinfo(skb)->frags,
> + skb_shinfo(skb)->nr_frags, msize);
> iov_iter_advance(&msg.msg_iter, txm->frag_offset);
>
> do {
Hi Mina,
something isn't quite right here.
...//kcmsock.c:637:39: error: no member named 'bv_len' in 'struct skb_frag'
637 | msize += skb_shinfo(skb)->frags[i].bv_len;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
--
pw-bot: changes-requested
Powered by blists - more mailing lists