* [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled
@ 2017-10-06 19:48 Jonathan Toppins
2017-10-06 19:48 ` [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef Jonathan Toppins
2017-10-07 1:01 ` [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Michael Chan
0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Toppins @ 2017-10-06 19:48 UTC (permalink / raw)
To: michael.chan; +Cc: netdev, open list
Instead of zeroing out bnxt_tc.c with a #ifdef foo, instead don't compile
the file when the option is not enabled. Now make and the preprocessor do
not have to waste time compiling a no-op.
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
---
drivers/net/ethernet/broadcom/bnxt/Makefile | 3 ++-
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 5 -----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/Makefile b/drivers/net/ethernet/broadcom/bnxt/Makefile
index 4f0cb8e1ffc0..457201f409a7 100644
--- a/drivers/net/ethernet/broadcom/bnxt/Makefile
+++ b/drivers/net/ethernet/broadcom/bnxt/Makefile
@@ -1,3 +1,4 @@
obj-$(CONFIG_BNXT) += bnxt_en.o
-bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o bnxt_tc.o
+bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o
+bnxt_en-$(CONFIG_BNXT_FLOWER_OFFLOAD) += bnxt_tc.o
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
index 7dd3d131043a..4730c048ed9b 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
@@ -23,8 +23,6 @@
#include "bnxt_tc.h"
#include "bnxt_vfr.h"
-#ifdef CONFIG_BNXT_FLOWER_OFFLOAD
-
#define BNXT_FID_INVALID 0xffff
#define VLAN_TCI(vid, prio) ((vid) | ((prio) << VLAN_PRIO_SHIFT))
@@ -833,6 +831,3 @@ void bnxt_shutdown_tc(struct bnxt *bp)
rhashtable_destroy(&tc_info->flow_table);
rhashtable_destroy(&tc_info->l2_table);
}
-
-#else
-#endif
--
2.13.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef
2017-10-06 19:48 [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Jonathan Toppins
@ 2017-10-06 19:48 ` Jonathan Toppins
2017-10-07 1:27 ` Michael Chan
2017-10-07 1:01 ` [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Michael Chan
1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Toppins @ 2017-10-06 19:48 UTC (permalink / raw)
To: michael.chan; +Cc: netdev, open list
There is no reason to wrap the data structures inside the ifdef.
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
index 6c4c1ed279ef..6e771e9eed51 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
@@ -10,8 +10,6 @@
#ifndef BNXT_TC_H
#define BNXT_TC_H
-#ifdef CONFIG_BNXT_FLOWER_OFFLOAD
-
/* Structs used for storing the filter/actions of the TC cmd.
*/
struct bnxt_tc_l2_key {
@@ -133,6 +131,8 @@ struct bnxt_tc_flow_node {
struct rcu_head rcu;
};
+#if IS_ENABLED(CONFIG_BNXT_FLOWER_OFFLOAD)
+
int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,
struct tc_cls_flower_offload *cls_flower);
int bnxt_init_tc(struct bnxt *bp);
--
2.13.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled
2017-10-06 19:48 [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Jonathan Toppins
2017-10-06 19:48 ` [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef Jonathan Toppins
@ 2017-10-07 1:01 ` Michael Chan
2017-10-07 2:00 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Michael Chan @ 2017-10-07 1:01 UTC (permalink / raw)
To: Jonathan Toppins; +Cc: Netdev, open list
On Fri, Oct 6, 2017 at 12:48 PM, Jonathan Toppins <jtoppins@redhat.com> wrote:
> Instead of zeroing out bnxt_tc.c with a #ifdef foo, instead don't compile
> the file when the option is not enabled. Now make and the preprocessor do
> not have to waste time compiling a no-op.
>
> Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef
2017-10-06 19:48 ` [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef Jonathan Toppins
@ 2017-10-07 1:27 ` Michael Chan
2017-10-07 2:01 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Michael Chan @ 2017-10-07 1:27 UTC (permalink / raw)
To: Jonathan Toppins; +Cc: Netdev, open list
On Fri, Oct 6, 2017 at 12:48 PM, Jonathan Toppins <jtoppins@redhat.com> wrote:
> There is no reason to wrap the data structures inside the ifdef.
What's so bad about wrapping unused data structures inside #ifdef?
These structures are only used if CONFIG_BNXT_FLOWER_OFFLOAD is
defined.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled
2017-10-07 1:01 ` [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Michael Chan
@ 2017-10-07 2:00 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-07 2:00 UTC (permalink / raw)
To: michael.chan; +Cc: jtoppins, netdev, linux-kernel
From: Michael Chan <michael.chan@broadcom.com>
Date: Fri, 6 Oct 2017 18:01:57 -0700
> On Fri, Oct 6, 2017 at 12:48 PM, Jonathan Toppins <jtoppins@redhat.com> wrote:
>> Instead of zeroing out bnxt_tc.c with a #ifdef foo, instead don't compile
>> the file when the option is not enabled. Now make and the preprocessor do
>> not have to waste time compiling a no-op.
>>
>> Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
>
> Acked-by: Michael Chan <michael.chan@broadcom.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef
2017-10-07 1:27 ` Michael Chan
@ 2017-10-07 2:01 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-07 2:01 UTC (permalink / raw)
To: michael.chan; +Cc: jtoppins, netdev, linux-kernel
From: Michael Chan <michael.chan@broadcom.com>
Date: Fri, 6 Oct 2017 18:27:31 -0700
> On Fri, Oct 6, 2017 at 12:48 PM, Jonathan Toppins <jtoppins@redhat.com> wrote:
>> There is no reason to wrap the data structures inside the ifdef.
>
> What's so bad about wrapping unused data structures inside #ifdef?
> These structures are only used if CONFIG_BNXT_FLOWER_OFFLOAD is
> defined.
Yeah I agree, this ifdef is actually a good way to trap unintentional
usage of those datastructures so it's doubly best to keep the ifdef.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-07 2:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06 19:48 [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Jonathan Toppins
2017-10-06 19:48 ` [PATCH net-next 2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef Jonathan Toppins
2017-10-07 1:27 ` Michael Chan
2017-10-07 2:01 ` David Miller
2017-10-07 1:01 ` [PATCH net-next 1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled Michael Chan
2017-10-07 2:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).