net/bnxt: move function check zero bytes
authorScott Branden <scott.branden@broadcom.com>
Thu, 28 Jun 2018 20:15:36 +0000 (13:15 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 2 Jul 2018 23:35:58 +0000 (01:35 +0200)
Move check_zero_bytes into new bnxt_util.h file.

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/Makefile
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_filter.c
drivers/net/bnxt/bnxt_filter.h
drivers/net/bnxt/bnxt_util.c [new file with mode: 0644]
drivers/net/bnxt/bnxt_util.h [new file with mode: 0644]
drivers/net/bnxt/meson.build

index fd0cb52..80db03e 100644 (file)
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_util.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += rte_pmd_bnxt.c
 
 #
index 18616bf..7fa69b4 100644 (file)
@@ -26,6 +26,7 @@
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 #include "bnxt_nvm_defs.h"
+#include "bnxt_util.h"
 
 #define DRV_MODULE_NAME                "bnxt"
 static const char bnxt_version[] =
index e36da99..c83b910 100644 (file)
@@ -15,6 +15,7 @@
 #include "bnxt.h"
 #include "bnxt_filter.h"
 #include "bnxt_hwrm.h"
+#include "bnxt_util.h"
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 
@@ -231,15 +232,6 @@ nxt_non_void_action(const struct rte_flow_action *cur)
        }
 }
 
-int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
-{
-       int i;
-       for (i = 0; i < len; i++)
-               if (bytes[i] != 0x00)
-                       return 0;
-       return 1;
-}
-
 static int
 bnxt_filter_type_check(const struct rte_flow_item pattern[],
                       struct rte_flow_error *error __rte_unused)
index d27be70..a1ecfb1 100644 (file)
@@ -69,7 +69,6 @@ struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp);
 void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter);
 struct bnxt_filter_info *bnxt_get_l2_filter(struct bnxt *bp,
                struct bnxt_filter_info *nf, struct bnxt_vnic_info *vnic);
-int bnxt_check_zero_bytes(const uint8_t *bytes, int len);
 
 #define NTUPLE_FLTR_ALLOC_INPUT_EN_SRC_MACADDR \
        HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR
diff --git a/drivers/net/bnxt/bnxt_util.c b/drivers/net/bnxt/bnxt_util.c
new file mode 100644 (file)
index 0000000..7d33427
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
+ */
+
+#include <inttypes.h>
+
+#include "bnxt_util.h"
+
+int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
+{
+       int i;
+
+       for (i = 0; i < len; i++)
+               if (bytes[i] != 0x00)
+                       return 0;
+       return 1;
+}
diff --git a/drivers/net/bnxt/bnxt_util.h b/drivers/net/bnxt/bnxt_util.h
new file mode 100644 (file)
index 0000000..2378833
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _BNXT_UTIL_H_
+#define _BNXT_UTIL_H_
+
+int bnxt_check_zero_bytes(const uint8_t *bytes, int len);
+
+#endif /* _BNXT_UTIL_H_ */
index 486bf0f..bfb448f 100644 (file)
@@ -14,5 +14,6 @@ sources = files('bnxt_cpr.c',
        'bnxt_stats.c',
        'bnxt_txq.c',
        'bnxt_txr.c',
+       'bnxt_util.c',
        'bnxt_vnic.c',
        'rte_pmd_bnxt.c')