net/bnxt: add Stingray support to core layer
[dpdk.git] / examples / ipsec-secgw / ipsec_worker.c
index 5fde667..647e22d 100644 (file)
@@ -112,12 +112,7 @@ check_sp(struct sp_ctx *sp, const uint8_t *nlp, uint32_t *sa_idx)
        rte_acl_classify((struct rte_acl_ctx *)sp, &nlp, &res, 1,
                        DEFAULT_MAX_CATEGORIES);
 
-       if (unlikely(res == 0)) {
-               /* No match */
-               return 0;
-       }
-
-       if (res == DISCARD)
+       if (unlikely(res == DISCARD))
                return 0;
        else if (res == BYPASS) {
                *sa_idx = -1;
@@ -213,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
                                        "Inbound security offload failed\n");
                                goto drop_pkt_and_exit;
                        }
-                       sa = pkt->userdata;
+                       sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
                }
 
                /* Check if we have a match */
@@ -231,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
                                        "Inbound security offload failed\n");
                                goto drop_pkt_and_exit;
                        }
-                       sa = pkt->userdata;
+                       sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
                }
 
                /* Check if we have a match */
@@ -362,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
        }
 
        if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
-               pkt->userdata = sess->security.ses;
+               *(struct rte_security_session **)rte_security_dynfield(pkt) =
+                               sess->security.ses;
 
        /* Mark the packet for Tx security offload */
        pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -470,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
                        }
 
                        /* Save security session */
-                       pkt->userdata = sess_tbl[port_id];
+                       if (rte_security_dynfield_is_registered())
+                               *(struct rte_security_session **)
+                                       rte_security_dynfield(pkt) =
+                                               sess_tbl[port_id];
 
                        /* Mark the packet for Tx security offload */
                        pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;