[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z5J7kGFU_ZgneFAF@shredder>
Date: Thu, 23 Jan 2025 19:25:36 +0200
From: Ido Schimmel <idosch@...sch.org>
To: Meghana Malladi <m-malladi@...com>
Cc: rogerq@...nel.org, danishanwar@...com, pabeni@...hat.com,
kuba@...nel.org, edumazet@...gle.com, davem@...emloft.net,
andrew+netdev@...n.ch, bpf@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, robh@...nel.org,
matthias.schiffer@...tq-group.com, dan.carpenter@...aro.org,
rdunlap@...radead.org, diogo.ivo@...mens.com,
schnelle@...ux.ibm.com, glaroque@...libre.com,
john.fastabend@...il.com, hawk@...nel.org, daniel@...earbox.net,
ast@...nel.org, srk@...com, Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [PATCH net 3/3] net: ti: icssg-prueth: Add AF_XDP support
s/AF_XDP/XDP/ ?
On Wed, Jan 22, 2025 at 06:19:51PM +0530, Meghana Malladi wrote:
> From: Roger Quadros <rogerq@...nel.org>
>
> Add native XDP support. We do not support zero copy yet.
There are various XDP features (e.g., NETDEV_XDP_ACT_BASIC) to tell the
stack what the driver supports. I don't see any of them being set here.
>
> Signed-off-by: Roger Quadros <rogerq@...nel.org>
> Signed-off-by: MD Danish Anwar <danishanwar@...com>
[...]
> +static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id, int *xdp_state)
> {
> struct prueth_rx_chn *rx_chn = &emac->rx_chns;
> u32 buf_dma_len, pkt_len, port_id = 0;
> @@ -560,10 +732,12 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id)
> struct page *page, *new_page;
> struct page_pool *pool;
> struct sk_buff *skb;
> + struct xdp_buff xdp;
> u32 *psdata;
> void *pa;
> int ret;
>
> + *xdp_state = 0;
> pool = rx_chn->pg_pool;
> ret = k3_udma_glue_pop_rx_chn(rx_chn->rx_chn, flow_id, &desc_dma);
> if (ret) {
> @@ -602,8 +776,17 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id)
> goto requeue;
> }
>
> - /* prepare skb and send to n/w stack */
> pa = page_address(page);
> + if (emac->xdp_prog) {
> + xdp_init_buff(&xdp, PAGE_SIZE, &rx_chn->xdp_rxq);
> + xdp_prepare_buff(&xdp, pa, PRUETH_HEADROOM, pkt_len, false);
> +
> + *xdp_state = emac_run_xdp(emac, &xdp, page);
> + if (*xdp_state != ICSSG_XDP_PASS)
> + goto requeue;
> + }
> +
> + /* prepare skb and send to n/w stack */
> skb = build_skb(pa, prueth_rxbuf_total_len(pkt_len));
> if (!skb) {
> ndev->stats.rx_dropped++;
XDP program could have changed the packet length, but driver seems to be
building the skb using original length read from the descriptor.
Consider using xdp_build_skb_from_buff()
Powered by blists - more mailing lists