Lines Matching full:ipsec

94  * ixgbevf_ipsec_restore - restore the IPsec HW settings after a reset
103 struct ixgbevf_ipsec *ipsec = adapter->ipsec; in ixgbevf_ipsec_restore() local
112 struct rx_sa *r = &ipsec->rx_tbl[i]; in ixgbevf_ipsec_restore()
113 struct tx_sa *t = &ipsec->tx_tbl[i]; in ixgbevf_ipsec_restore()
134 * @ipsec: pointer to IPsec struct
140 int ixgbevf_ipsec_find_empty_idx(struct ixgbevf_ipsec *ipsec, bool rxtable) in ixgbevf_ipsec_find_empty_idx() argument
145 if (ipsec->num_rx_sa == IXGBE_IPSEC_MAX_SA_COUNT) in ixgbevf_ipsec_find_empty_idx()
150 if (!ipsec->rx_tbl[i].used) in ixgbevf_ipsec_find_empty_idx()
154 if (ipsec->num_tx_sa == IXGBE_IPSEC_MAX_SA_COUNT) in ixgbevf_ipsec_find_empty_idx()
159 if (!ipsec->tx_tbl[i].used) in ixgbevf_ipsec_find_empty_idx()
169 * @ipsec: pointer to IPsec struct
178 struct xfrm_state *ixgbevf_ipsec_find_rx_state(struct ixgbevf_ipsec *ipsec, in ixgbevf_ipsec_find_rx_state() argument
186 hash_for_each_possible_rcu(ipsec->rx_sa_list, rsa, hlist, in ixgbevf_ipsec_find_rx_state()
221 netdev_err(dev, "Unsupported IPsec algorithm\n"); in ixgbevf_ipsec_parse_proto_keys()
226 netdev_err(dev, "IPsec offload requires %d bit authentication\n", in ixgbevf_ipsec_parse_proto_keys()
236 netdev_err(dev, "Unsupported IPsec algorithm - please use %s\n", in ixgbevf_ipsec_parse_proto_keys()
250 netdev_err(dev, "IPsec hw offload only supports keys up to 128 bits with a 32 bit salt\n"); in ixgbevf_ipsec_parse_proto_keys()
269 struct ixgbevf_ipsec *ipsec; in ixgbevf_ipsec_add_sa() local
274 ipsec = adapter->ipsec; in ixgbevf_ipsec_add_sa()
280 NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol for IPsec offload"); in ixgbevf_ipsec_add_sa()
285 NL_SET_ERR_MSG_MOD(extack, "Unsupported mode for ipsec offload"); in ixgbevf_ipsec_add_sa()
290 NL_SET_ERR_MSG_MOD(extack, "Unsupported ipsec offload type"); in ixgbevf_ipsec_add_sa()
303 ret = ixgbevf_ipsec_find_empty_idx(ipsec, true); in ixgbevf_ipsec_add_sa()
345 memcpy(&ipsec->rx_tbl[sa_idx], &rsa, sizeof(rsa)); in ixgbevf_ipsec_add_sa()
349 ipsec->num_rx_sa++; in ixgbevf_ipsec_add_sa()
352 hash_add_rcu(ipsec->rx_sa_list, &ipsec->rx_tbl[sa_idx].hlist, in ixgbevf_ipsec_add_sa()
358 ret = ixgbevf_ipsec_find_empty_idx(ipsec, false); in ixgbevf_ipsec_add_sa()
386 memcpy(&ipsec->tx_tbl[sa_idx], &tsa, sizeof(tsa)); in ixgbevf_ipsec_add_sa()
390 ipsec->num_tx_sa++; in ixgbevf_ipsec_add_sa()
405 struct ixgbevf_ipsec *ipsec; in ixgbevf_ipsec_del_sa() local
409 ipsec = adapter->ipsec; in ixgbevf_ipsec_del_sa()
417 if (!ipsec->rx_tbl[sa_idx].used) { in ixgbevf_ipsec_del_sa()
423 ixgbevf_ipsec_del_pf_sa(adapter, ipsec->rx_tbl[sa_idx].pfsa); in ixgbevf_ipsec_del_sa()
424 hash_del_rcu(&ipsec->rx_tbl[sa_idx].hlist); in ixgbevf_ipsec_del_sa()
425 memset(&ipsec->rx_tbl[sa_idx], 0, sizeof(struct rx_sa)); in ixgbevf_ipsec_del_sa()
426 ipsec->num_rx_sa--; in ixgbevf_ipsec_del_sa()
430 if (!ipsec->tx_tbl[sa_idx].used) { in ixgbevf_ipsec_del_sa()
436 ixgbevf_ipsec_del_pf_sa(adapter, ipsec->tx_tbl[sa_idx].pfsa); in ixgbevf_ipsec_del_sa()
437 memset(&ipsec->tx_tbl[sa_idx], 0, sizeof(struct tx_sa)); in ixgbevf_ipsec_del_sa()
438 ipsec->num_tx_sa--; in ixgbevf_ipsec_del_sa()
448 * ixgbevf_ipsec_tx - setup Tx flags for IPsec offload
451 * @itd: ipsec Tx data for later use in building context descriptor
458 struct ixgbevf_ipsec *ipsec = adapter->ipsec; in ixgbevf_ipsec_tx() local
485 tsa = &ipsec->tx_tbl[sa_idx]; in ixgbevf_ipsec_tx()
537 * ixgbevf_ipsec_rx - decode IPsec bits from Rx descriptor
542 * Determine if there was an IPsec encapsulation noticed, and if so set up
553 struct ixgbevf_ipsec *ipsec = adapter->ipsec; in ixgbevf_ipsec_rx() local
566 * hw won't recognize the IPsec packet and anyway the in ixgbevf_ipsec_rx()
594 xs = ixgbevf_ipsec_find_rx_state(ipsec, daddr, proto, spi, !!ip4); in ixgbevf_ipsec_rx()
612 * ixgbevf_init_ipsec_offload - initialize registers for IPsec operation
617 struct ixgbevf_ipsec *ipsec; in ixgbevf_init_ipsec_offload() local
631 ipsec = kzalloc(sizeof(*ipsec), GFP_KERNEL); in ixgbevf_init_ipsec_offload()
632 if (!ipsec) in ixgbevf_init_ipsec_offload()
634 hash_init(ipsec->rx_sa_list); in ixgbevf_init_ipsec_offload()
637 ipsec->rx_tbl = kzalloc(size, GFP_KERNEL); in ixgbevf_init_ipsec_offload()
638 if (!ipsec->rx_tbl) in ixgbevf_init_ipsec_offload()
642 ipsec->tx_tbl = kzalloc(size, GFP_KERNEL); in ixgbevf_init_ipsec_offload()
643 if (!ipsec->tx_tbl) in ixgbevf_init_ipsec_offload()
646 ipsec->num_rx_sa = 0; in ixgbevf_init_ipsec_offload()
647 ipsec->num_tx_sa = 0; in ixgbevf_init_ipsec_offload()
649 adapter->ipsec = ipsec; in ixgbevf_init_ipsec_offload()
663 kfree(ipsec->rx_tbl); in ixgbevf_init_ipsec_offload()
664 kfree(ipsec->tx_tbl); in ixgbevf_init_ipsec_offload()
665 kfree(ipsec); in ixgbevf_init_ipsec_offload()
671 * ixgbevf_stop_ipsec_offload - tear down the IPsec offload
676 struct ixgbevf_ipsec *ipsec = adapter->ipsec; in ixgbevf_stop_ipsec_offload() local
678 adapter->ipsec = NULL; in ixgbevf_stop_ipsec_offload()
679 if (ipsec) { in ixgbevf_stop_ipsec_offload()
680 kfree(ipsec->rx_tbl); in ixgbevf_stop_ipsec_offload()
681 kfree(ipsec->tx_tbl); in ixgbevf_stop_ipsec_offload()
682 kfree(ipsec); in ixgbevf_stop_ipsec_offload()