[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9oygxd=Sa5PvXWYm7Mth4tc_LfqnZXM+XrHuouKP1AQxg@mail.gmail.com>
Date: Mon, 27 Apr 2020 13:58:45 -0600
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: David Ahern <dsahern@...il.com>
Cc: Netdev <netdev@...r.kernel.org>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH RFC v2] net: xdp: allow for layer 3 packets in generic skb handler
On Mon, Apr 27, 2020 at 8:45 AM David Ahern <dsahern@...il.com> wrote:
>
> On 4/27/20 4:22 AM, Jason A. Donenfeld wrote:
> > @@ -4544,6 +4544,13 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
> > * header.
> > */
> > mac_len = skb->data - skb_mac_header(skb);
> > + if (!mac_len) {
> > + add_eth_hdr = true;
> > + mac_len = sizeof(struct ethhdr);
> > + *((struct ethhdr *)skb_push(skb, mac_len)) = (struct ethhdr) {
> > + .h_proto = skb->protocol
> > + };
>
> please use a temp variable and explicit setting of the fields; that is
> not pleasant to read and can not be more performant than a more direct
>
> eth_zero_addr(eth->h_source);
> eth_zero_addr(eth->h_dest);
> eth->h_proto = skb->protocol;
Ack, will change for the non-RFC v3 patch. I need to actually figure
out how to test this thing first though...
Jason
Powered by blists - more mailing lists