Lines Matching +full:com +full:- +full:seq
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Author: Steffen Klassert <steffen.klassert@secunet.com>
38 if (likely(ipv6_hdr->nexthdr == NEXTHDR_ESP || in esp6_nexthdr_esp_offset()
39 ipv6_hdr->nexthdr == NEXTHDR_UDP)) in esp6_nexthdr_esp_offset()
44 if (exthdr->nexthdr == NEXTHDR_ESP) in esp6_nexthdr_esp_offset()
60 __be32 seq; in esp6_gro_receive() local
64 if (NAPI_GRO_CB(skb)->proto == IPPROTO_UDP) in esp6_gro_receive()
70 if (xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq) != 0) in esp6_gro_receive()
74 if (!xo || !(xo->flags & CRYPTO_DONE)) { in esp6_gro_receive()
80 if (sp->len == XFRM_MAX_DEPTH) in esp6_gro_receive()
83 x = xfrm_state_lookup(dev_net(skb->dev), skb->mark, in esp6_gro_receive()
84 (xfrm_address_t *)&ipv6_hdr(skb)->daddr, in esp6_gro_receive()
87 if (unlikely(x && x->dir && x->dir != XFRM_SA_DIR_IN)) { in esp6_gro_receive()
88 /* non-offload path will record the error and audit log */ in esp6_gro_receive()
96 skb->mark = xfrm_smark_get(skb->mark, x); in esp6_gro_receive()
98 sp->xvec[sp->len++] = x; in esp6_gro_receive()
99 sp->olen++; in esp6_gro_receive()
106 xo->flags |= XFRM_GRO; in esp6_gro_receive()
112 IP6CB(skb)->nhoff = nhoff; in esp6_gro_receive()
113 XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL; in esp6_gro_receive()
114 XFRM_SPI_SKB_CB(skb)->family = AF_INET6; in esp6_gro_receive()
115 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); in esp6_gro_receive()
116 XFRM_SPI_SKB_CB(skb)->seq = seq; in esp6_gro_receive()
122 return ERR_PTR(-EINPROGRESS); in esp6_gro_receive()
127 NAPI_GRO_CB(skb)->same_flow = 0; in esp6_gro_receive()
128 NAPI_GRO_CB(skb)->flush = 1; in esp6_gro_receive()
138 u8 proto = iph->nexthdr; in esp6_gso_encap()
140 skb_push(skb, -skb_network_offset(skb)); in esp6_gso_encap()
142 if (x->outer_mode.encap == XFRM_MODE_TRANSPORT) { in esp6_gso_encap()
151 esph->spi = x->id.spi; in esp6_gso_encap()
152 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output.low); in esp6_gso_encap()
154 xo->proto = proto; in esp6_gso_encap()
161 __be16 type = x->inner_mode.family == AF_INET ? htons(ETH_P_IP) in xfrm6_tunnel_gso_segment()
172 struct sk_buff *segs = ERR_PTR(-EINVAL); in xfrm6_transport_gso_segment()
175 skb->transport_header += x->props.header_len; in xfrm6_transport_gso_segment()
176 ops = rcu_dereference(inet6_offloads[xo->proto]); in xfrm6_transport_gso_segment()
177 if (likely(ops && ops->callbacks.gso_segment)) in xfrm6_transport_gso_segment()
178 segs = ops->callbacks.gso_segment(skb, features); in xfrm6_transport_gso_segment()
188 struct sk_buff *segs = ERR_PTR(-EINVAL); in xfrm6_beet_gso_segment()
190 u8 proto = xo->proto; in xfrm6_beet_gso_segment()
192 skb->transport_header += x->props.header_len; in xfrm6_beet_gso_segment()
194 if (x->sel.family != AF_INET6) { in xfrm6_beet_gso_segment()
195 skb->transport_header -= in xfrm6_beet_gso_segment()
196 (sizeof(struct ipv6hdr) - sizeof(struct iphdr)); in xfrm6_beet_gso_segment()
200 (struct ip_beet_phdr *)skb->data; in xfrm6_beet_gso_segment()
202 skb->transport_header += ph->hdrlen * 8; in xfrm6_beet_gso_segment()
203 proto = ph->nexthdr; in xfrm6_beet_gso_segment()
205 skb->transport_header -= IPV4_BEET_PHMAXLEN; in xfrm6_beet_gso_segment()
209 skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6; in xfrm6_beet_gso_segment()
213 skb->transport_header += in xfrm6_beet_gso_segment()
218 skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP6; in xfrm6_beet_gso_segment()
222 if (likely(ops && ops->callbacks.gso_segment)) in xfrm6_beet_gso_segment()
223 segs = ops->callbacks.gso_segment(skb, features); in xfrm6_beet_gso_segment()
232 switch (x->outer_mode.encap) { in xfrm6_outer_mode_gso_segment()
241 return ERR_PTR(-EOPNOTSUPP); in xfrm6_outer_mode_gso_segment()
255 return ERR_PTR(-EINVAL); in esp6_gso_segment()
257 if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) in esp6_gso_segment()
258 return ERR_PTR(-EINVAL); in esp6_gso_segment()
261 x = sp->xvec[sp->len - 1]; in esp6_gso_segment()
262 aead = x->data; in esp6_gso_segment()
265 if (esph->spi != x->id.spi) in esp6_gso_segment()
266 return ERR_PTR(-EINVAL); in esp6_gso_segment()
269 return ERR_PTR(-EINVAL); in esp6_gso_segment()
273 skb->encap_hdr_csum = 1; in esp6_gso_segment()
275 if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) in esp6_gso_segment()
282 xo->flags |= XFRM_GSO_SEGMENT; in esp6_gso_segment()
289 struct crypto_aead *aead = x->data; in esp6_input_tail()
293 return -EINVAL; in esp6_input_tail()
295 if (!(xo->flags & CRYPTO_DONE)) in esp6_input_tail()
296 skb->ip_summed = CHECKSUM_NONE; in esp6_input_tail()
311 __u32 seq; in esp6_xmit() local
318 return -EINVAL; in esp6_xmit()
320 if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) { in esp6_xmit()
321 xo->flags |= CRYPTO_FALLBACK; in esp6_xmit()
325 esp.proto = xo->proto; in esp6_xmit()
329 aead = x->data; in esp6_xmit()
336 esp.clen = ALIGN(skb->len + 2 + esp.tfclen, blksize); in esp6_xmit()
337 esp.plen = esp.clen - skb->len - esp.tfclen; in esp6_xmit()
346 seq = xo->seq.low; in esp6_xmit()
349 esp.esph->spi = x->id.spi; in esp6_xmit()
351 skb_push(skb, -skb_network_offset(skb)); in esp6_xmit()
353 if (xo->flags & XFRM_GSO_SEGMENT) { in esp6_xmit()
354 esp.esph->seq_no = htonl(seq); in esp6_xmit()
357 xo->seq.low++; in esp6_xmit()
359 xo->seq.low += skb_shinfo(skb)->gso_segs; in esp6_xmit()
362 if (xo->seq.low < seq) in esp6_xmit()
363 xo->seq.hi++; in esp6_xmit()
365 esp.seqno = cpu_to_be64(xo->seq.low + ((u64)xo->seq.hi << 32)); in esp6_xmit()
367 len = skb->len - sizeof(struct ipv6hdr); in esp6_xmit()
371 ipv6_hdr(skb)->payload_len = htons(len); in esp6_xmit()
375 return -ENOMEM; in esp6_xmit()
379 return -EINVAL; in esp6_xmit()
381 xo->flags |= XFRM_XMIT; in esp6_xmit()
391 if (skb_needs_linearize(skb, skb->dev->features) && in esp6_xmit()
393 return -ENOMEM; in esp6_xmit()
416 return -EAGAIN; in esp6_offload_init()
431 MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>");