History

net: Add netif_get_gro_max_size helper for GRO

Add a small netif_get_gro_max_size() helper which returns the maximum IPv4 or IPv6 GRO size of the netdevice. We later add a netif_get_gso_max_size() equivalent as well for GSO, so that these helpers can be used consistently instead of open-coded checks.

Daniel Borkmann committed 2 years ago

Commit e8d4d341 parent 6c24a032 files · +11 −7Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/netdevice.h+9−0
@@ -5029,6 +5029,15 @@ void netif_set_tso_max_segs(struct net_device *dev, unsigned int segs); · 5028 unmodified lines
5029void netif_inherit_tso_max(struct net_device *to,5029void netif_inherit_tso_max(struct net_device *to,
5030 const struct net_device *from);5030 const struct net_device *from);
5031 5031
5032static inline unsigned int
5033netif_get_gro_max_size(const struct net_device *dev, const struct sk_buff *skb)
5034{
5035 /* pairs with WRITE_ONCE() in netif_set_gro(_ipv4)_max_size() */
5036 return skb->protocol == htons(ETH_P_IPV6) ?
5037 READ_ONCE(dev->gro_max_size) :
5038 READ_ONCE(dev->gro_ipv4_max_size);
5039}
5040
5032static inline bool netif_is_macsec(const struct net_device *dev)5041static inline bool netif_is_macsec(const struct net_device *dev)
5033{5042{
5034 return dev->priv_flags & IFF_MACSEC;5043 return dev->priv_flags & IFF_MACSEC;