[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58760713-438f-a332-77ab-e5c34f0f61b6@gmail.com>
Date: Mon, 27 Apr 2020 08:45:28 -0600
From: David Ahern <dsahern@...il.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>, netdev@...r.kernel.org
Cc: 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 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;
Powered by blists - more mailing lists