Lines Matching refs:xs
19 struct xfrm_state *xs) in ixgbevf_ipsec_set_pf_sa() argument
28 sam->dir = xs->xso.dir; in ixgbevf_ipsec_set_pf_sa()
29 sam->spi = xs->id.spi; in ixgbevf_ipsec_set_pf_sa()
30 sam->proto = xs->id.proto; in ixgbevf_ipsec_set_pf_sa()
31 sam->family = xs->props.family; in ixgbevf_ipsec_set_pf_sa()
33 if (xs->props.family == AF_INET6) in ixgbevf_ipsec_set_pf_sa()
34 memcpy(sam->addr, &xs->id.daddr.a6, sizeof(xs->id.daddr.a6)); in ixgbevf_ipsec_set_pf_sa()
36 memcpy(sam->addr, &xs->id.daddr.a4, sizeof(xs->id.daddr.a4)); in ixgbevf_ipsec_set_pf_sa()
37 memcpy(sam->key, xs->aead->alg_key, sizeof(sam->key)); in ixgbevf_ipsec_set_pf_sa()
117 ret = ixgbevf_ipsec_set_pf_sa(adapter, r->xs); in ixgbevf_ipsec_restore()
124 ret = ixgbevf_ipsec_set_pf_sa(adapter, t->xs); in ixgbevf_ipsec_restore()
188 if (spi == rsa->xs->id.spi && in ixgbevf_ipsec_find_rx_state()
189 ((ip4 && *daddr == rsa->xs->id.daddr.a4) || in ixgbevf_ipsec_find_rx_state()
190 (!ip4 && !memcmp(daddr, &rsa->xs->id.daddr.a6, in ixgbevf_ipsec_find_rx_state()
191 sizeof(rsa->xs->id.daddr.a6)))) && in ixgbevf_ipsec_find_rx_state()
192 proto == rsa->xs->id.proto) { in ixgbevf_ipsec_find_rx_state()
193 ret = rsa->xs; in ixgbevf_ipsec_find_rx_state()
211 static int ixgbevf_ipsec_parse_proto_keys(struct xfrm_state *xs, in ixgbevf_ipsec_parse_proto_keys() argument
214 struct net_device *dev = xs->xso.real_dev; in ixgbevf_ipsec_parse_proto_keys()
219 if (!xs->aead) { in ixgbevf_ipsec_parse_proto_keys()
224 if (xs->aead->alg_icv_len != IXGBE_IPSEC_AUTH_BITS) { in ixgbevf_ipsec_parse_proto_keys()
230 key_data = &xs->aead->alg_key[0]; in ixgbevf_ipsec_parse_proto_keys()
231 key_len = xs->aead->alg_key_len; in ixgbevf_ipsec_parse_proto_keys()
232 alg_name = xs->aead->alg_name; in ixgbevf_ipsec_parse_proto_keys()
262 static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs, in ixgbevf_ipsec_add_sa() argument
265 struct net_device *dev = xs->xso.real_dev; in ixgbevf_ipsec_add_sa()
274 if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) { in ixgbevf_ipsec_add_sa()
279 if (xs->props.mode != XFRM_MODE_TRANSPORT) { in ixgbevf_ipsec_add_sa()
284 if (xs->xso.type != XFRM_DEV_OFFLOAD_CRYPTO) { in ixgbevf_ipsec_add_sa()
289 if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) { in ixgbevf_ipsec_add_sa()
292 if (xs->calg) { in ixgbevf_ipsec_add_sa()
307 rsa.xs = xs; in ixgbevf_ipsec_add_sa()
309 if (rsa.xs->id.proto & IPPROTO_ESP) in ixgbevf_ipsec_add_sa()
310 rsa.decrypt = xs->ealg || xs->aead; in ixgbevf_ipsec_add_sa()
313 ret = ixgbevf_ipsec_parse_proto_keys(xs, rsa.key, &rsa.salt); in ixgbevf_ipsec_add_sa()
320 if (xs->props.family == AF_INET6) in ixgbevf_ipsec_add_sa()
321 memcpy(rsa.ipaddr, &xs->id.daddr.a6, 16); in ixgbevf_ipsec_add_sa()
323 memcpy(&rsa.ipaddr[3], &xs->id.daddr.a4, 4); in ixgbevf_ipsec_add_sa()
326 if (rsa.xs->id.proto & IPPROTO_ESP) in ixgbevf_ipsec_add_sa()
330 if (rsa.xs->props.family == AF_INET6) in ixgbevf_ipsec_add_sa()
333 ret = ixgbevf_ipsec_set_pf_sa(adapter, xs); in ixgbevf_ipsec_add_sa()
341 xs->xso.offload_handle = sa_idx + IXGBE_IPSEC_BASE_RX_INDEX; in ixgbevf_ipsec_add_sa()
347 (__force u32)rsa.xs->id.spi); in ixgbevf_ipsec_add_sa()
361 tsa.xs = xs; in ixgbevf_ipsec_add_sa()
363 if (xs->id.proto & IPPROTO_ESP) in ixgbevf_ipsec_add_sa()
364 tsa.encrypt = xs->ealg || xs->aead; in ixgbevf_ipsec_add_sa()
366 ret = ixgbevf_ipsec_parse_proto_keys(xs, tsa.key, &tsa.salt); in ixgbevf_ipsec_add_sa()
373 ret = ixgbevf_ipsec_set_pf_sa(adapter, xs); in ixgbevf_ipsec_add_sa()
381 xs->xso.offload_handle = sa_idx + IXGBE_IPSEC_BASE_TX_INDEX; in ixgbevf_ipsec_add_sa()
393 static void ixgbevf_ipsec_del_sa(struct xfrm_state *xs) in ixgbevf_ipsec_del_sa() argument
395 struct net_device *dev = xs->xso.real_dev; in ixgbevf_ipsec_del_sa()
403 if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) { in ixgbevf_ipsec_del_sa()
404 sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_RX_INDEX; in ixgbevf_ipsec_del_sa()
408 sa_idx, xs->xso.offload_handle); in ixgbevf_ipsec_del_sa()
417 sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_TX_INDEX; in ixgbevf_ipsec_del_sa()
421 sa_idx, xs->xso.offload_handle); in ixgbevf_ipsec_del_sa()
436 static bool ixgbevf_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs) in ixgbevf_ipsec_offload_ok() argument
438 if (xs->props.family == AF_INET) { in ixgbevf_ipsec_offload_ok()
469 struct xfrm_state *xs; in ixgbevf_ipsec_tx() local
481 xs = xfrm_input_state(first->skb); in ixgbevf_ipsec_tx()
482 if (unlikely(!xs)) { in ixgbevf_ipsec_tx()
484 __func__, xs); in ixgbevf_ipsec_tx()
488 sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_TX_INDEX; in ixgbevf_ipsec_tx()
491 __func__, sa_idx, xs->xso.offload_handle); in ixgbevf_ipsec_tx()
506 if (xs->id.proto == IPPROTO_ESP) { in ixgbevf_ipsec_tx()
565 struct xfrm_state *xs = NULL; in ixgbevf_ipsec_rx() local
604 xs = ixgbevf_ipsec_find_rx_state(ipsec, daddr, proto, spi, !!ip4); in ixgbevf_ipsec_rx()
605 if (unlikely(!xs)) in ixgbevf_ipsec_rx()
612 sp->xvec[sp->len++] = xs; in ixgbevf_ipsec_rx()