Commit 779b7931 authored by Daniel Axtens's avatar Daniel Axtens Committed by David S. Miller

net: rename skb_gso_validate_mtu -> skb_gso_validate_network_len

If you take a GSO skb, and split it into packets, will the network
length (L3 headers + L4 headers + payload) of those packets be small
enough to fit within a given MTU?

skb_gso_validate_mtu gives you the answer to that question. However,
we recently added to add a way to validate the MAC length of a split GSO
skb (L2+L3+L4+payload), and the names get confusing, so rename
skb_gso_validate_mtu to skb_gso_validate_network_len
Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
Reviewed-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4e00f5d5
...@@ -3286,7 +3286,7 @@ void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len); ...@@ -3286,7 +3286,7 @@ void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
void skb_scrub_packet(struct sk_buff *skb, bool xnet); void skb_scrub_packet(struct sk_buff *skb, bool xnet);
unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
bool skb_gso_validate_mtu(const struct sk_buff *skb, unsigned int mtu); bool skb_gso_validate_network_len(const struct sk_buff *skb, unsigned int mtu);
bool skb_gso_validate_mac_len(const struct sk_buff *skb, unsigned int len); bool skb_gso_validate_mac_len(const struct sk_buff *skb, unsigned int len);
struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
struct sk_buff *skb_vlan_untag(struct sk_buff *skb); struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
......
...@@ -4955,19 +4955,20 @@ static inline bool skb_gso_size_check(const struct sk_buff *skb, ...@@ -4955,19 +4955,20 @@ static inline bool skb_gso_size_check(const struct sk_buff *skb,
} }
/** /**
* skb_gso_validate_mtu - Return in case such skb fits a given MTU * skb_gso_validate_network_len - Will a split GSO skb fit into a given MTU?
* *
* @skb: GSO skb * @skb: GSO skb
* @mtu: MTU to validate against * @mtu: MTU to validate against
* *
* skb_gso_validate_mtu validates if a given skb will fit a wanted MTU * skb_gso_validate_network_len validates if a given skb will fit a
* once split. * wanted MTU once split. It considers L3 headers, L4 headers, and the
* payload.
*/ */
bool skb_gso_validate_mtu(const struct sk_buff *skb, unsigned int mtu) bool skb_gso_validate_network_len(const struct sk_buff *skb, unsigned int mtu)
{ {
return skb_gso_size_check(skb, skb_gso_network_seglen(skb), mtu); return skb_gso_size_check(skb, skb_gso_network_seglen(skb), mtu);
} }
EXPORT_SYMBOL_GPL(skb_gso_validate_mtu); EXPORT_SYMBOL_GPL(skb_gso_validate_network_len);
/** /**
* skb_gso_validate_mac_len - Will a split GSO skb fit in a given length? * skb_gso_validate_mac_len - Will a split GSO skb fit in a given length?
......
...@@ -55,7 +55,7 @@ static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu) ...@@ -55,7 +55,7 @@ static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
if (skb->ignore_df) if (skb->ignore_df)
return false; return false;
if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
return false; return false;
return true; return true;
......
...@@ -248,7 +248,7 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk, ...@@ -248,7 +248,7 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk,
/* common case: seglen is <= mtu /* common case: seglen is <= mtu
*/ */
if (skb_gso_validate_mtu(skb, mtu)) if (skb_gso_validate_network_len(skb, mtu))
return ip_finish_output2(net, sk, skb); return ip_finish_output2(net, sk, skb);
/* Slowpath - GSO segment length exceeds the egress MTU. /* Slowpath - GSO segment length exceeds the egress MTU.
......
...@@ -186,7 +186,7 @@ static bool __nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu) ...@@ -186,7 +186,7 @@ static bool __nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
if ((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0) if ((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0)
return false; return false;
if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
return false; return false;
return true; return true;
......
...@@ -412,7 +412,7 @@ static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu) ...@@ -412,7 +412,7 @@ static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
if (skb->ignore_df) if (skb->ignore_df)
return false; return false;
if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
return false; return false;
return true; return true;
......
...@@ -178,7 +178,7 @@ static bool __nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu) ...@@ -178,7 +178,7 @@ static bool __nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
if (skb->len <= mtu) if (skb->len <= mtu)
return false; return false;
if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
return false; return false;
return true; return true;
......
...@@ -122,7 +122,7 @@ bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu) ...@@ -122,7 +122,7 @@ bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
if (skb->len <= mtu) if (skb->len <= mtu)
return false; return false;
if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
return false; return false;
return true; return true;
......
...@@ -217,7 +217,7 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x) ...@@ -217,7 +217,7 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
if (skb->len <= mtu) if (skb->len <= mtu)
goto ok; goto ok;
if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
goto ok; goto ok;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment