Lines Matching +full:xo +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-only
33 struct xfrm_offload *xo; in esp4_gro_receive() local
44 xo = xfrm_offload(skb); in esp4_gro_receive()
45 if (!xo || !(xo->flags & CRYPTO_DONE)) { in esp4_gro_receive()
51 if (sp->len == XFRM_MAX_DEPTH) in esp4_gro_receive()
54 x = xfrm_state_lookup(dev_net(skb->dev), skb->mark, in esp4_gro_receive()
55 (xfrm_address_t *)&ip_hdr(skb)->daddr, in esp4_gro_receive()
60 skb->mark = xfrm_smark_get(skb->mark, x); in esp4_gro_receive()
62 sp->xvec[sp->len++] = x; in esp4_gro_receive()
63 sp->olen++; in esp4_gro_receive()
65 xo = xfrm_offload(skb); in esp4_gro_receive()
66 if (!xo) in esp4_gro_receive()
70 xo->flags |= XFRM_GRO; in esp4_gro_receive()
72 XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL; in esp4_gro_receive()
73 XFRM_SPI_SKB_CB(skb)->family = AF_INET; in esp4_gro_receive()
74 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); in esp4_gro_receive()
75 XFRM_SPI_SKB_CB(skb)->seq = seq; in esp4_gro_receive()
79 xfrm_input(skb, IPPROTO_ESP, spi, -2); in esp4_gro_receive()
81 return ERR_PTR(-EINPROGRESS); in esp4_gro_receive()
86 NAPI_GRO_CB(skb)->same_flow = 0; in esp4_gro_receive()
87 NAPI_GRO_CB(skb)->flush = 1; in esp4_gro_receive()
96 struct xfrm_offload *xo = xfrm_offload(skb); in esp4_gso_encap() local
97 int proto = iph->protocol; in esp4_gso_encap()
99 skb_push(skb, -skb_network_offset(skb)); in esp4_gso_encap()
103 esph->spi = x->id.spi; in esp4_gso_encap()
104 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output.low); in esp4_gso_encap()
106 xo->proto = proto; in esp4_gso_encap()
113 __be16 type = x->inner_mode.family == AF_INET6 ? htons(ETH_P_IPV6) in xfrm4_tunnel_gso_segment()
124 struct sk_buff *segs = ERR_PTR(-EINVAL); in xfrm4_transport_gso_segment()
125 struct xfrm_offload *xo = xfrm_offload(skb); in xfrm4_transport_gso_segment() local
127 skb->transport_header += x->props.header_len; in xfrm4_transport_gso_segment()
128 ops = rcu_dereference(inet_offloads[xo->proto]); in xfrm4_transport_gso_segment()
129 if (likely(ops && ops->callbacks.gso_segment)) in xfrm4_transport_gso_segment()
130 segs = ops->callbacks.gso_segment(skb, features); in xfrm4_transport_gso_segment()
139 struct xfrm_offload *xo = xfrm_offload(skb); in xfrm4_beet_gso_segment() local
140 struct sk_buff *segs = ERR_PTR(-EINVAL); in xfrm4_beet_gso_segment()
142 u8 proto = xo->proto; in xfrm4_beet_gso_segment()
144 skb->transport_header += x->props.header_len; in xfrm4_beet_gso_segment()
146 if (x->sel.family != AF_INET6) { in xfrm4_beet_gso_segment()
149 (struct ip_beet_phdr *)skb->data; in xfrm4_beet_gso_segment()
151 skb->transport_header += ph->hdrlen * 8; in xfrm4_beet_gso_segment()
152 proto = ph->nexthdr; in xfrm4_beet_gso_segment()
154 skb->transport_header -= IPV4_BEET_PHMAXLEN; in xfrm4_beet_gso_segment()
159 skb->transport_header += in xfrm4_beet_gso_segment()
162 skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; in xfrm4_beet_gso_segment()
166 skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP4; in xfrm4_beet_gso_segment()
170 if (likely(ops && ops->callbacks.gso_segment)) in xfrm4_beet_gso_segment()
171 segs = ops->callbacks.gso_segment(skb, features); in xfrm4_beet_gso_segment()
180 switch (x->outer_mode.encap) { in xfrm4_outer_mode_gso_segment()
189 return ERR_PTR(-EOPNOTSUPP); in xfrm4_outer_mode_gso_segment()
199 struct xfrm_offload *xo = xfrm_offload(skb); in esp4_gso_segment() local
202 if (!xo) in esp4_gso_segment()
203 return ERR_PTR(-EINVAL); in esp4_gso_segment()
205 if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) in esp4_gso_segment()
206 return ERR_PTR(-EINVAL); in esp4_gso_segment()
209 x = sp->xvec[sp->len - 1]; in esp4_gso_segment()
210 aead = x->data; in esp4_gso_segment()
213 if (esph->spi != x->id.spi) in esp4_gso_segment()
214 return ERR_PTR(-EINVAL); in esp4_gso_segment()
217 return ERR_PTR(-EINVAL); in esp4_gso_segment()
221 skb->encap_hdr_csum = 1; in esp4_gso_segment()
223 if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) && in esp4_gso_segment()
224 !(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) in esp4_gso_segment()
228 !(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) in esp4_gso_segment()
232 xo->flags |= XFRM_GSO_SEGMENT; in esp4_gso_segment()
239 struct crypto_aead *aead = x->data; in esp_input_tail()
240 struct xfrm_offload *xo = xfrm_offload(skb); in esp_input_tail() local
243 return -EINVAL; in esp_input_tail()
245 if (!(xo->flags & CRYPTO_DONE)) in esp_input_tail()
246 skb->ip_summed = CHECKSUM_NONE; in esp_input_tail()
256 struct xfrm_offload *xo; in esp_xmit() local
265 xo = xfrm_offload(skb); in esp_xmit()
267 if (!xo) in esp_xmit()
268 return -EINVAL; in esp_xmit()
271 !(skb->dev->gso_partial_features & NETIF_F_HW_ESP)) || in esp_xmit()
272 x->xso.dev != skb->dev) { in esp_xmit()
273 xo->flags |= CRYPTO_FALLBACK; in esp_xmit()
277 esp.proto = xo->proto; in esp_xmit()
281 aead = x->data; in esp_xmit()
288 esp.clen = ALIGN(skb->len + 2 + esp.tfclen, blksize); in esp_xmit()
289 esp.plen = esp.clen - skb->len - esp.tfclen; in esp_xmit()
301 seq = xo->seq.low; in esp_xmit()
304 esph->spi = x->id.spi; in esp_xmit()
306 skb_push(skb, -skb_network_offset(skb)); in esp_xmit()
308 if (xo->flags & XFRM_GSO_SEGMENT) { in esp_xmit()
309 esph->seq_no = htonl(seq); in esp_xmit()
312 xo->seq.low++; in esp_xmit()
314 xo->seq.low += skb_shinfo(skb)->gso_segs; in esp_xmit()
317 if (xo->seq.low < seq) in esp_xmit()
318 xo->seq.hi++; in esp_xmit()
320 esp.seqno = cpu_to_be64(seq + ((u64)xo->seq.hi << 32)); in esp_xmit()
322 ip_hdr(skb)->tot_len = htons(skb->len); in esp_xmit()
327 return -ENOMEM; in esp_xmit()
329 xo = xfrm_offload(skb); in esp_xmit()
330 if (!xo) in esp_xmit()
331 return -EINVAL; in esp_xmit()
333 xo->flags |= XFRM_XMIT; in esp_xmit()
365 return -EAGAIN; in esp4_offload_init()