net/iavf: enable Rx timestamp on flex descriptor
[dpdk.git] / drivers / net / iavf / iavf_ipsec_crypto.c
index 6ac1b21..b1949ce 100644 (file)
@@ -614,7 +614,7 @@ set_session_parameter(struct iavf_security_ctx *iavf_sctx,
                if (conf->crypto_xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC) {
                        sess->block_sz = get_auth_blocksize(iavf_sctx,
                                conf->crypto_xform->auth.algo);
-                       sess->iv_sz = conf->crypto_xform->auth.iv.length;
+                       sess->iv_sz = sizeof(uint64_t); /* iv len inc. salt */
                        sess->icv_sz = conf->crypto_xform->auth.digest_length;
                } else {
                        sess->block_sz = get_cipher_blocksize(iavf_sctx,
@@ -736,7 +736,9 @@ iavf_ipsec_crypto_inbound_security_policy_add(struct iavf_adapter *adapter,
        uint8_t is_v4,
        rte_be32_t v4_dst_addr,
        uint8_t *v6_dst_addr,
-       uint8_t drop)
+       uint8_t drop,
+       bool is_udp,
+       uint16_t udp_port)
 {
        struct inline_ipsec_msg *request = NULL, *response = NULL;
        size_t request_len, response_len;
@@ -781,6 +783,8 @@ iavf_ipsec_crypto_inbound_security_policy_add(struct iavf_adapter *adapter,
        /** Traffic Class/Congestion Domain currently not support */
        request->ipsec_data.sp_cfg->set_tc = 0;
        request->ipsec_data.sp_cfg->cgd = 0;
+       request->ipsec_data.sp_cfg->is_udp = is_udp;
+       request->ipsec_data.sp_cfg->udp_port = htons(udp_port);
 
        response_len = sizeof(struct inline_ipsec_msg) +
                        sizeof(struct virtchnl_ipsec_sp_cfg_resp);
@@ -1553,8 +1557,8 @@ iavf_security_ctx_destroy(struct iavf_adapter *adapter)
        rte_free(iavf_sctx);
        rte_free(sctx);
 
-       iavf_sctx = NULL;
-       sctx = NULL;
+       adapter->security_ctx = NULL;
+       adapter->vf.eth_dev->security_ctx = NULL;
 
        return 0;
 }
@@ -1625,6 +1629,7 @@ struct iavf_ipsec_flow_item {
                struct rte_ipv6_hdr ipv6_hdr;
        };
        struct rte_udp_hdr udp_hdr;
+       uint8_t is_udp;
 };
 
 static void
@@ -1737,6 +1742,7 @@ iavf_ipsec_flow_item_parse(struct rte_eth_dev *ethdev,
                parse_udp_item((const struct rte_flow_item_udp *)
                                pattern[2].spec,
                        &ipsec_flow->udp_hdr);
+               ipsec_flow->is_udp = true;
                ipsec_flow->spi =
                        ((const struct rte_flow_item_esp *)
                                        pattern[3].spec)->hdr.spi;
@@ -1806,7 +1812,9 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad,
                        1,
                        ipsec_flow->ipv4_hdr.dst_addr,
                        NULL,
-                       0);
+                       0,
+                       ipsec_flow->is_udp,
+                       ipsec_flow->udp_hdr.dst_port);
        } else {
                ipsec_flow->id =
                        iavf_ipsec_crypto_inbound_security_policy_add(ad,
@@ -1814,7 +1822,9 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad,
                        0,
                        0,
                        ipsec_flow->ipv6_hdr.dst_addr,
-                       0);
+                       0,
+                       ipsec_flow->is_udp,
+                       ipsec_flow->udp_hdr.dst_port);
        }
 
        if (ipsec_flow->id < 1) {