net/sfc: fence off 8 bits in Rx mark for tunnel offload
[dpdk.git] / drivers / net / dpaa2 / base / dpaa2_hw_dpni.c
index 9d15653..08f49af 100644 (file)
@@ -41,6 +41,17 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
        void *p_params;
        int ret, tc_index = 0;
 
+       if (!rte_eth_dev_is_valid_port(port_id)) {
+               DPAA2_PMD_WARN("Invalid port id %u", port_id);
+               return -EINVAL;
+       }
+
+       if (strcmp(eth_dev->device->driver->name,
+                       RTE_STR(NET_DPAA2_PMD_DRIVER_NAME))) {
+               DPAA2_PMD_WARN("Not a valid dpaa2 port");
+               return -EINVAL;
+       }
+
        p_params = rte_zmalloc(
                NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE);
        if (!p_params) {
@@ -199,13 +210,18 @@ dpaa2_distset_to_dpkg_profile_cfg(
        int l2_configured = 0, l3_configured = 0;
        int l4_configured = 0, sctp_configured = 0;
        int mpls_configured = 0;
+       int vlan_configured = 0;
+       int esp_configured = 0;
+       int ah_configured = 0;
+       int pppoe_configured = 0;
 
        memset(kg_cfg, 0, sizeof(struct dpkg_profile_cfg));
        while (req_dist_set) {
                if (req_dist_set % 2 != 0) {
-                       dist_field = 1U << loop;
+                       dist_field = 1ULL << loop;
                        switch (dist_field) {
                        case ETH_RSS_L2_PAYLOAD:
+                       case ETH_RSS_ETH:
 
                                if (l2_configured)
                                        break;
@@ -220,7 +236,70 @@ dpaa2_distset_to_dpkg_profile_cfg(
                                kg_cfg->extracts[i].extract.from_hdr.type =
                                        DPKG_FULL_FIELD;
                                i++;
-                       break;
+                               break;
+
+                       case ETH_RSS_PPPOE:
+                               if (pppoe_configured)
+                                       break;
+                               kg_cfg->extracts[i].extract.from_hdr.prot =
+                                       NET_PROT_PPPOE;
+                               kg_cfg->extracts[i].extract.from_hdr.field =
+                                       NH_FLD_PPPOE_SID;
+                               kg_cfg->extracts[i].type =
+                                       DPKG_EXTRACT_FROM_HDR;
+                               kg_cfg->extracts[i].extract.from_hdr.type =
+                                       DPKG_FULL_FIELD;
+                               i++;
+                               break;
+
+                       case ETH_RSS_ESP:
+                               if (esp_configured)
+                                       break;
+                               esp_configured = 1;
+
+                               kg_cfg->extracts[i].extract.from_hdr.prot =
+                                       NET_PROT_IPSEC_ESP;
+                               kg_cfg->extracts[i].extract.from_hdr.field =
+                                       NH_FLD_IPSEC_ESP_SPI;
+                               kg_cfg->extracts[i].type =
+                                       DPKG_EXTRACT_FROM_HDR;
+                               kg_cfg->extracts[i].extract.from_hdr.type =
+                                       DPKG_FULL_FIELD;
+                               i++;
+                               break;
+
+                       case ETH_RSS_AH:
+                               if (ah_configured)
+                                       break;
+                               ah_configured = 1;
+
+                               kg_cfg->extracts[i].extract.from_hdr.prot =
+                                       NET_PROT_IPSEC_AH;
+                               kg_cfg->extracts[i].extract.from_hdr.field =
+                                       NH_FLD_IPSEC_AH_SPI;
+                               kg_cfg->extracts[i].type =
+                                       DPKG_EXTRACT_FROM_HDR;
+                               kg_cfg->extracts[i].extract.from_hdr.type =
+                                       DPKG_FULL_FIELD;
+                               i++;
+                               break;
+
+                       case ETH_RSS_C_VLAN:
+                       case ETH_RSS_S_VLAN:
+                               if (vlan_configured)
+                                       break;
+                               vlan_configured = 1;
+
+                               kg_cfg->extracts[i].extract.from_hdr.prot =
+                                       NET_PROT_VLAN;
+                               kg_cfg->extracts[i].extract.from_hdr.field =
+                                       NH_FLD_VLAN_TCI;
+                               kg_cfg->extracts[i].type =
+                                       DPKG_EXTRACT_FROM_HDR;
+                               kg_cfg->extracts[i].extract.from_hdr.type =
+                                       DPKG_FULL_FIELD;
+                               i++;
+                               break;
 
                        case ETH_RSS_MPLS: