[dpdk-dev] [PATCH] net/i40e: fix flow does not effect on uncustomed pctype

2021-04-15 Thread Murphy Yang
Uncustomed flow rule does not effect, the root cause is not write
the configure in register.

Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_fdir.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index da089baa4d..77375b059a 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1607,8 +1607,10 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 
/* Check if the configuration is conflicted */
if (pf->fdir.inset_flag[pctype] &&
-   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
-   return -1;
+   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
+   PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
+   return -EINVAL;
+   }
 
if (pf->fdir.inset_flag[pctype] &&
!memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
@@ -1762,18 +1764,14 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
i40e_fdir_filter_convert(filter, &check_filter);
 
if (add) {
-   if (filter->input.flow_ext.is_flex_flow) {
+   if (!filter->input.flow_ext.customized_pctype) {
ret = i40e_flow_set_fdir_inset(pf, pctype,
filter->input.flow_ext.input_set);
-   if (ret == -1) {
-   PMD_DRV_LOG(ERR, "Conflict with the"
-   " first rule's input set.");
-   return -EINVAL;
-   } else if (ret == -EINVAL) {
-   PMD_DRV_LOG(ERR, "Invalid pattern mask.");
-   return -EINVAL;
-   }
+   if (ret)
+   return ret;
+   }
 
+   if (filter->input.flow_ext.is_flex_flow) {
for (i = 0; i < filter->input.flow_ext.raw_id; i++) {
layer_idx = filter->input.flow_ext.layer_idx;
field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + 
i;
-- 
2.17.1



[dpdk-dev] [PATCH v2] net/i40e: fix FDIR issue for common PCTYPEs

2021-04-20 Thread Murphy Yang
Currently, FDIR doesn't work for all common PCTYPEs, the root cause is
that input set is not configured.

Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Signed-off-by: Murphy Yang 
---
v2:
- tune the code and modify commit message
 drivers/net/i40e/i40e_fdir.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index da089baa4d..6b81e09db5 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1607,8 +1607,10 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 
/* Check if the configuration is conflicted */
if (pf->fdir.inset_flag[pctype] &&
-   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
-   return -1;
+   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
+   PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
+   return -EINVAL;
+   }
 
if (pf->fdir.inset_flag[pctype] &&
!memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
@@ -1762,18 +1764,21 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
i40e_fdir_filter_convert(filter, &check_filter);
 
if (add) {
-   if (filter->input.flow_ext.is_flex_flow) {
+   /* configure the input set for common PCTYPEs*/
+   if (!filter->input.flow_ext.customized_pctype) {
ret = i40e_flow_set_fdir_inset(pf, pctype,
filter->input.flow_ext.input_set);
if (ret == -1) {
PMD_DRV_LOG(ERR, "Conflict with the"
-   " first rule's input set.");
+   " first rule's input set.");
return -EINVAL;
} else if (ret == -EINVAL) {
PMD_DRV_LOG(ERR, "Invalid pattern mask.");
return -EINVAL;
}
+   }
 
+   if (filter->input.flow_ext.is_flex_flow) {
for (i = 0; i < filter->input.flow_ext.raw_id; i++) {
layer_idx = filter->input.flow_ext.layer_idx;
field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + 
i;
-- 
2.17.1



[dpdk-dev] [PATCH v3] net/i40e: fix FDIR issue for common PCTYPEs

2021-04-20 Thread Murphy Yang
Currently, FDIR doesn't work for all common PCTYPEs, the root cause is
that input set is not configured.

Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_fdir.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index da089baa4d..ed1c60af99 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1607,8 +1607,10 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 
/* Check if the configuration is conflicted */
if (pf->fdir.inset_flag[pctype] &&
-   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
-   return -1;
+   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
+   PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
+   return -EINVAL;
+   }
 
if (pf->fdir.inset_flag[pctype] &&
!memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
@@ -1616,8 +1618,10 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 
num = i40e_generate_inset_mask_reg(hw, input_set, mask_reg,
 I40E_INSET_MASK_NUM_REG);
-   if (num < 0)
+   if (num < 0) {
+   PMD_DRV_LOG(ERR, "Invalid pattern mask.");
return -EINVAL;
+   }
 
if (pf->support_multi_driver) {
for (i = 0; i < num; i++)
@@ -1762,18 +1766,15 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
i40e_fdir_filter_convert(filter, &check_filter);
 
if (add) {
-   if (filter->input.flow_ext.is_flex_flow) {
+   /* configure the input set for common PCTYPEs*/
+   if (!filter->input.flow_ext.customized_pctype) {
ret = i40e_flow_set_fdir_inset(pf, pctype,
filter->input.flow_ext.input_set);
-   if (ret == -1) {
-   PMD_DRV_LOG(ERR, "Conflict with the"
-   " first rule's input set.");
-   return -EINVAL;
-   } else if (ret == -EINVAL) {
-   PMD_DRV_LOG(ERR, "Invalid pattern mask.");
-   return -EINVAL;
-   }
+   if (ret < 0)
+   return ret;
+   }
 
+   if (filter->input.flow_ext.is_flex_flow) {
for (i = 0; i < filter->input.flow_ext.raw_id; i++) {
layer_idx = filter->input.flow_ext.layer_idx;
field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + 
i;
-- 
2.17.1



[dpdk-dev] [PATCH v2] net/i40e: fix inappropriate config during flow validate

2021-03-31 Thread Murphy Yang
The configuration of FDIR input set should not be set
during flow validate. It should be set when flow create.

Fixes: fe5d0e85b713 ("net/i40e: fix flow director flex configuration")
Fixes: 15018d79f0be ("net/i40e: add FDIR support for GTP-C and GTP-U")

Signed-off-by: Murphy Yang 
---
v2:
- fix merge conflict

 drivers/net/i40e/i40e_ethdev.h |  1 +
 drivers/net/i40e/i40e_fdir.c   | 88 +++
 drivers/net/i40e/i40e_flow.c   | 94 +++---
 3 files changed, 96 insertions(+), 87 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index faf6896fbc..cdf1c2fe1f 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -631,6 +631,7 @@ struct i40e_fdir_flow_ext {
uint8_t raw_id;
uint8_t is_vf;   /* 1 for VF, 0 for port dev */
uint16_t dst_id; /* VF ID, available when is_vf is 1*/
+   uint64_t input_set;
bool inner_ip;   /* If there is inner ip */
enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index c572d003cb..da089baa4d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1588,6 +1588,83 @@ i40e_flow_set_fdir_flex_msk(struct i40e_pf *pf,
pf->fdir.flex_mask_flag[pctype] = 1;
 }
 
+static int
+i40e_flow_set_fdir_inset(struct i40e_pf *pf,
+enum i40e_filter_pctype pctype,
+uint64_t input_set)
+{
+   uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
+   struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+   uint64_t inset_reg = 0;
+   int i, num;
+
+   /* Check if the input set is valid */
+   if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
+   input_set) != 0) {
+   PMD_DRV_LOG(ERR, "Invalid input set");
+   return -EINVAL;
+   }
+
+   /* Check if the configuration is conflicted */
+   if (pf->fdir.inset_flag[pctype] &&
+   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
+   return -1;
+
+   if (pf->fdir.inset_flag[pctype] &&
+   !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
+   return 0;
+
+   num = i40e_generate_inset_mask_reg(hw, input_set, mask_reg,
+I40E_INSET_MASK_NUM_REG);
+   if (num < 0)
+   return -EINVAL;
+
+   if (pf->support_multi_driver) {
+   for (i = 0; i < num; i++)
+   if (i40e_read_rx_ctl(hw,
+   I40E_GLQF_FD_MSK(i, pctype)) !=
+   mask_reg[i]) {
+   PMD_DRV_LOG(ERR, "Input set setting is not"
+   " supported with"
+   " `support-multi-driver`"
+   " enabled!");
+   return -EPERM;
+   }
+   for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
+   if (i40e_read_rx_ctl(hw,
+   I40E_GLQF_FD_MSK(i, pctype)) != 0) {
+   PMD_DRV_LOG(ERR, "Input set setting is not"
+   " supported with"
+   " `support-multi-driver`"
+   " enabled!");
+   return -EPERM;
+   }
+
+   } else {
+   for (i = 0; i < num; i++)
+   i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
+   mask_reg[i]);
+   /*clear unused mask registers of the pctype */
+   for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
+   i40e_check_write_reg(hw,
+   I40E_GLQF_FD_MSK(i, pctype), 0);
+   }
+
+   inset_reg |= i40e_translate_input_set_reg(hw->mac.type, input_set);
+
+   i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
+(uint32_t)(inset_reg & UINT32_MAX));
+   i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 1),
+(uint32_t)((inset_reg >>
+I40E_32_BIT_WIDTH) & UINT32_MAX));
+
+   I40E_WRITE_FLUSH(hw);
+
+   pf->fdir.input_set[pctype] = input_set;
+   pf->fdir.inset_flag[pctype] = 1;
+   return 0;
+}
+
 static inline unsigned char *
 i40e_find_a

[dpdk-dev] [PATCH] net/i40e: fix mbuf fast free wrong check

2021-04-06 Thread Murphy Yang
If no offload flags are set, then 0 == 0 &  is true.
This means that if DEV_TX_OFFLOAD_MBUF_FAST_FREE is not
set (and no other flags are set) then this check will still
enable `tx_simple_allowed`.

This patch adds the 'offloads' flag not equal zero to avoid this
scenario.

Bugzilla ID: 665
Fixes: 399421100e08 ("net/i40e: fix missing mbuf fast free offload")

Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index b3d7765e3b..1450b228ca 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3345,7 +3345,7 @@ i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct 
i40e_tx_queue *txq)
 
/* Use a simple Tx queue if possible (only fast free is allowed) */
ad->tx_simple_allowed =
-   (txq->offloads ==
+   (txq->offloads != 0 && txq->offloads ==
 (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) &&
 txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST);
ad->tx_vec_allowed = (ad->tx_simple_allowed &&
-- 
2.17.1



[dpdk-dev] [RFC] net/i40e: change the timing of FDIR input set configuration

2021-03-15 Thread Murphy Yang
The configuration of FDIR input set should not be set
during flow validate. It should be set when flow create.

Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_ethdev.h |  1 +
 drivers/net/i40e/i40e_fdir.c   | 88 +++
 drivers/net/i40e/i40e_flow.c   | 95 +++---
 3 files changed, 96 insertions(+), 88 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 1e8f5d3a87..c6ec071f44 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -631,6 +631,7 @@ struct i40e_fdir_flow_ext {
uint8_t raw_id;
uint8_t is_vf;   /* 1 for VF, 0 for port dev */
uint16_t dst_id; /* VF ID, available when is_vf is 1*/
+   uint64_t input_set;
bool inner_ip;   /* If there is inner ip */
enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index c572d003cb..af0c00de04 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1588,6 +1588,83 @@ i40e_flow_set_fdir_flex_msk(struct i40e_pf *pf,
pf->fdir.flex_mask_flag[pctype] = 1;
 }
 
+static int
+i40e_flow_set_fdir_inset(struct i40e_pf *pf,
+enum i40e_filter_pctype pctype,
+uint64_t input_set)
+{
+   uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
+   struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+   uint64_t inset_reg = 0;
+   int i, num;
+
+   /* Check if the input set is valid */
+   if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
+   input_set) != 0) {
+   PMD_DRV_LOG(ERR, "Invalid input set");
+   return -EINVAL;
+   }
+
+   /* Check if the configuration is conflicted */
+   if (pf->fdir.inset_flag[pctype] &&
+   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
+   return -1;
+
+   if (pf->fdir.inset_flag[pctype] &&
+   !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
+   return 0;
+
+   num = i40e_generate_inset_mask_reg(input_set, mask_reg,
+  I40E_INSET_MASK_NUM_REG);
+   if (num < 0)
+   return -EINVAL;
+
+   if (pf->support_multi_driver) {
+   for (i = 0; i < num; i++)
+   if (i40e_read_rx_ctl(hw,
+   I40E_GLQF_FD_MSK(i, pctype)) !=
+   mask_reg[i]) {
+   PMD_DRV_LOG(ERR, "Input set setting is not"
+   " supported with"
+   " `support-multi-driver`"
+   " enabled!");
+   return -EPERM;
+   }
+   for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
+   if (i40e_read_rx_ctl(hw,
+   I40E_GLQF_FD_MSK(i, pctype)) != 0) {
+   PMD_DRV_LOG(ERR, "Input set setting is not"
+   " supported with"
+   " `support-multi-driver`"
+   " enabled!");
+   return -EPERM;
+   }
+
+   } else {
+   for (i = 0; i < num; i++)
+   i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
+   mask_reg[i]);
+   /*clear unused mask registers of the pctype */
+   for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
+   i40e_check_write_reg(hw,
+   I40E_GLQF_FD_MSK(i, pctype), 0);
+   }
+
+   inset_reg |= i40e_translate_input_set_reg(hw->mac.type, input_set);
+
+   i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
+(uint32_t)(inset_reg & UINT32_MAX));
+   i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 1),
+(uint32_t)((inset_reg >>
+I40E_32_BIT_WIDTH) & UINT32_MAX));
+
+   I40E_WRITE_FLUSH(hw);
+
+   pf->fdir.input_set[pctype] = input_set;
+   pf->fdir.inset_flag[pctype] = 1;
+   return 0;
+}
+
 static inline unsigned char *
 i40e_find_available_buffer(struct rte_eth_dev *dev)
 {
@@ -1686,6 +1763,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
 
if (add) {
if (filter->input.flow_ext.is_flex_flow) 

[dpdk-dev] [PATCH] net/i40e: fix inappropriate config during flow validate

2021-03-18 Thread Murphy Yang
The configuration of FDIR input set should not be set
during flow validate. It should be set when flow create.

Fixes: fe5d0e85b713 ("net/i40e: fix flow director flex configuration")
Fixes: 15018d79f0be ("net/i40e: add FDIR support for GTP-C and GTP-U")

Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_ethdev.h |  1 +
 drivers/net/i40e/i40e_fdir.c   | 88 +++
 drivers/net/i40e/i40e_flow.c   | 95 +++---
 3 files changed, 96 insertions(+), 88 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 1e8f5d3a87..c6ec071f44 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -631,6 +631,7 @@ struct i40e_fdir_flow_ext {
uint8_t raw_id;
uint8_t is_vf;   /* 1 for VF, 0 for port dev */
uint16_t dst_id; /* VF ID, available when is_vf is 1*/
+   uint64_t input_set;
bool inner_ip;   /* If there is inner ip */
enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index c572d003cb..af0c00de04 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1588,6 +1588,83 @@ i40e_flow_set_fdir_flex_msk(struct i40e_pf *pf,
pf->fdir.flex_mask_flag[pctype] = 1;
 }
 
+static int
+i40e_flow_set_fdir_inset(struct i40e_pf *pf,
+enum i40e_filter_pctype pctype,
+uint64_t input_set)
+{
+   uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
+   struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+   uint64_t inset_reg = 0;
+   int i, num;
+
+   /* Check if the input set is valid */
+   if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
+   input_set) != 0) {
+   PMD_DRV_LOG(ERR, "Invalid input set");
+   return -EINVAL;
+   }
+
+   /* Check if the configuration is conflicted */
+   if (pf->fdir.inset_flag[pctype] &&
+   memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
+   return -1;
+
+   if (pf->fdir.inset_flag[pctype] &&
+   !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
+   return 0;
+
+   num = i40e_generate_inset_mask_reg(input_set, mask_reg,
+  I40E_INSET_MASK_NUM_REG);
+   if (num < 0)
+   return -EINVAL;
+
+   if (pf->support_multi_driver) {
+   for (i = 0; i < num; i++)
+   if (i40e_read_rx_ctl(hw,
+   I40E_GLQF_FD_MSK(i, pctype)) !=
+   mask_reg[i]) {
+   PMD_DRV_LOG(ERR, "Input set setting is not"
+   " supported with"
+   " `support-multi-driver`"
+   " enabled!");
+   return -EPERM;
+   }
+   for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
+   if (i40e_read_rx_ctl(hw,
+   I40E_GLQF_FD_MSK(i, pctype)) != 0) {
+   PMD_DRV_LOG(ERR, "Input set setting is not"
+   " supported with"
+   " `support-multi-driver`"
+   " enabled!");
+   return -EPERM;
+   }
+
+   } else {
+   for (i = 0; i < num; i++)
+   i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
+   mask_reg[i]);
+   /*clear unused mask registers of the pctype */
+   for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
+   i40e_check_write_reg(hw,
+   I40E_GLQF_FD_MSK(i, pctype), 0);
+   }
+
+   inset_reg |= i40e_translate_input_set_reg(hw->mac.type, input_set);
+
+   i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
+(uint32_t)(inset_reg & UINT32_MAX));
+   i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 1),
+(uint32_t)((inset_reg >>
+I40E_32_BIT_WIDTH) & UINT32_MAX));
+
+   I40E_WRITE_FLUSH(hw);
+
+   pf->fdir.input_set[pctype] = input_set;
+   pf->fdir.inset_flag[pctype] = 1;
+   return 0;
+}
+
 static inline unsigned char *
 i40e_find_available_buffer(struct rte_eth_dev *dev)
 {
@@ -1686,6 +1763,

[dpdk-dev] [PATCH] net/ixgbe: fix RSS RETA be reset after port start

2021-03-29 Thread Murphy Yang
If one calls ‘rte_eth_dev_rss_reta_update’ with ixgbe before starting
the device (but after setting everything else), then RSS RETA
configuration be zero after starting the device.

This patch gives a notification if the port not started.

Bugzilla ID: 664
Fixes: 249358424eab ("ixgbe: RSS RETA configuration")

Signed-off-by: Murphy Yang 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 8a9a21e7c2..41068fe646 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5015,11 +5015,19 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
uint32_t reta, r;
uint16_t idx, shift;
struct ixgbe_adapter *adapter = dev->data->dev_private;
+   struct rte_eth_dev_data *dev_data = dev->data;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reta_reg;
 
PMD_INIT_FUNC_TRACE();
 
+   if (!dev_data->dev_started) {
+   PMD_DRV_LOG(ERR,
+   "port %d must be started before configuration",
+dev_data->port_id);
+   return -EBUSY;
+   }
+
if (!ixgbe_rss_update_sp(hw->mac.type)) {
PMD_DRV_LOG(ERR, "RSS reta update is not supported on this "
"NIC.");
-- 
2.17.1



[dpdk-dev] [PATCH v2] net/ixgbe: fix RSS RETA be reset after port start

2021-03-29 Thread Murphy Yang
If one calls ‘rte_eth_dev_rss_reta_update’ with ixgbe before starting
the device (but after setting everything else), then RSS RETA
configuration be zero after starting the device.

This patch gives a notification if the port not started.

Bugzilla ID: 664
Fixes: 249358424eab ("ixgbe: RSS RETA configuration")

Signed-off-by: Murphy Yang 
---
v2:
- tune the return value

 drivers/net/ixgbe/ixgbe_ethdev.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 8a9a21e7c2..6aebf9c11e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5015,11 +5015,19 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
uint32_t reta, r;
uint16_t idx, shift;
struct ixgbe_adapter *adapter = dev->data->dev_private;
+   struct rte_eth_dev_data *dev_data = dev->data;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reta_reg;
 
PMD_INIT_FUNC_TRACE();
 
+   if (!dev_data->dev_started) {
+   PMD_DRV_LOG(ERR,
+   "port %d must be started before configuration",
+dev_data->port_id);
+   return -EIO;
+   }
+
if (!ixgbe_rss_update_sp(hw->mac.type)) {
PMD_DRV_LOG(ERR, "RSS reta update is not supported on this "
"NIC.");
-- 
2.17.1



[dpdk-dev] [PATCH v3] net/ixgbe: fix RSS RETA be reset after port start

2021-03-29 Thread Murphy Yang
If one calls ‘rte_eth_dev_rss_reta_update’ with ixgbe before starting
the device (but after setting everything else), then RSS RETA
configuration be zero after starting the device.

This patch gives a notification if the port not started.

Bugzilla ID: 664
Fixes: 249358424eab ("ixgbe: RSS RETA configuration")

Signed-off-by: Murphy Yang 
---
v3:
- modify the notify message
v2:
- tune the return value
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 8a9a21e7c2..d8ef618e5f 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5015,11 +5015,19 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
uint32_t reta, r;
uint16_t idx, shift;
struct ixgbe_adapter *adapter = dev->data->dev_private;
+   struct rte_eth_dev_data *dev_data = dev->data;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reta_reg;
 
PMD_INIT_FUNC_TRACE();
 
+   if (!dev_data->dev_started) {
+   PMD_DRV_LOG(ERR,
+   "port %d must be started before rss reta update",
+dev_data->port_id);
+   return -EIO;
+   }
+
if (!ixgbe_rss_update_sp(hw->mac.type)) {
PMD_DRV_LOG(ERR, "RSS reta update is not supported on this "
"NIC.");
-- 
2.17.1



[dpdk-dev] [PATCH v3] net/ice: fix outher chksum on cvl unknown

2020-10-26 Thread Murphy Yang
From: murphy 

When set 'csum set outer-udp hw 0' ,support for
ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S,mark the packet
PKT_RX_OUTER_L4_CKSUM_BAD or PKT_RX_OUTER_L4_CKSUM_GOOD.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: murphy 

v2:
- cover vector path

v3:
- add PKT_RX_OUTER_L4_CKSUM_GOOD in vector path.
- rename some variable name.

---
 drivers/net/ice/ice_rxtx.c  |   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c | 117 
 drivers/net/ice/ice_rxtx_vec_sse.c  |  75 +-
 3 files changed, 144 insertions(+), 53 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 93a0ac691..e74741732 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1424,6 +1424,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index 5969a3048..edf681113 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,86 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+

[dpdk-dev] [PATCH] net/ice: fix outher chksum on cvl unknown

2020-11-02 Thread Murphy Yang
Currently, driver does not supports parse UDP outer checksum flag of
tunneled packets.

When execute 'csum set outer-udp hw 0' and 'csum parse-tunnel on 0'
commands to enable hardware UDP outer checksum. This patch supports
parse UDP outer checksum flag of tunneled packets.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: Murphy Yang 
---
 drivers/net/ice/ice_rxtx.c|   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 117 +++---
 drivers/net/ice/ice_rxtx_vec_avx512.c | 116 ++---
 drivers/net/ice/ice_rxtx_vec_sse.c|  75 -
 4 files changed, 228 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..24a7caeb98 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1451,6 +1451,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index b72a9e7025..80a17c450a 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,86 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX

[dpdk-dev] [PATCH v4] net/ice: fix outher chksum on cvl unknown

2020-11-02 Thread Murphy Yang
Currently, driver does not supports parse UDP outer checksum flag of
tunneled packets.

When execute 'csum set outer-udp hw 0' and 'csum parse-tunnel on 0'
commands to enable hardware UDP outer checksum. This patch supports
parse UDP outer checksum flag of tunneled packets.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: Murphy Yang 
---
v4:
- cover AVX512 vector path.
v3:
- add PKT_RX_OUTER_L4_CKSUM_GOOD in AVX2 and SSE vector path.
- rename some variable name.
v2:
- cover AVX2 and SSE vector path

 drivers/net/ice/ice_rxtx.c|   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 117 +++---
 drivers/net/ice/ice_rxtx_vec_avx512.c | 116 ++---
 drivers/net/ice/ice_rxtx_vec_sse.c|  75 -
 4 files changed, 228 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..24a7caeb98 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1451,6 +1451,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index b72a9e7025..80a17c450a 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,86 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOO

[dpdk-dev] [PATCH v2] net/iavf: fix negative GTP-U flow rules create successfully

2020-12-17 Thread Murphy Yang
Currently, when use 'flow' command to create a negative GTP-U rule, it
will be created successfully.

The list shows the impacted outer and inner 'ipv4' GTP-U patterns with
'ipv4' or 'gtpu' type:
 - iavf_pattern_eth_ipv4_gtpu_ipv4_udp
 - iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp
 - iavf_pattern_eth_ipv4_gtpu_ipv4_tcp
 - iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp
 - more impacted patterns with 'gtpu' type:
   > iavf_pattern_eth_ipv4_gtpu_ipv4
   > iavf_pattern_eth_ipv4_gtpu_eh_ipv4

Same as the outer and inner 'ipv6' GTP-U patterns.

So, this commit adds the invalid RSS combinations in 'invalid_rss_comb'
array to make result correct.

The list of added invalid RSS combinations:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v2:
- add invalid RSS combinations

 drivers/net/iavf/iavf_hash.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..8393d8535b 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
-- 
2.17.1



[dpdk-dev] [PATCH v3] net/iavf: fix invalid RSS combinations rule can be created

2020-12-22 Thread Murphy Yang
Currently, when use 'flow' command to create a rule that combine with
several RSS types, even the RSS type combination is invalid, it also
be created successfully.

Here list some invalid RSS combinations:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP

So, this patch adds these combinations in 'invalid_rss_comb'
array to do valid check, if the combination check failed,
the rule will be created unsuccessful.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..8393d8535b 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP,
+   ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
-- 
2.17.1



[dpdk-dev] [PATCH v4] net/iavf: fix invalid RSS combinations rule can be created

2020-12-23 Thread Murphy Yang
Currently, when use 'flow' command to create a rule that combine with
several RSS types, even the RSS type combination is invalid, it also
be created successfully.

Here list some invalid RSS combinations:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

So, this patch adds these combinations in 'invalid_rss_comb'
array to do valid check, if the combination check failed,
the rule will be created unsuccessful.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX'
v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..3ed72f6475 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+   ETH_RSS_GTPU | ETH_RSS_IPV4,
+   ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
+   ETH_RSS_GTPU | ETH_RSS_IPV6,
+   ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
-- 
2.17.1



[dpdk-dev] [PATCH v5] net/iavf: fix invalid RSS combinations rule can be created

2020-12-23 Thread Murphy Yang
Currently, when use 'flow' command to create a rule that combine with
several RSS types, even the RSS type combination is invalid, it also
be created successfully.

Here list some invalid RSS combinations:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

For 'ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP' (same as IPV6), this
pathch adds these combinations in 'invalid_rss_comb' array to do
valid check, if the combination check failed, the rule will be created
unsuccessful.

For other 'ETH_RSS_GTPU' invalid combinations, this patch removes
the 'ETH_RSS_GTPU' from the input set mask, if the combination is
invalid, the 'rss_type' check will be failed, the rule will be created
unsuccessful.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v5:
- remove 'ETH_RSS_GTPU' from input set mask.
v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX'
v3:
- update the comments.
v2:
- add invalid RSS combinations.
 drivers/net/iavf/iavf_hash.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..916d6c5dfa 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -341,19 +341,13 @@ struct virtchnl_proto_hdrs ipv6_udp_gtpc_tmplt = {
 #define IAVF_RSS_TYPE_INNER_IPV6_SCTP  (ETH_RSS_IPV6 | \
 ETH_RSS_NONFRAG_IPV6_SCTP)
 /* GTPU IPv4 */
-#define IAVF_RSS_TYPE_GTPU_IPV4(IAVF_RSS_TYPE_INNER_IPV4 | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_UDP(IAVF_RSS_TYPE_INNER_IPV4_UDP | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_TCP(IAVF_RSS_TYPE_INNER_IPV4_TCP | \
-ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV4IAVF_RSS_TYPE_INNER_IPV4
+#define IAVF_RSS_TYPE_GTPU_IPV4_UDPIAVF_RSS_TYPE_INNER_IPV4_UDP
+#define IAVF_RSS_TYPE_GTPU_IPV4_TCPIAVF_RSS_TYPE_INNER_IPV4_TCP
 /* GTPU IPv6 */
-#define IAVF_RSS_TYPE_GTPU_IPV6(IAVF_RSS_TYPE_INNER_IPV6 | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_UDP(IAVF_RSS_TYPE_INNER_IPV6_UDP | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_TCP(IAVF_RSS_TYPE_INNER_IPV6_TCP | \
-ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV6IAVF_RSS_TYPE_INNER_IPV6
+#define IAVF_RSS_TYPE_GTPU_IPV6_UDPIAVF_RSS_TYPE_INNER_IPV6_UDP
+#define IAVF_RSS_TYPE_GTPU_IPV6_TCPIAVF_RSS_TYPE_INNER_IPV6_TCP
 /* ESP, AH, L2TPV3 and PFCP */
 #define IAVF_RSS_TYPE_IPV4_ESP (ETH_RSS_ESP | ETH_RSS_IPV4)
 #define IAVF_RSS_TYPE_IPV4_AH  (ETH_RSS_AH | ETH_RSS_IPV4)
@@ -806,7 +800,9 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
-- 
2.17.1



[dpdk-dev] [PATCH v6] net/iavf: fix invalid RSS combinations rule can be created

2020-12-27 Thread Murphy Yang
Currently, when use 'flow' command to create a rule that combine with
several RSS types, even the RSS type combination is invalid or unsupported,
it also be created successfully.

Here list some invalid RSS combinations:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

Here list some currently unsupported RSS combinations:
 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

For invalid RSS combinations, this
patch adds these combinations in 'invalid_rss_comb' array to do
valid check, if the combination check failed, the rule will be created
unsuccessful.

For unsupported RSS combinations, this patch adds these combinations in
'unsupported_rss_comb' array to do valid check, if the combination check
failed, the rule will be created unsuccessful.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v6:
- add unsupported RSS combinations array.
v5:
- remove 'ETH_RSS_GTPU' from input set mask.
v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX'
v3:
- update the comments.
v2:
- add invalid RSS combinations.
 drivers/net/iavf/iavf_hash.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..0061eb6652 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -806,12 +806,23 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
 };
 
+static uint64_t unsupported_rss_comb[] = {
+   ETH_RSS_GTPU | ETH_RSS_IPV4,
+   ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
+   ETH_RSS_GTPU | ETH_RSS_IPV6,
+   ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
+};
+
 struct rss_attr_type {
uint64_t attr;
uint64_t type;
@@ -875,6 +886,13 @@ iavf_any_invalid_rss_type(enum rte_eth_hash_function 
rss_func,
return true;
}
 
+   /* check unsupported rss combination */
+   for (i = 0; i < RTE_DIM(unsupported_rss_comb); i++) {
+   if (__builtin_popcountll(rss_type &
+   unsupported_rss_comb[i]) > 1)
+   return true;
+   }
+
/* check invalid RSS attribute */
for (i = 0; i < RTE_DIM(rss_attr_to_valid_type); i++) {
struct rss_attr_type *rat = &rss_attr_to_valid_type[i];
-- 
2.17.1



[dpdk-dev] [PATCH v7] net/iavf: fix invalid RSS combinations rule can be created

2021-01-07 Thread Murphy Yang
Currently, when use 'flow' command to create a rule that combine with
several RSS types, even the RSS type combination is invalid, it also
be created successfully.

Here list some invalid RSS combinations:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

For 'ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP' (same as IPV6), this
pathch adds these combinations in 'invalid_rss_comb' array to do
valid check, if the combination check failed, the rule will be created
unsuccessful.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v7:
- Remove unsupported RSS combinations array.
- Restored 'ETH_RSS_GTPU' in input set mask.
v6:
- Add unsupported RSS combinations array.
v5:
- Remove 'ETH_RSS_GTPU' from input set mask.
v4:
- Use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX'
v3:
- Update the comments.
v2:
- Add invalid RSS combinations.
 drivers/net/iavf/iavf_hash.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 7620876b58..ebaac58254 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -863,7 +863,9 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
-- 
2.17.1



[dpdk-dev] [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

2021-01-07 Thread Murphy Yang
Currently, when use 'flow' command to create a rule with following invalid
RSS type combination, it can be created successfully.

Invalid RSS combinations list:
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

This patch adds these combinations in 'invalid_rss_comb' array to do
valid check, if the combination check failed, the rule will be created
unsuccessful.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
v8:
- Update the comments.
v7:
- Remove unsupported RSS combinations array.
- Restored 'ETH_RSS_GTPU' in input set mask.
v6:
- Add unsupported RSS combinations array.
v5:
- Remove 'ETH_RSS_GTPU' from input set mask.
v4:
- Use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX'
v3:
- Update the comments.
v2:
- Add invalid RSS combinations.
 drivers/net/iavf/iavf_hash.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 7620876b58..ebaac58254 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -863,7 +863,9 @@ static void iavf_refine_proto_hdrs(struct 
virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+   ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+   ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
RTE_ETH_RSS_L3_PRE96
-- 
2.17.1



[dpdk-dev] [PATCH] net/ice: disable IPv4 checksum offload in vector path

2021-01-07 Thread Murphy Yang
ICE choices vector TX path or basic TX path by macro
'ICE_NO_VECTOR_FLAGS'.

This patch adds 'DEV_TX_OFFLOAD_IPV4_CKSUM' in 'ICE_NO_VECTOR_FLAGS'
to make IPv4 checksum offload processed by basic TX path.

Fixes: a22483208800 ("net/ice: disable TSO offload in vector path")

Signed-off-by: Murphy Yang 
---
 drivers/net/ice/ice_rxtx_vec_common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ice/ice_rxtx_vec_common.h 
b/drivers/net/ice/ice_rxtx_vec_common.h
index ae2ac29f2a..c09ac7f667 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -266,6 +266,7 @@ ice_rx_vec_queue_default(struct ice_rx_queue *rxq)
 #define ICE_NO_VECTOR_FLAGS (   \
DEV_TX_OFFLOAD_MULTI_SEGS |  \
DEV_TX_OFFLOAD_VLAN_INSERT | \
+   DEV_TX_OFFLOAD_IPV4_CKSUM |  \
DEV_TX_OFFLOAD_SCTP_CKSUM |  \
DEV_TX_OFFLOAD_UDP_CKSUM |   \
DEV_TX_OFFLOAD_TCP_TSO | \
-- 
2.17.1



[dpdk-dev] [PATCH] net/i40e: i40e PMD APIs add input pointer null check

2021-01-08 Thread Murphy Yang
Pointer 'NULL' check for 'mac_addr' or 'conf' within i40e PMD APIs.

Fixes: 66c78f4799ff ("net/i40e: add support for packet template to flow 
director")
Fixes: 04b443fb2c43 ("net/i40e: fix port id type")

Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/rte_pmd_i40e.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 790d042002..2e34140c5b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2366,6 +2366,9 @@ rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t 
vf_id,
struct i40e_mac_filter_info mac_filter;
int ret;
 
+   if (mac_addr == NULL)
+   return -EINVAL;
+
if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)
return -EINVAL;
 
@@ -3042,6 +3045,9 @@ int rte_pmd_i40e_flow_add_del_packet_template(
 
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+   if (conf == NULL)
+   return -EINVAL;
+
if (!is_i40e_supported(dev))
return -ENOTSUP;
 
-- 
2.17.1



[dpdk-dev] [PATCH v5] net/ice: fix outher chksum on cvl unknown

2020-11-04 Thread Murphy Yang
Currently, driver does not supports parse UDP outer checksum flag of
tunneled packets.

When execute 'csum set outer-udp hw 0' and 'csum parse-tunnel on 0'
commands to enable hardware UDP outer checksum. This patch supports
parse UDP outer checksum flag of tunneled packets.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: Murphy Yang 
---
v5:
- fix outer L4 checksum mask for vector path.
v4:
- cover AVX512 vector path.
v3:
- add PKT_RX_OUTER_L4_CKSUM_GOOD in AVX2 and SSE vector path.
- rename some variable name.
v2:
- cover AVX2 and SSE vector path

 drivers/net/ice/ice_rxtx.c|   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 117 +++---
 drivers/net/ice/ice_rxtx_vec_avx512.c | 116 ++---
 drivers/net/ice/ice_rxtx_vec_sse.c|  75 -
 4 files changed, 228 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..24a7caeb98 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1451,6 +1451,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index b72a9e7025..2802c4caae 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,86 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+   

[dpdk-dev] [PATCH v6] net/ice: fix outer checksum on cvl unknown

2020-11-08 Thread Murphy Yang
Currently, driver does not support parse UDP outer checksum flag of
tunneled packets.

When execute 'csum set outer-udp hw 0' and 'csum parse-tunnel on 0'
commands to enable hardware UDP outer checksum. This patch supports
parse UDP outer checksum flag of tunneled packets.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: Murphy Yang 
---
v6:
- rename variable name.
- update comments.
v5:
- fix outer L4 checksum mask for vector path.
v4:
- cover AVX512 vector path.
v3:
- add PKT_RX_OUTER_L4_CKSUM_GOOD in AVX2 and SSE vector path.
- rename variable name.
v2:
- cover AVX2 and SSE vector path

 drivers/net/ice/ice_rxtx.c|   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 118 +++---
 drivers/net/ice/ice_rxtx_vec_avx512.c | 117 ++---
 drivers/net/ice/ice_rxtx_vec_sse.c|  78 -
 4 files changed, 233 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..24a7caeb98 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1451,6 +1451,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index b72a9e7025..7838e17787 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,88 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT

[dpdk-dev] [PATCH] net/i40e: fix incorrect checksum flag of L4 checksum

2020-11-11 Thread Murphy Yang
When send tunneled packet that inner L4 checksum value is correct,
the test_pmd output log shows 'ol_flags' value is
'PKT_RX_L4_CKSUM_UNKNOWN', but expected value is
'PKT_RX_L4_CKSUM_GOOD'.

Add the 'PKT_RX_L4_CKSUM_GOOD' to 'l3_l4e_flags' for sse and
'l3_l4_flags_shuf' for avx2 to ensure that the 'ol_flags' can match
correct flags.

Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")

Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_rxtx_vec_avx2.c | 40 ---
 drivers/net/i40e/i40e_rxtx_vec_sse.c  | 20 --
 2 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c 
b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index 7a558fc73a..fe6ec7deef 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -342,24 +342,32 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
 */
const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
/* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | 
PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD | 
PKT_RX_L4_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-   PKT_RX_IP_CKSUM_BAD >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
/* second 128-bits */
0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | 
PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD | 
PKT_RX_L4_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-   PKT_RX_IP_CKSUM_BAD >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
 
const __m256i cksum_mask = _mm256_set1_epi32(
PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c 
b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 4b2b6a28fc..0bcb48e24e 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -254,16 +254,18 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, volatile 
union i40e_rx_desc *rxdp,
 
const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
/* shift right 1 bit to make sure 

[dpdk-dev] [PATCH] net/ice: fix outer UDP Tx offload checksum error

2020-11-22 Thread Murphy Yang
If enable hardware outer UDP TX offload checksum, it doesn't take effect
when send 'IPv6/UDP/VXLAN' packet with error outer UDP checksum.

In order to take effect, set the 'L4T_CS' flag valid only when 'L4TUNT'
equals one and 'EIPT' is not zero. If 'L4T_CS' flag marked, the hardware
can calculate the outer tunneling UDP checksum.

Fixes: bd70c451532c ("net/ice: support Tx checksum offload for tunnel")

Signed-off-by: Murphy Yang 
---
 drivers/net/ice/ice_rxtx.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..9769e216bf 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2319,8 +2319,11 @@ ice_parse_tunneling_params(uint64_t ol_flags,
*cd_tunneling |= (tx_offload.l2_len >> 1) <<
ICE_TXD_CTX_QW0_NATLEN_S;
 
-   if ((ol_flags & PKT_TX_OUTER_UDP_CKSUM) &&
-   (ol_flags & PKT_TX_OUTER_IP_CKSUM) &&
+   /**
+* Calculate the tunneling UDP checksum.
+* Shall be set only if L4TUNT = 01b and EIPT is not zero
+*/
+   if (!(*cd_tunneling & ICE_TX_CTX_EIPT_NONE) &&
(*cd_tunneling & ICE_TXD_CTX_UDP_TUNNELING))
*cd_tunneling |= ICE_TXD_CTX_QW0_L4T_CS_M;
 }
-- 
2.17.1



[dpdk-dev] [PATCH v7] net/ice: fix outer checksum on cvl unknown

2020-11-23 Thread Murphy Yang
When received tunneled packets, the testpmd output log shows 'ol_flags'
value always is 'PKT_RX_OUTER_L4_CKSUM_UNKNOWN', but expected value is
'PKT_RX_OUTER_L4_CKSUM_GOOD' or 'PKT_RX_OUTER_L4_CKSUM_BAD'.

Add the 'PKT_RX_OUTER_L4_CKSUM_GOOD' and 'PKT_RX_OUTER_L4_CKSUM_BAD' to
'flags' for normal path, 'l3_l4_flags_shuf' for AVX2 and AVX512 vector
path and 'cksum_flags' for SSE vector path to ensure that the 'ol_flags'
can match correct flags.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: Murphy Yang 
---
v7:
- fix compile error with default target on SSE vector path.
v6:
- rename variable name.
- update comments.
v5:
- fix outer L4 checksum mask for vector path.
v4:
- cover AVX512 vector path.
v3:
- add PKT_RX_OUTER_L4_CKSUM_GOOD in AVX2 and SSE vector path.
- rename variable name.
v2:
- cover AVX2 and SSE vector path
 drivers/net/ice/ice_rxtx.c|   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 118 +++---
 drivers/net/ice/ice_rxtx_vec_avx512.c | 117 ++---
 drivers/net/ice/ice_rxtx_vec_sse.c|  78 -
 4 files changed, 233 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..24a7caeb98 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1451,6 +1451,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index b72a9e7025..7838e17787 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,88 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKS

[dpdk-dev] [PATCH 0/2] support GTP-U Tx offload on FVL and CVL

2020-11-25 Thread Murphy Yang
Support outer L3 and inner L3 + L4 Tx checksum offload for GTP-U packets
that contain extension header on FVL.
Support outer L3 + L4 and inner L3 + L4 Rx and Tx checksum offload for
GTP-U packets that contain extension header on CVL.

Murphy Yang (2):
  net/i40e: support GTP checksum offload
  app/testpmd: support GTP-U extension packet checksum offload

 app/test-pmd/csumonly.c  | 26 +++---
 drivers/net/i40e/i40e_rxtx.c |  1 +
 2 files changed, 24 insertions(+), 3 deletions(-)

-- 
2.17.1



[dpdk-dev] [PATCH 1/2] net/i40e: support GTP checksum offload

2020-11-25 Thread Murphy Yang
To support Tx side offload on GTP tunneling packet, driver should
set correct tunneling parameters of 'L4TUNT'.

Signed-off-by: Murphy Yang 
---
 drivers/net/i40e/i40e_rxtx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 5df9a9df56..6b64a03d16 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -233,6 +233,7 @@ i40e_parse_tunneling_params(uint64_t ol_flags,
/* for non UDP / GRE tunneling, set to 00b */
break;
case PKT_TX_TUNNEL_VXLAN:
+   case PKT_TX_TUNNEL_GTP:
case PKT_TX_TUNNEL_GENEVE:
*cd_tunneling |= I40E_TXD_CTX_UDP_TUNNELING;
break;
-- 
2.17.1



[dpdk-dev] [PATCH 2/2] app/testpmd: support GTP-U extension packet checksum offload

2020-11-25 Thread Murphy Yang
To enable Tx side offload on GTP-U packets that contain extension header,
testpmd should set 'info->l2_len' correctly, this value should contain UDP
header length, GTP-U header length and GTP-U extension header length.

Signed-off-by: Murphy Yang 
---
 app/test-pmd/csumonly.c | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index d813d4fae0..1faeacd809 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -218,14 +218,32 @@ parse_gtp(struct rte_udp_hdr *udp_hdr,
gtp_hdr = (struct rte_gtp_hdr *)((char *)udp_hdr +
  sizeof(struct rte_udp_hdr));
 
+   /* Calculate the gtp_len*/
+   if (gtp_hdr->gtp_hdr_info & 0x7)
+   gtp_len = gtp_len + 4;
+
+   if (gtp_hdr->gtp_hdr_info & 0x4) {
+   /*Assuming one extension gtp header*/
+   uint16_t gtp_extension_len = 0;
+   uint8_t *gtp_extension_hdr = NULL;
+   uint8_t gtp_NEHT = 0;
+   do {
+   gtp_extension_hdr = (uint8_t *)((uint8_t *)gtp_hdr +
+gtp_len);
+   gtp_extension_len = *gtp_extension_hdr * 4;
+   gtp_len = gtp_len + gtp_extension_len;
+   gtp_NEHT = *(gtp_extension_hdr +
+ gtp_extension_len - 1);
+   } while (gtp_NEHT);
+   }
+
/*
 * Check message type. If message type is 0xff, it is
 * a GTP data packet. If not, it is a GTP control packet
 */
if (gtp_hdr->msg_type == 0xff) {
ip_ver = *(uint8_t *)((char *)udp_hdr +
-sizeof(struct rte_udp_hdr) +
-sizeof(struct rte_gtp_hdr));
+sizeof(struct rte_udp_hdr) +  gtp_len);
ip_ver = (ip_ver) & 0xf0;
 
if (ip_ver == RTE_GTP_TYPE_IPV4) {
@@ -233,20 +251,22 @@ parse_gtp(struct rte_udp_hdr *udp_hdr,
   gtp_len);
info->ethertype = _htons(RTE_ETHER_TYPE_IPV4);
parse_ipv4(ipv4_hdr, info);
+   info->l2_len = (uint8_t *)ipv4_hdr - (uint8_t *)udp_hdr;
} else if (ip_ver == RTE_GTP_TYPE_IPV6) {
ipv6_hdr = (struct rte_ipv6_hdr *)((char *)gtp_hdr +
   gtp_len);
info->ethertype = _htons(RTE_ETHER_TYPE_IPV6);
parse_ipv6(ipv6_hdr, info);
+   info->l2_len = (uint8_t *)ipv6_hdr - (uint8_t *)udp_hdr;
}
} else {
info->ethertype = 0;
info->l4_len = 0;
info->l3_len = 0;
info->l4_proto = 0;
+   info->l2_len += RTE_ETHER_GTP_HLEN;
}
 
-   info->l2_len += RTE_ETHER_GTP_HLEN;
 }
 
 /* Parse a vxlan header */
-- 
2.17.1



[dpdk-dev] [PATCH v2] net/i40e: fix incorrect checksum flag of L4 checksum

2020-12-02 Thread Murphy Yang
When send tunneled packet that inner L4 checksum value is correct,
the test_pmd output log shows 'ol_flags' value is
'PKT_RX_L4_CKSUM_UNKNOWN', but expected value is
'PKT_RX_L4_CKSUM_GOOD'.

If the inner l4 checksum is correctly, mark the 'PKT_RX_L4_CKSUM_GOOD'
flag to 'l3_l4e_flags' for sse and 'l3_l4_flags_shuf' for avx2 to
ensure that the 'ol_flags' can match correct flags.

Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")

Signed-off-by: Murphy Yang 
---
v2:
- update the comments.
 drivers/net/i40e/i40e_rxtx_vec_avx2.c | 40 ---
 drivers/net/i40e/i40e_rxtx_vec_sse.c  | 20 --
 2 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c 
b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index 7a558fc73a..fe6ec7deef 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -342,24 +342,32 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
 */
const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
/* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | 
PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD | 
PKT_RX_L4_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-   PKT_RX_IP_CKSUM_BAD >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
/* second 128-bits */
0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | 
PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD | 
PKT_RX_L4_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-   PKT_RX_IP_CKSUM_BAD >> 1,
-   (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
 
const __m256i cksum_mask = _mm256_set1_epi32(
PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c 
b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 4b2b6a28fc..0bcb48e24e 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -254,16 +254,18 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, volatile 
union i40e_rx_desc *rxdp,
 
const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 

[dpdk-dev] [PATCH] net/iavf: fix negative GTP-U flow rules create successfully

2020-12-08 Thread Murphy Yang
Currently, when use 'flow' command to create a negative GTP-U rule, it
will be created successfully.

The list shows the impacted outer and inner 'ipv4' GTP-U patterns with
'ipv4' or 'gtpu' type:
 - iavf_pattern_eth_ipv4_gtpu_ipv4_udp
 - iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp
 - iavf_pattern_eth_ipv4_gtpu_ipv4_tcp
 - iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp
 - more impacted patterns with 'gtpu' type:
   > iavf_pattern_eth_ipv4_gtpu_ipv4
   > iavf_pattern_eth_ipv4_gtpu_eh_ipv4

Same as the outer and inner 'ipv6' GTP-U patterns.

So, this commit modifies the macro define of the 'IAVF_RSS_TYPE_XXX' to
make the result correct.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Murphy Yang 
---
 drivers/net/iavf/iavf_hash.c | 30 ++
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..7a3ea39d66 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -326,34 +326,24 @@ struct virtchnl_proto_hdrs ipv6_udp_gtpc_tmplt = {
 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
 /* IPv4 inner */
 #define IAVF_RSS_TYPE_INNER_IPV4   ETH_RSS_IPV4
-#define IAVF_RSS_TYPE_INNER_IPV4_UDP   (ETH_RSS_IPV4 | \
-ETH_RSS_NONFRAG_IPV4_UDP)
-#define IAVF_RSS_TYPE_INNER_IPV4_TCP   (ETH_RSS_IPV4 | \
-ETH_RSS_NONFRAG_IPV4_TCP)
+#define IAVF_RSS_TYPE_INNER_IPV4_UDP   (ETH_RSS_NONFRAG_IPV4_UDP)
+#define IAVF_RSS_TYPE_INNER_IPV4_TCP   (ETH_RSS_NONFRAG_IPV4_TCP)
 #define IAVF_RSS_TYPE_INNER_IPV4_SCTP  (ETH_RSS_IPV4 | \
 ETH_RSS_NONFRAG_IPV4_SCTP)
 /* IPv6 inner */
 #define IAVF_RSS_TYPE_INNER_IPV6   ETH_RSS_IPV6
-#define IAVF_RSS_TYPE_INNER_IPV6_UDP   (ETH_RSS_IPV6 | \
-ETH_RSS_NONFRAG_IPV6_UDP)
-#define IAVF_RSS_TYPE_INNER_IPV6_TCP   (ETH_RSS_IPV6 | \
-ETH_RSS_NONFRAG_IPV6_TCP)
+#define IAVF_RSS_TYPE_INNER_IPV6_UDP   (ETH_RSS_NONFRAG_IPV6_UDP)
+#define IAVF_RSS_TYPE_INNER_IPV6_TCP   (ETH_RSS_NONFRAG_IPV6_TCP)
 #define IAVF_RSS_TYPE_INNER_IPV6_SCTP  (ETH_RSS_IPV6 | \
 ETH_RSS_NONFRAG_IPV6_SCTP)
 /* GTPU IPv4 */
-#define IAVF_RSS_TYPE_GTPU_IPV4(IAVF_RSS_TYPE_INNER_IPV4 | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_UDP(IAVF_RSS_TYPE_INNER_IPV4_UDP | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_TCP(IAVF_RSS_TYPE_INNER_IPV4_TCP | \
-ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV4(IAVF_RSS_TYPE_INNER_IPV4)
+#define IAVF_RSS_TYPE_GTPU_IPV4_UDP(IAVF_RSS_TYPE_INNER_IPV4_UDP)
+#define IAVF_RSS_TYPE_GTPU_IPV4_TCP(IAVF_RSS_TYPE_INNER_IPV4_TCP)
 /* GTPU IPv6 */
-#define IAVF_RSS_TYPE_GTPU_IPV6(IAVF_RSS_TYPE_INNER_IPV6 | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_UDP(IAVF_RSS_TYPE_INNER_IPV6_UDP | \
-ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_TCP(IAVF_RSS_TYPE_INNER_IPV6_TCP | \
-ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV6(IAVF_RSS_TYPE_INNER_IPV6)
+#define IAVF_RSS_TYPE_GTPU_IPV6_UDP(IAVF_RSS_TYPE_INNER_IPV6_UDP)
+#define IAVF_RSS_TYPE_GTPU_IPV6_TCP(IAVF_RSS_TYPE_INNER_IPV6_TCP)
 /* ESP, AH, L2TPV3 and PFCP */
 #define IAVF_RSS_TYPE_IPV4_ESP (ETH_RSS_ESP | ETH_RSS_IPV4)
 #define IAVF_RSS_TYPE_IPV4_AH  (ETH_RSS_AH | ETH_RSS_IPV4)
-- 
2.17.1



[dpdk-dev] [PATCH v8] net/ice: fix outer checksum unknown

2020-12-15 Thread Murphy Yang
When received tunneled packets, the testpmd output log shows 'ol_flags'
value always is 'PKT_RX_OUTER_L4_CKSUM_UNKNOWN', but expected value is
'PKT_RX_OUTER_L4_CKSUM_GOOD' or 'PKT_RX_OUTER_L4_CKSUM_BAD'.

Add the 'PKT_RX_OUTER_L4_CKSUM_GOOD' and 'PKT_RX_OUTER_L4_CKSUM_BAD' to
'flags' for normal path, 'l3_l4_flags_shuf' for AVX2 and AVX512 vector
path and 'cksum_flags' for SSE vector path to ensure that the 'ol_flags'
can match correct flags.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: Murphy Yang 
---
v8:
- tune the commit title.
v7:
- fix compile error with default target on SSE vector path.
v6:
- rename variable name.
- update comments.
v5:
- fix outer L4 checksum mask for vector path.
v4:
- cover AVX512 vector path.
v3:
- add PKT_RX_OUTER_L4_CKSUM_GOOD in AVX2 and SSE vector path.
- rename variable name.
v2:
- cover AVX2 and SSE vector path

 drivers/net/ice/ice_rxtx.c|   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 118 +++---
 drivers/net/ice/ice_rxtx_vec_avx512.c | 117 ++---
 drivers/net/ice/ice_rxtx_vec_sse.c|  78 -
 4 files changed, 233 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 9769e216bf..d052bd0f1b 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1451,6 +1451,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index b72a9e7025..7838e17787 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,88 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD

[dpdk-dev] [PATCH 1/1] net/ice: fix outher chksum on cvl unknown

2020-10-15 Thread murphy yang
From: murphy 

When set 'csum set outer-udp hw 0' ,support for
ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S,mark the packet
PKT_RX_OUTER_L4_CKSUM_BAD or PKT_RX_OUTER_L4_CKSUM_GOOD.

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")
Fixes: 4ab7dbb0a0f6 ("net/ice: switch to Rx flexible descriptor in AVX path")
Fixes: ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")

Signed-off-by: murphy 

v2:
- cover vector path

---
 drivers/net/ice/ice_rxtx.c  |   5 ++
 drivers/net/ice/ice_rxtx_vec_avx2.c | 110 
 drivers/net/ice/ice_rxtx_vec_sse.c  |  71 --
 3 files changed, 133 insertions(+), 53 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 93a0ac691..e74741732 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1424,6 +1424,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c 
b/drivers/net/ice/ice_rxtx_vec_avx2.c
index 5969a3048..771734cf3 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -251,43 +251,79 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, 
struct rte_mbuf **rx_pkts,
 * bit13 is for VLAN indication.
 */
const __m256i flags_mask =
-_mm256_set1_epi32((7 << 4) | (1 << 12) | (1 << 13));
+_mm256_set1_epi32((0xF << 4) | (1 << 12) | (1 << 13));
/**
 * data to be shuffled by the result of the flags mask shifted by 4
 * bits.  This gives use the l3_l4 flags.
 */
-   const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-   /* shift right 1 bit to make sure it not exceed 255 */
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   /* second 128-bits */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
-PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
-   (PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
+   const __m256i l3_l4_flags_shuf =
+   _mm256_set_epi8((PKT_RX_OUTER_L4_CKSUM_BAD >> 20 |
+PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_EIP_CKSUM_BAD |
+PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_BAD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_BAD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_BAD) >> 1,
+   (PKT_RX_OUTER_L4_CKSUM_BAD >> 20 | PKT_RX_L4_CKSUM_GOOD |
+PKT_RX_IP_CKSUM_GOOD) >> 1,
+   /* shift right 1 bit to make sure it not exceed 255 */
+   (PK

[dpdk-dev] [PATCH] net/ice: fix outher chksum on cvl unknown

2020-10-14 Thread murphy yang
From: murphy 

When set 'csum set outer-udp hw 0' ,support for
ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S,mark the packet
PKT_RX_OUTER_L4_CKSUM_BAD or PKT_RX_OUTER_L4_CKSUM_GOOD

Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")

Signed-off-by: murphy 
---
 drivers/net/ice/ice_rxtx.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 93a0ac691..e74741732 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1424,6 +1424,11 @@ ice_rxd_error_to_pkt_flags(uint16_t stat_err0)
if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
flags |= PKT_RX_EIP_CKSUM_BAD;
 
+   if (unlikely(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+   flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
+   else
+   flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+
return flags;
 }
 
-- 
2.17.1



[dpdk-dev] [PATCH] net/iavf: fix link status

2020-09-18 Thread murphy yang
From: murphy 

If the PF driver supports the new speed reporting capabilities
then use link_event_adv instead of link_event to get the speed.

Fixes: 5330b042977c ("net/iavf: fix link speed")

Cc: sta...@dpdk.org

Signed-off-by: murphy 
---
 drivers/net/iavf/iavf_vchnl.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 76f8e38d1..c4956dc58 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -195,14 +195,13 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t 
*msg,
case VIRTCHNL_EVENT_LINK_CHANGE:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");
vf->link_up = pf_msg->event_data.link_event.link_status;
+   enum virtchnl_link_speed speed;
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
-   vf->link_speed =
-   pf_msg->event_data.link_event_adv.link_speed;
+   speed = pf_msg->event_data.link_event_adv.link_speed;
} else {
-   enum virtchnl_link_speed speed;
speed = pf_msg->event_data.link_event.link_speed;
-   vf->link_speed = iavf_convert_link_speed(speed);
}
+   vf->link_speed = iavf_convert_link_speed(speed);
iavf_dev_link_update(dev, 0);
rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
break;
-- 
2.17.1