net/i40e: fix overwriting RSS RETA
[dpdk.git] / drivers / net / cxgbe / cxgbe_flow.c
index 3e4acf3..4deaff8 100644 (file)
@@ -7,14 +7,12 @@
 
 #define __CXGBE_FILL_FS(__v, __m, fs, elem, e) \
 do { \
-       if (!((fs)->val.elem || (fs)->mask.elem)) { \
-               (fs)->val.elem = (__v); \
-               (fs)->mask.elem = (__m); \
-       } else { \
+       if ((fs)->mask.elem && ((fs)->val.elem != (__v))) \
                return rte_flow_error_set(e, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, \
-                                         NULL, "a filter can be specified" \
-                                         " only once"); \
-       } \
+                                         NULL, "Redefined match item with" \
+                                         " different values found"); \
+       (fs)->val.elem = (__v); \
+       (fs)->mask.elem = (__m); \
 } while (0)
 
 #define __CXGBE_FILL_FS_MEMCPY(__v, __m, fs, elem) \
@@ -552,6 +550,16 @@ ch_rte_parse_atype_switch(const struct rte_flow_action *a,
                fs->nat_lport = be16_to_cpu(tp_port->port);
                *nmode |= 1 << 3;
                break;
+       case RTE_FLOW_ACTION_TYPE_MAC_SWAP:
+               item_index = cxgbe_get_flow_item_index(items,
+                                                      RTE_FLOW_ITEM_TYPE_ETH);
+               if (item_index < 0)
+                       return rte_flow_error_set(e, EINVAL,
+                                                 RTE_FLOW_ERROR_TYPE_ACTION, a,
+                                                 "No RTE_FLOW_ITEM_TYPE_ETH "
+                                                 "found");
+               fs->swapmac = 1;
+               break;
        default:
                /* We are not supposed to come here */
                return rte_flow_error_set(e, EINVAL,
@@ -611,6 +619,7 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,
                case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
                case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
                case RTE_FLOW_ACTION_TYPE_PHY_PORT:
+               case RTE_FLOW_ACTION_TYPE_MAC_SWAP:
                case RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC:
                case RTE_FLOW_ACTION_TYPE_SET_IPV4_DST:
                        nat_ipv4++;
@@ -656,7 +665,7 @@ action_switch:
        return 0;
 }
 
-struct chrte_fparse parseitem[] = {
+static struct chrte_fparse parseitem[] = {
        [RTE_FLOW_ITEM_TYPE_ETH] = {
                .fptr  = ch_rte_parsetype_eth,
                .dmask = &(const struct rte_flow_item_eth){
@@ -788,7 +797,7 @@ static int __cxgbe_flow_create(struct rte_eth_dev *dev, struct rte_flow *flow)
 
        /* Poll the FW for reply */
        err = cxgbe_poll_for_completion(&adap->sge.fw_evtq,
-                                       CXGBE_FLOW_POLL_US,
+                                       CXGBE_FLOW_POLL_MS,
                                        CXGBE_FLOW_POLL_CNT,
                                        &ctx.completion);
        if (err) {
@@ -874,7 +883,7 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)
 
        /* Poll the FW for reply */
        err = cxgbe_poll_for_completion(&adap->sge.fw_evtq,
-                                       CXGBE_FLOW_POLL_US,
+                                       CXGBE_FLOW_POLL_MS,
                                        CXGBE_FLOW_POLL_CNT,
                                        &ctx.completion);
        if (err) {