net: add rte prefix to ether functions
[dpdk.git] / drivers / net / cxgbe / cxgbe_flow.c
index a8f076e..a7b053b 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Chelsio Communications.
  * All rights reserved.
  */
-#include "common.h"
+#include "base/common.h"
 #include "cxgbe_flow.h"
 
 #define __CXGBE_FILL_FS(__v, __m, fs, elem, e) \
@@ -115,12 +115,12 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item,
        mask = umask ? umask : (const struct rte_flow_item_eth *)dmask;
 
        /* we don't support SRC_MAC filtering*/
-       if (!is_zero_ether_addr(&mask->src))
+       if (!rte_is_zero_ether_addr(&mask->src))
                return rte_flow_error_set(e, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,
                                          item,
                                          "src mac filtering not supported");
 
-       if (!is_zero_ether_addr(&mask->dst)) {
+       if (!rte_is_zero_ether_addr(&mask->dst)) {
                const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0];
                const u8 *m = (const u8 *)&mask->dst.addr_bytes[0];
                struct rte_flow *flow = (struct rte_flow *)fs->private;
@@ -732,6 +732,10 @@ cxgbe_rtef_parse_items(struct rte_flow *flow,
                                                "parse items cannot be repeated (except void)");
                        repeat[i->type] = 1;
 
+                       /* No spec found for this pattern item. Skip it */
+                       if (!i->spec)
+                               break;
+
                        /* validate the item */
                        ret = cxgbe_validate_item(i, e);
                        if (ret)
@@ -797,7 +801,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) {
@@ -883,7 +887,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) {
@@ -943,6 +947,7 @@ cxgbe_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow,
                 const struct rte_flow_action *action, void *data,
                 struct rte_flow_error *e)
 {
+       struct adapter *adap = ethdev2adap(flow->dev);
        struct ch_filter_specification fs;
        struct rte_flow_query_count *c;
        struct filter_entry *f;
@@ -981,6 +986,8 @@ cxgbe_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow,
        /* Query was successful */
        c->bytes_set = 1;
        c->hits_set = 1;
+       if (c->reset)
+               cxgbe_clear_filter_count(adap, flow->fidx, f->fs.cap, true);
 
        return 0; /* success / partial_success */
 }