[v2,10/23] net/bnxt: move function check zero bytes to bnxt util.h
diff mbox series

Message ID 20180628201549.3507-11-ajit.khaparde@broadcom.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • bnxt patchset
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ajit Khaparde June 28, 2018, 8:15 p.m. UTC
From: Scott Branden <scott.branden@broadcom.com>

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      |  1 +
 drivers/net/bnxt/bnxt_ethdev.c |  1 +
 drivers/net/bnxt/bnxt_filter.c |  9 ---------
 drivers/net/bnxt/bnxt_filter.h |  1 -
 drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
 drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
 6 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h

Comments

Ferruh Yigit July 2, 2018, 12:20 p.m. UTC | #1
On 6/28/2018 9:15 PM, Ajit Khaparde wrote:
> From: Scott Branden <scott.branden@broadcom.com>
> 
> 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      |  1 +
>  drivers/net/bnxt/bnxt_ethdev.c |  1 +
>  drivers/net/bnxt/bnxt_filter.c |  9 ---------
>  drivers/net/bnxt/bnxt_filter.h |  1 -
>  drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
>  drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
>  6 files changed, 31 insertions(+), 10 deletions(-)
>  create mode 100644 drivers/net/bnxt/bnxt_util.c
>  create mode 100644 drivers/net/bnxt/bnxt_util.h
> 
> diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
> index fd0cb5235..80db03ea8 100644
> --- a/drivers/net/bnxt/Makefile
> +++ b/drivers/net/bnxt/Makefile
> @@ -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

This breaks the meson build and similar change required for meson, same with
bnxt_flow.c in other patch, if there is no other issue I can fix this while merging.
Ferruh Yigit July 2, 2018, 12:55 p.m. UTC | #2
On 7/2/2018 1:20 PM, Ferruh Yigit wrote:
> On 6/28/2018 9:15 PM, Ajit Khaparde wrote:
>> From: Scott Branden <scott.branden@broadcom.com>
>>
>> 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      |  1 +
>>  drivers/net/bnxt/bnxt_ethdev.c |  1 +
>>  drivers/net/bnxt/bnxt_filter.c |  9 ---------
>>  drivers/net/bnxt/bnxt_filter.h |  1 -
>>  drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
>>  drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
>>  6 files changed, 31 insertions(+), 10 deletions(-)
>>  create mode 100644 drivers/net/bnxt/bnxt_util.c
>>  create mode 100644 drivers/net/bnxt/bnxt_util.h
>>
>> diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
>> index fd0cb5235..80db03ea8 100644
>> --- a/drivers/net/bnxt/Makefile
>> +++ b/drivers/net/bnxt/Makefile
>> @@ -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
> 
> This breaks the meson build and similar change required for meson, same with
> bnxt_flow.c in other patch, if there is no other issue I can fix this while merging.

This patch also breaks the Makefile build, 'bnxt_filter.c' requires:
 #include "bnxt_util.h"

Patch
diff mbox series

diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
index fd0cb5235..80db03ea8 100644
--- a/drivers/net/bnxt/Makefile
+++ b/drivers/net/bnxt/Makefile
@@ -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
 
 #
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 22cf8fb93..ab3f5c8e7 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -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[] =
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index e36da9977..72989ab67 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -231,15 +231,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)
diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h
index d27be7032..a1ecfb19d 100644
--- a/drivers/net/bnxt/bnxt_filter.h
+++ b/drivers/net/bnxt/bnxt_filter.h
@@ -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
index 000000000..7d3342719
--- /dev/null
+++ b/drivers/net/bnxt/bnxt_util.c
@@ -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
index 000000000..2378833cc
--- /dev/null
+++ b/drivers/net/bnxt/bnxt_util.h
@@ -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_ */