New upstream version 18.11-rc1
[deb_dpdk.git] / lib / librte_security / rte_security.h
index b0d1b97..1431b4d 100644 (file)
@@ -206,6 +206,64 @@ struct rte_security_macsec_xform {
        int dummy;
 };
 
+/**
+ * PDCP Mode of session
+ */
+enum rte_security_pdcp_domain {
+       RTE_SECURITY_PDCP_MODE_CONTROL, /**< PDCP control plane */
+       RTE_SECURITY_PDCP_MODE_DATA,    /**< PDCP data plane */
+};
+
+/** PDCP Frame direction */
+enum rte_security_pdcp_direction {
+       RTE_SECURITY_PDCP_UPLINK,       /**< Uplink */
+       RTE_SECURITY_PDCP_DOWNLINK,     /**< Downlink */
+};
+
+/** PDCP Sequence Number Size selectors */
+enum rte_security_pdcp_sn_size {
+       /** PDCP_SN_SIZE_5: 5bit sequence number */
+       RTE_SECURITY_PDCP_SN_SIZE_5 = 5,
+       /** PDCP_SN_SIZE_7: 7bit sequence number */
+       RTE_SECURITY_PDCP_SN_SIZE_7 = 7,
+       /** PDCP_SN_SIZE_12: 12bit sequence number */
+       RTE_SECURITY_PDCP_SN_SIZE_12 = 12,
+       /** PDCP_SN_SIZE_15: 15bit sequence number */
+       RTE_SECURITY_PDCP_SN_SIZE_15 = 15,
+       /** PDCP_SN_SIZE_18: 18bit sequence number */
+       RTE_SECURITY_PDCP_SN_SIZE_18 = 18
+};
+
+/**
+ * PDCP security association configuration data.
+ *
+ * This structure contains data required to create a PDCP security session.
+ */
+struct rte_security_pdcp_xform {
+       int8_t bearer;  /**< PDCP bearer ID */
+       /** Enable in order delivery, this field shall be set only if
+        * driver/HW is capable. See RTE_SECURITY_PDCP_ORDERING_CAP.
+        */
+       uint8_t en_ordering;
+       /** Notify driver/HW to detect and remove duplicate packets.
+        * This field should be set only when driver/hw is capable.
+        * See RTE_SECURITY_PDCP_DUP_DETECT_CAP.
+        */
+       uint8_t remove_duplicates;
+       /** PDCP mode of operation: Control or data */
+       enum rte_security_pdcp_domain domain;
+       /** PDCP Frame Direction 0:UL 1:DL */
+       enum rte_security_pdcp_direction pkt_dir;
+       /** Sequence number size, 5/7/12/15/18 */
+       enum rte_security_pdcp_sn_size sn_size;
+       /** Starting Hyper Frame Number to be used together with the SN
+        * from the PDCP frames
+        */
+       uint32_t hfn;
+       /** HFN Threshold for key renegotiation */
+       uint32_t hfn_threshold;
+};
+
 /**
  * Security session action type.
  */
@@ -232,6 +290,8 @@ enum rte_security_session_protocol {
        /**< IPsec Protocol */
        RTE_SECURITY_PROTOCOL_MACSEC,
        /**< MACSec Protocol */
+       RTE_SECURITY_PROTOCOL_PDCP,
+       /**< PDCP Protocol */
 };
 
 /**
@@ -246,6 +306,7 @@ struct rte_security_session_conf {
        union {
                struct rte_security_ipsec_xform ipsec;
                struct rte_security_macsec_xform macsec;
+               struct rte_security_pdcp_xform pdcp;
        };
        /**< Configuration parameters for security session */
        struct rte_crypto_sym_xform *crypto_xform;
@@ -413,6 +474,10 @@ struct rte_security_ipsec_stats {
 
 };
 
+struct rte_security_pdcp_stats {
+       uint64_t reserved;
+};
+
 struct rte_security_stats {
        enum rte_security_session_protocol protocol;
        /**< Security protocol to be configured */
@@ -421,6 +486,7 @@ struct rte_security_stats {
        union {
                struct rte_security_macsec_stats macsec;
                struct rte_security_ipsec_stats ipsec;
+               struct rte_security_pdcp_stats pdcp;
        };
 };
 
@@ -465,6 +531,13 @@ struct rte_security_capability {
                        int dummy;
                } macsec;
                /**< MACsec capability */
+               struct {
+                       enum rte_security_pdcp_domain domain;
+                       /**< PDCP mode of operation: Control or data */
+                       uint32_t capa_flags;
+                       /**< Capabilitity flags, see RTE_SECURITY_PDCP_* */
+               } pdcp;
+               /**< PDCP capability */
        };
 
        const struct rte_cryptodev_capabilities *crypto_capabilities;
@@ -474,6 +547,19 @@ struct rte_security_capability {
        /**< Device offload flags */
 };
 
+/** Underlying Hardware/driver which support PDCP may or may not support
+ * packet ordering. Set RTE_SECURITY_PDCP_ORDERING_CAP if it support.
+ * If it is not set, driver/HW assumes packets received are in order
+ * and it will be application's responsibility to maintain ordering.
+ */
+#define RTE_SECURITY_PDCP_ORDERING_CAP         0x00000001
+
+/** Underlying Hardware/driver which support PDCP may or may not detect
+ * duplicate packet. Set RTE_SECURITY_PDCP_DUP_DETECT_CAP if it support.
+ * If it is not set, driver/HW assumes there is no duplicate packet received.
+ */
+#define RTE_SECURITY_PDCP_DUP_DETECT_CAP       0x00000002
+
 #define RTE_SECURITY_TX_OLOAD_NEED_MDATA       0x00000001
 /**< HW needs metadata update, see rte_security_set_pkt_metadata().
  */
@@ -506,6 +592,10 @@ struct rte_security_capability_idx {
                        enum rte_security_ipsec_sa_mode mode;
                        enum rte_security_ipsec_sa_direction direction;
                } ipsec;
+               struct {
+                       enum rte_security_pdcp_domain domain;
+                       uint32_t capa_flags;
+               } pdcp;
        };
 };