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.
Showing the changes to include (1 of 2 files). Show all
Unified · Split
| @@ -5029,6 +5029,15 @@ void netif_set_tso_max_segs(struct net_device *dev, unsigned int segs); · 5028 unmodified lines | ||
| 5029 | 5029 | void netif_inherit_tso_max(struct net_device *to, |
| 5030 | 5030 | const struct net_device *from); |
| 5031 | 5031 | |
| 5032 | +static inline unsigned int | |
| 5033 | +netif_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 | + | |
| 5032 | 5041 | static inline bool netif_is_macsec(const struct net_device *dev) |
| 5033 | 5042 | { |
| 5034 | 5043 | return dev->priv_flags & IFF_MACSEC; |