Lines Matching refs:ipsec
248 /* final set for normal (no ipsec offload) processing */
293 * ixgbe_ipsec_restore - restore the ipsec HW settings after a reset
305 struct ixgbe_ipsec *ipsec = adapter->ipsec;
319 struct rx_sa *r = &ipsec->rx_tbl[i];
320 struct tx_sa *t = &ipsec->tx_tbl[i];
341 struct rx_ip_sa *ipsa = &ipsec->ip_tbl[i];
350 * @ipsec: pointer to ipsec struct
355 static int ixgbe_ipsec_find_empty_idx(struct ixgbe_ipsec *ipsec, bool rxtable)
360 if (ipsec->num_rx_sa == IXGBE_IPSEC_MAX_SA_COUNT)
365 if (!ipsec->rx_tbl[i].used)
369 if (ipsec->num_tx_sa == IXGBE_IPSEC_MAX_SA_COUNT)
374 if (!ipsec->tx_tbl[i].used)
384 * @ipsec: pointer to ipsec struct
392 static struct xfrm_state *ixgbe_ipsec_find_rx_state(struct ixgbe_ipsec *ipsec,
400 hash_for_each_possible_rcu(ipsec->rx_sa_list, rsa, hlist,
570 struct ixgbe_ipsec *ipsec = adapter->ipsec;
578 NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol for ipsec offload");
583 NL_SET_ERR_MSG_MOD(extack, "Unsupported mode for ipsec offload");
593 NL_SET_ERR_MSG_MOD(extack, "Unsupported ipsec offload type");
606 ret = ixgbe_ipsec_find_empty_idx(ipsec, true);
648 (checked < ipsec->num_rx_sa || first < 0);
650 if (ipsec->ip_tbl[i].used) {
651 if (!memcmp(ipsec->ip_tbl[i].ipaddr,
662 if (ipsec->num_rx_sa == 0)
668 ipsec->ip_tbl[match].ref_cnt++;
674 memcpy(ipsec->ip_tbl[first].ipaddr,
676 ipsec->ip_tbl[first].ref_cnt = 1;
677 ipsec->ip_tbl[first].used = true;
697 memcpy(&ipsec->rx_tbl[sa_idx], &rsa, sizeof(rsa));
703 ipsec->num_rx_sa++;
706 hash_add_rcu(ipsec->rx_sa_list, &ipsec->rx_tbl[sa_idx].hlist,
716 ret = ixgbe_ipsec_find_empty_idx(ipsec, false);
738 memcpy(&ipsec->tx_tbl[sa_idx], &tsa, sizeof(tsa));
744 ipsec->num_tx_sa++;
764 struct ixgbe_ipsec *ipsec = adapter->ipsec;
774 rsa = &ipsec->rx_tbl[sa_idx];
789 if (ipsec->ip_tbl[ipi].ref_cnt > 0) {
790 ipsec->ip_tbl[ipi].ref_cnt--;
792 if (!ipsec->ip_tbl[ipi].ref_cnt) {
793 memset(&ipsec->ip_tbl[ipi], 0,
801 ipsec->num_rx_sa--;
805 if (!ipsec->tx_tbl[sa_idx].used) {
812 memset(&ipsec->tx_tbl[sa_idx], 0, sizeof(struct tx_sa));
813 ipsec->num_tx_sa--;
817 if (ipsec->num_rx_sa == 0 && ipsec->num_tx_sa == 0) {
835 struct ixgbe_ipsec *ipsec = adapter->ipsec;
838 if (!ipsec)
842 for (i = 0; i < IXGBE_IPSEC_MAX_SA_COUNT && ipsec->num_rx_sa; i++) {
843 if (!ipsec->rx_tbl[i].used)
845 if (ipsec->rx_tbl[i].mode & IXGBE_RXTXMOD_VF &&
846 ipsec->rx_tbl[i].vf == vf)
848 ipsec->rx_tbl[i].xs);
852 for (i = 0; i < IXGBE_IPSEC_MAX_SA_COUNT && ipsec->num_tx_sa; i++) {
853 if (!ipsec->tx_tbl[i].used)
855 if (ipsec->tx_tbl[i].mode & IXGBE_RXTXMOD_VF &&
856 ipsec->tx_tbl[i].vf == vf)
858 ipsec->tx_tbl[i].xs);
876 struct ixgbe_ipsec *ipsec = adapter->ipsec;
945 ipsec->rx_tbl[sa_idx].vf = vf;
946 ipsec->rx_tbl[sa_idx].mode |= IXGBE_RXTXMOD_VF;
949 ipsec->tx_tbl[sa_idx].vf = vf;
950 ipsec->tx_tbl[sa_idx].mode |= IXGBE_RXTXMOD_VF;
986 struct ixgbe_ipsec *ipsec = adapter->ipsec;
1006 rsa = &ipsec->rx_tbl[sa_idx];
1017 xs = ipsec->rx_tbl[sa_idx].xs;
1028 tsa = &ipsec->tx_tbl[sa_idx];
1039 xs = ipsec->tx_tbl[sa_idx].xs;
1051 * ixgbe_ipsec_tx - setup Tx flags for ipsec offload
1054 * @itd: ipsec Tx data for later use in building context descriptor
1061 struct ixgbe_ipsec *ipsec = adapter->ipsec;
1087 tsa = &ipsec->tx_tbl[itd->sa_idx];
1138 * ixgbe_ipsec_rx - decode ipsec bits from Rx descriptor
1143 * Determine if there was an ipsec encapsulation noticed, and if so set up
1154 struct ixgbe_ipsec *ipsec = adapter->ipsec;
1195 xs = ixgbe_ipsec_find_rx_state(ipsec, daddr, proto, spi, !!ip4);
1219 struct ixgbe_ipsec *ipsec;
1236 ipsec = kzalloc(sizeof(*ipsec), GFP_KERNEL);
1237 if (!ipsec)
1239 hash_init(ipsec->rx_sa_list);
1242 ipsec->rx_tbl = kzalloc(size, GFP_KERNEL);
1243 if (!ipsec->rx_tbl)
1247 ipsec->tx_tbl = kzalloc(size, GFP_KERNEL);
1248 if (!ipsec->tx_tbl)
1252 ipsec->ip_tbl = kzalloc(size, GFP_KERNEL);
1253 if (!ipsec->ip_tbl)
1256 ipsec->num_rx_sa = 0;
1257 ipsec->num_tx_sa = 0;
1259 adapter->ipsec = ipsec;
1268 kfree(ipsec->ip_tbl);
1269 kfree(ipsec->rx_tbl);
1270 kfree(ipsec->tx_tbl);
1271 kfree(ipsec);
1277 * ixgbe_stop_ipsec_offload - tear down the ipsec offload
1282 struct ixgbe_ipsec *ipsec = adapter->ipsec;
1284 adapter->ipsec = NULL;
1285 if (ipsec) {
1286 kfree(ipsec->ip_tbl);
1287 kfree(ipsec->rx_tbl);
1288 kfree(ipsec->tx_tbl);
1289 kfree(ipsec);