Lines Matching defs:ipsec

103 	struct ixgbevf_ipsec *ipsec = adapter->ipsec;
112 struct rx_sa *r = &ipsec->rx_tbl[i];
113 struct tx_sa *t = &ipsec->tx_tbl[i];
134 * @ipsec: pointer to IPsec struct
140 int ixgbevf_ipsec_find_empty_idx(struct ixgbevf_ipsec *ipsec, bool rxtable)
145 if (ipsec->num_rx_sa == IXGBE_IPSEC_MAX_SA_COUNT)
150 if (!ipsec->rx_tbl[i].used)
154 if (ipsec->num_tx_sa == IXGBE_IPSEC_MAX_SA_COUNT)
159 if (!ipsec->tx_tbl[i].used)
169 * @ipsec: pointer to IPsec struct
178 struct xfrm_state *ixgbevf_ipsec_find_rx_state(struct ixgbevf_ipsec *ipsec,
186 hash_for_each_possible_rcu(ipsec->rx_sa_list, rsa, hlist,
267 struct ixgbevf_ipsec *ipsec;
272 ipsec = adapter->ipsec;
280 NL_SET_ERR_MSG_MOD(extack, "Unsupported mode for ipsec offload");
285 NL_SET_ERR_MSG_MOD(extack, "Unsupported ipsec offload type");
298 ret = ixgbevf_ipsec_find_empty_idx(ipsec, true);
339 memcpy(&ipsec->rx_tbl[sa_idx], &rsa, sizeof(rsa));
343 ipsec->num_rx_sa++;
346 hash_add_rcu(ipsec->rx_sa_list, &ipsec->rx_tbl[sa_idx].hlist,
352 ret = ixgbevf_ipsec_find_empty_idx(ipsec, false);
379 memcpy(&ipsec->tx_tbl[sa_idx], &tsa, sizeof(tsa));
383 ipsec->num_tx_sa++;
397 struct ixgbevf_ipsec *ipsec;
401 ipsec = adapter->ipsec;
406 if (!ipsec->rx_tbl[sa_idx].used) {
412 ixgbevf_ipsec_del_pf_sa(adapter, ipsec->rx_tbl[sa_idx].pfsa);
413 hash_del_rcu(&ipsec->rx_tbl[sa_idx].hlist);
414 memset(&ipsec->rx_tbl[sa_idx], 0, sizeof(struct rx_sa));
415 ipsec->num_rx_sa--;
419 if (!ipsec->tx_tbl[sa_idx].used) {
425 ixgbevf_ipsec_del_pf_sa(adapter, ipsec->tx_tbl[sa_idx].pfsa);
426 memset(&ipsec->tx_tbl[sa_idx], 0, sizeof(struct tx_sa));
427 ipsec->num_tx_sa--;
461 * @itd: ipsec Tx data for later use in building context descriptor
468 struct ixgbevf_ipsec *ipsec = adapter->ipsec;
495 tsa = &ipsec->tx_tbl[sa_idx];
563 struct ixgbevf_ipsec *ipsec = adapter->ipsec;
604 xs = ixgbevf_ipsec_find_rx_state(ipsec, daddr, proto, spi, !!ip4);
627 struct ixgbevf_ipsec *ipsec;
638 ipsec = kzalloc(sizeof(*ipsec), GFP_KERNEL);
639 if (!ipsec)
641 hash_init(ipsec->rx_sa_list);
644 ipsec->rx_tbl = kzalloc(size, GFP_KERNEL);
645 if (!ipsec->rx_tbl)
649 ipsec->tx_tbl = kzalloc(size, GFP_KERNEL);
650 if (!ipsec->tx_tbl)
653 ipsec->num_rx_sa = 0;
654 ipsec->num_tx_sa = 0;
656 adapter->ipsec = ipsec;
670 kfree(ipsec->rx_tbl);
671 kfree(ipsec->tx_tbl);
672 kfree(ipsec);
683 struct ixgbevf_ipsec *ipsec = adapter->ipsec;
685 adapter->ipsec = NULL;
686 if (ipsec) {
687 kfree(ipsec->rx_tbl);
688 kfree(ipsec->tx_tbl);
689 kfree(ipsec);