Re: [PATCH net-next V2 1/3] net: Add GRO support for UDP encapsulating protocols
From: Or Gerlitz <hidden>
Date: 2014-01-07 20:37:55
On Tue, Jan 7, 2014 at 10:32 PM, Eric Dumazet [off-list ref] wrote:
On Tue, 2014-01-07 at 22:19 +0200, Or Gerlitz wrote:quoted
On Tue, Jan 7, 2014 at 6:33 PM, Eric Dumazet [off-list ref] wrote:quoted
On Tue, 2014-01-07 at 17:29 +0200, Or Gerlitz wrote:quoted
+ +#define MAX_UDP_PORT (1 << 16) +extern const struct net_offload __rcu *udp_offloads[MAX_UDP_PORT];Thats 512 KB of memory. This will greatly impact forwarding performance of UDP packets with random ports, and will increase kernel memory size for embedded devices.Re forwarding, are you referring to the case where the forwarded packets are encapsulated? packets which are not encapusalted will be flushed in the gro receive handler (this went out by mistake in V2 but exists in V1) if skb->encapsulation isn't set.How do you know encapsulation must be tried for a given incoming packet ? NIC do not magically sets skb->encapsulation I think...
So here's the thing, per my understanding we want to GRO only received **encapsulated** packets whose checksum status is != CHECKSUM_NONE which means the NIC has some support for doing RX checksum of encapsulated packets. Per the current convension, in that case the NIC RX code has to set skb->encapsulation see 6a674e9c75b17 "net: Add support for hardware-offloaded encapsulation" this convension is implemented in the current drivers that have HW offloads for encapsulated packets (bnx2x, i40e and mlx4)
You access udp_offloads[XXX], with XXX being in 0..65535 range, right ?quoted
As for encapsulated packets, when you say random ports, are you referring to a router which has multiple udp encapsulating protocols where each uses different udp port? for this case and also to reduce the memory footprint, we can use lookup in a list as done for the L2 protocols gro handlers in the list_for_each loop of dev_gro_receive(), makes sense?I am speaking of a normal router, running linux kernel, and having GRO/TSO enabled. If each incoming UDP packet has to access one extra cache line in a 512KB array, its likely to be an extra cache line miss, if UDP dest port is mostly random (compared to ports used by very recent UDP packets)