Lines Matching refs:xs
48 i, be32_to_cpu(sap->xs->id.spi),
49 sap->xs->id.proto, sap->salt, sap->crypt);
84 static int nsim_ipsec_parse_proto_keys(struct xfrm_state *xs,
88 struct net_device *dev = xs->xso.real_dev;
93 if (!xs->aead) {
98 if (xs->aead->alg_icv_len != NSIM_IPSEC_AUTH_BITS) {
104 key_data = &xs->aead->alg_key[0];
105 key_len = xs->aead->alg_key_len;
106 alg_name = xs->aead->alg_name;
128 static int nsim_ipsec_add_sa(struct xfrm_state *xs,
138 dev = xs->xso.real_dev;
142 if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) {
147 if (xs->calg) {
152 if (xs->xso.type != XFRM_DEV_OFFLOAD_CRYPTO) {
167 sa.xs = xs;
169 if (sa.xs->id.proto & IPPROTO_ESP)
170 sa.crypt = xs->ealg || xs->aead;
173 ret = nsim_ipsec_parse_proto_keys(xs, sa.key, &sa.salt);
179 if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) {
182 if (xs->props.family == AF_INET6)
183 memcpy(sa.ipaddr, &xs->id.daddr.a6, 16);
185 memcpy(&sa.ipaddr[3], &xs->id.daddr.a4, 4);
194 xs->xso.offload_handle = sa_idx | NSIM_IPSEC_VALID;
200 static void nsim_ipsec_del_sa(struct xfrm_state *xs)
202 struct netdevsim *ns = netdev_priv(xs->xso.real_dev);
206 sa_idx = xs->xso.offload_handle & ~NSIM_IPSEC_VALID;
217 static bool nsim_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
219 struct netdevsim *ns = netdev_priv(xs->xso.real_dev);
237 struct xfrm_state *xs;
251 xs = xfrm_input_state(skb);
252 if (unlikely(!xs)) {
253 netdev_err(ns->netdev, "no xfrm_input_state() xs = %p\n", xs);
257 sa_idx = xs->xso.offload_handle & ~NSIM_IPSEC_VALID;
270 if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) {
271 netdev_err(ns->netdev, "unexpected proto=%d\n", xs->id.proto);