Lines Matching +full:com +full:- +full:seq

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Author: Steffen Klassert <steffen.klassert@secunet.com>
37 __be32 seq; in esp4_gro_receive() local
43 if (xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq) != 0) in esp4_gro_receive()
47 if (!xo || !(xo->flags & CRYPTO_DONE)) { in esp4_gro_receive()
53 if (sp->len == XFRM_MAX_DEPTH) in esp4_gro_receive()
56 x = xfrm_state_lookup(dev_net(skb->dev), skb->mark, in esp4_gro_receive()
57 (xfrm_address_t *)&ip_hdr(skb)->daddr, in esp4_gro_receive()
60 if (unlikely(x && x->dir && x->dir != XFRM_SA_DIR_IN)) { in esp4_gro_receive()
61 /* non-offload path will record the error and audit log */ in esp4_gro_receive()
69 skb->mark = xfrm_smark_get(skb->mark, x); in esp4_gro_receive()
71 sp->xvec[sp->len++] = x; in esp4_gro_receive()
72 sp->olen++; in esp4_gro_receive()
79 xo->flags |= XFRM_GRO; in esp4_gro_receive()
81 if (NAPI_GRO_CB(skb)->proto == IPPROTO_UDP) in esp4_gro_receive()
84 XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL; in esp4_gro_receive()
85 XFRM_SPI_SKB_CB(skb)->family = AF_INET; in esp4_gro_receive()
86 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); in esp4_gro_receive()
87 XFRM_SPI_SKB_CB(skb)->seq = seq; in esp4_gro_receive()
93 return ERR_PTR(-EINPROGRESS); in esp4_gro_receive()
98 NAPI_GRO_CB(skb)->same_flow = 0; in esp4_gro_receive()
99 NAPI_GRO_CB(skb)->flush = 1; in esp4_gro_receive()
109 int proto = iph->protocol; in esp4_gso_encap()
111 skb_push(skb, -skb_network_offset(skb)); in esp4_gso_encap()
115 esph->spi = x->id.spi; in esp4_gso_encap()
116 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output.low); in esp4_gso_encap()
118 xo->proto = proto; in esp4_gso_encap()
125 __be16 type = x->inner_mode.family == AF_INET6 ? htons(ETH_P_IPV6) in xfrm4_tunnel_gso_segment()
136 struct sk_buff *segs = ERR_PTR(-EINVAL); in xfrm4_transport_gso_segment()
139 skb->transport_header += x->props.header_len; in xfrm4_transport_gso_segment()
140 ops = rcu_dereference(inet_offloads[xo->proto]); in xfrm4_transport_gso_segment()
141 if (likely(ops && ops->callbacks.gso_segment)) in xfrm4_transport_gso_segment()
142 segs = ops->callbacks.gso_segment(skb, features); in xfrm4_transport_gso_segment()
152 struct sk_buff *segs = ERR_PTR(-EINVAL); in xfrm4_beet_gso_segment()
154 u8 proto = xo->proto; in xfrm4_beet_gso_segment()
156 skb->transport_header += x->props.header_len; in xfrm4_beet_gso_segment()
158 if (x->sel.family != AF_INET6) { in xfrm4_beet_gso_segment()
161 (struct ip_beet_phdr *)skb->data; in xfrm4_beet_gso_segment()
163 skb->transport_header += ph->hdrlen * 8; in xfrm4_beet_gso_segment()
164 proto = ph->nexthdr; in xfrm4_beet_gso_segment()
166 skb->transport_header -= IPV4_BEET_PHMAXLEN; in xfrm4_beet_gso_segment()
171 skb->transport_header += in xfrm4_beet_gso_segment()
174 skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; in xfrm4_beet_gso_segment()
178 skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP4; in xfrm4_beet_gso_segment()
182 if (likely(ops && ops->callbacks.gso_segment)) in xfrm4_beet_gso_segment()
183 segs = ops->callbacks.gso_segment(skb, features); in xfrm4_beet_gso_segment()
192 switch (x->outer_mode.encap) { in xfrm4_outer_mode_gso_segment()
201 return ERR_PTR(-EOPNOTSUPP); in xfrm4_outer_mode_gso_segment()
215 return ERR_PTR(-EINVAL); in esp4_gso_segment()
217 if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) in esp4_gso_segment()
218 return ERR_PTR(-EINVAL); in esp4_gso_segment()
221 x = sp->xvec[sp->len - 1]; in esp4_gso_segment()
222 aead = x->data; in esp4_gso_segment()
225 if (esph->spi != x->id.spi) in esp4_gso_segment()
226 return ERR_PTR(-EINVAL); in esp4_gso_segment()
229 return ERR_PTR(-EINVAL); in esp4_gso_segment()
233 skb->encap_hdr_csum = 1; in esp4_gso_segment()
235 if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) && in esp4_gso_segment()
236 !(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) in esp4_gso_segment()
240 !(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) in esp4_gso_segment()
244 xo->flags |= XFRM_GSO_SEGMENT; in esp4_gso_segment()
251 struct crypto_aead *aead = x->data; in esp_input_tail()
255 return -EINVAL; in esp_input_tail()
257 if (!(xo->flags & CRYPTO_DONE)) in esp_input_tail()
258 skb->ip_summed = CHECKSUM_NONE; in esp_input_tail()
273 __u32 seq; in esp_xmit() local
281 return -EINVAL; in esp_xmit()
284 !(skb->dev->gso_partial_features & NETIF_F_HW_ESP)) || in esp_xmit()
285 x->xso.dev != skb->dev) { in esp_xmit()
286 xo->flags |= CRYPTO_FALLBACK; in esp_xmit()
290 esp.proto = xo->proto; in esp_xmit()
294 aead = x->data; in esp_xmit()
301 esp.clen = ALIGN(skb->len + 2 + esp.tfclen, blksize); in esp_xmit()
302 esp.plen = esp.clen - skb->len - esp.tfclen; in esp_xmit()
307 if (x->encap) in esp_xmit()
308 encap_type = x->encap->encap_type; in esp_xmit()
316 seq = xo->seq.low; in esp_xmit()
319 esph->spi = x->id.spi; in esp_xmit()
321 skb_push(skb, -skb_network_offset(skb)); in esp_xmit()
323 if (xo->flags & XFRM_GSO_SEGMENT) { in esp_xmit()
324 esph->seq_no = htonl(seq); in esp_xmit()
327 xo->seq.low++; in esp_xmit()
329 xo->seq.low += skb_shinfo(skb)->gso_segs; in esp_xmit()
332 if (xo->seq.low < seq) in esp_xmit()
333 xo->seq.hi++; in esp_xmit()
335 esp.seqno = cpu_to_be64(seq + ((u64)xo->seq.hi << 32)); in esp_xmit()
338 /* In the XFRM stack, the encapsulation protocol is set to iphdr->protocol by in esp_xmit()
339 * setting *skb_mac_header(skb) (see esp_output_udp_encap()) where skb->mac_header in esp_xmit()
340 * points to iphdr->protocol (see xfrm4_tunnel_encap_add()). in esp_xmit()
341 * However, in esp_xmit(), skb->mac_header doesn't point to iphdr->protocol. in esp_xmit()
344 ip_hdr(skb)->protocol = IPPROTO_UDP; in esp_xmit()
346 esph->seq_no = htonl(seq); in esp_xmit()
349 ip_hdr(skb)->tot_len = htons(skb->len); in esp_xmit()
354 return -ENOMEM; in esp_xmit()
358 return -EINVAL; in esp_xmit()
360 xo->flags |= XFRM_XMIT; in esp_xmit()
370 if (skb_needs_linearize(skb, skb->dev->features) && in esp_xmit()
372 return -ENOMEM; in esp_xmit()
395 return -EAGAIN; in esp4_offload_init()
410 MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>");