Skip to content

Commit 35f66ce

Browse files
gentoo-rootkuba-moo
authored andcommitted
net/ipv6: Remove HBH helpers
Now that the HBH jumbo helpers are not used by any driver or GSO, remove them altogether. Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260205133925.526371-13-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 28df1c6 commit 35f66ce

1 file changed

Lines changed: 0 additions & 77 deletions

File tree

include/net/ipv6.h

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,6 @@ struct frag_hdr {
149149
__be32 identification;
150150
};
151151

152-
/*
153-
* Jumbo payload option, as described in RFC 2675 2.
154-
*/
155-
struct hop_jumbo_hdr {
156-
u8 nexthdr;
157-
u8 hdrlen;
158-
u8 tlv_type; /* IPV6_TLV_JUMBO, 0xC2 */
159-
u8 tlv_len; /* 4 */
160-
__be32 jumbo_payload_len;
161-
};
162-
163152
#define IP6_MF 0x0001
164153
#define IP6_OFFSET 0xFFF8
165154

@@ -462,72 +451,6 @@ bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb,
462451
struct ipv6_txoptions *ipv6_update_options(struct sock *sk,
463452
struct ipv6_txoptions *opt);
464453

465-
/* This helper is specialized for BIG TCP needs.
466-
* It assumes the hop_jumbo_hdr will immediately follow the IPV6 header.
467-
* It assumes headers are already in skb->head.
468-
* Returns: 0, or IPPROTO_TCP if a BIG TCP packet is there.
469-
*/
470-
static inline int ipv6_has_hopopt_jumbo(const struct sk_buff *skb)
471-
{
472-
const struct hop_jumbo_hdr *jhdr;
473-
const struct ipv6hdr *nhdr;
474-
475-
if (likely(skb->len <= GRO_LEGACY_MAX_SIZE))
476-
return 0;
477-
478-
if (skb->protocol != htons(ETH_P_IPV6))
479-
return 0;
480-
481-
if (skb_network_offset(skb) +
482-
sizeof(struct ipv6hdr) +
483-
sizeof(struct hop_jumbo_hdr) > skb_headlen(skb))
484-
return 0;
485-
486-
nhdr = ipv6_hdr(skb);
487-
488-
if (nhdr->nexthdr != NEXTHDR_HOP)
489-
return 0;
490-
491-
jhdr = (const struct hop_jumbo_hdr *) (nhdr + 1);
492-
if (jhdr->tlv_type != IPV6_TLV_JUMBO || jhdr->hdrlen != 0 ||
493-
jhdr->nexthdr != IPPROTO_TCP)
494-
return 0;
495-
return jhdr->nexthdr;
496-
}
497-
498-
/* Return 0 if HBH header is successfully removed
499-
* Or if HBH removal is unnecessary (packet is not big TCP)
500-
* Return error to indicate dropping the packet
501-
*/
502-
static inline int ipv6_hopopt_jumbo_remove(struct sk_buff *skb)
503-
{
504-
const int hophdr_len = sizeof(struct hop_jumbo_hdr);
505-
int nexthdr = ipv6_has_hopopt_jumbo(skb);
506-
struct ipv6hdr *h6;
507-
508-
if (!nexthdr)
509-
return 0;
510-
511-
if (skb_cow_head(skb, 0))
512-
return -1;
513-
514-
/* Remove the HBH header.
515-
* Layout: [Ethernet header][IPv6 header][HBH][L4 Header]
516-
*/
517-
memmove(skb_mac_header(skb) + hophdr_len, skb_mac_header(skb),
518-
skb_network_header(skb) - skb_mac_header(skb) +
519-
sizeof(struct ipv6hdr));
520-
521-
__skb_pull(skb, hophdr_len);
522-
skb->network_header += hophdr_len;
523-
skb->mac_header += hophdr_len;
524-
525-
h6 = ipv6_hdr(skb);
526-
h6->nexthdr = nexthdr;
527-
528-
return 0;
529-
}
530-
531454
static inline bool ipv6_accept_ra(const struct inet6_dev *idev)
532455
{
533456
s32 accept_ra = READ_ONCE(idev->cnf.accept_ra);

0 commit comments

Comments
 (0)