esp4_offload.c (a4654e9bde4ecedb4921e6c8fe2088114bdff1b3) esp4_offload.c (384a46ea7bdc77e1e070b728d427b763e364613c)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * IPV4 GSO/GRO offload support
4 * Linux INET implementation
5 *
6 * Copyright (C) 2016 secunet Security Networks AG
7 * Author: Steffen Klassert <steffen.klassert@secunet.com>
8 *

--- 118 unchanged lines hidden (view full) ---

127 skb->transport_header += x->props.header_len;
128 ops = rcu_dereference(inet_offloads[xo->proto]);
129 if (likely(ops && ops->callbacks.gso_segment))
130 segs = ops->callbacks.gso_segment(skb, features);
131
132 return segs;
133}
134
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * IPV4 GSO/GRO offload support
4 * Linux INET implementation
5 *
6 * Copyright (C) 2016 secunet Security Networks AG
7 * Author: Steffen Klassert <steffen.klassert@secunet.com>
8 *

--- 118 unchanged lines hidden (view full) ---

127 skb->transport_header += x->props.header_len;
128 ops = rcu_dereference(inet_offloads[xo->proto]);
129 if (likely(ops && ops->callbacks.gso_segment))
130 segs = ops->callbacks.gso_segment(skb, features);
131
132 return segs;
133}
134
135static struct sk_buff *xfrm4_beet_gso_segment(struct xfrm_state *x,
136 struct sk_buff *skb,
137 netdev_features_t features)
138{
139 struct xfrm_offload *xo = xfrm_offload(skb);
140 struct sk_buff *segs = ERR_PTR(-EINVAL);
141 const struct net_offload *ops;
142 int proto = xo->proto;
143
144 skb->transport_header += x->props.header_len;
145
146 if (proto == IPPROTO_BEETPH) {
147 struct ip_beet_phdr *ph = (struct ip_beet_phdr *)skb->data;
148
149 skb->transport_header += ph->hdrlen * 8;
150 proto = ph->nexthdr;
151 } else if (x->sel.family != AF_INET6) {
152 skb->transport_header -= IPV4_BEET_PHMAXLEN;
153 } else if (proto == IPPROTO_TCP) {
154 skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
155 }
156
157 __skb_pull(skb, skb_transport_offset(skb));
158 ops = rcu_dereference(inet_offloads[proto]);
159 if (likely(ops && ops->callbacks.gso_segment))
160 segs = ops->callbacks.gso_segment(skb, features);
161
162 return segs;
163}
164
135static struct sk_buff *xfrm4_outer_mode_gso_segment(struct xfrm_state *x,
136 struct sk_buff *skb,
137 netdev_features_t features)
138{
139 switch (x->outer_mode.encap) {
140 case XFRM_MODE_TUNNEL:
141 return xfrm4_tunnel_gso_segment(x, skb, features);
142 case XFRM_MODE_TRANSPORT:
143 return xfrm4_transport_gso_segment(x, skb, features);
165static struct sk_buff *xfrm4_outer_mode_gso_segment(struct xfrm_state *x,
166 struct sk_buff *skb,
167 netdev_features_t features)
168{
169 switch (x->outer_mode.encap) {
170 case XFRM_MODE_TUNNEL:
171 return xfrm4_tunnel_gso_segment(x, skb, features);
172 case XFRM_MODE_TRANSPORT:
173 return xfrm4_transport_gso_segment(x, skb, features);
174 case XFRM_MODE_BEET:
175 return xfrm4_beet_gso_segment(x, skb, features);
144 }
145
146 return ERR_PTR(-EOPNOTSUPP);
147}
148
149static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
150 netdev_features_t features)
151{

--- 174 unchanged lines hidden ---
176 }
177
178 return ERR_PTR(-EOPNOTSUPP);
179}
180
181static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
182 netdev_features_t features)
183{

--- 174 unchanged lines hidden ---