linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers
@ 2018-09-01  9:25 YueHaibing
  2018-09-04  2:19 ` David Miller
  2018-09-04  6:01 ` Sathya Perla
  0 siblings, 2 replies; 4+ messages in thread
From: YueHaibing @ 2018-09-01  9:25 UTC (permalink / raw)
  To: davem, michael.chan; +Cc: linux-kernel, netdev, YueHaibing

gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_parse_flow':
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:186:6: warning:
 variable 'addr_type' set but not used [-Wunused-but-set-variable]

As done elsewhere in TC/flower offload code, the address type of
the encapsulation IP headers should be realized accroding to the
addr_type field of the encapsulation control dissector key.

Fixes: 8c95f773b4a3 ("bnxt_en: add support for Flower based vxlan encap/decap offload")
Fixes: 2ae7408fedfe ("bnxt_en: bnxt: add TC flower filter offload support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
index 092c817..5c625e5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
@@ -242,7 +242,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp,
 		flow->l2_key.num_vlans = 1;
 	}
 
-	if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {
+	if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
 		struct flow_dissector_key_ipv4_addrs *key =
 			GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_IPV4_ADDRS);
 		struct flow_dissector_key_ipv4_addrs *mask =
@@ -253,8 +253,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp,
 		flow->l3_mask.ipv4.daddr.s_addr = mask->dst;
 		flow->l3_key.ipv4.saddr.s_addr = key->src;
 		flow->l3_mask.ipv4.saddr.s_addr = mask->src;
-	} else if (dissector_uses_key(dissector,
-				      FLOW_DISSECTOR_KEY_IPV6_ADDRS)) {
+	} else if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
 		struct flow_dissector_key_ipv6_addrs *key =
 			GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_IPV6_ADDRS);
 		struct flow_dissector_key_ipv6_addrs *mask =
@@ -300,7 +299,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp,
 		addr_type = key->addr_type;
 	}
 
-	if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS)) {
+	if (addr_type == FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) {
 		struct flow_dissector_key_ipv4_addrs *key =
 			GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS);
 		struct flow_dissector_key_ipv4_addrs *mask =
@@ -312,8 +311,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp,
 		flow->tun_mask.u.ipv4.dst = mask->dst;
 		flow->tun_key.u.ipv4.src = key->src;
 		flow->tun_mask.u.ipv4.src = mask->src;
-	} else if (dissector_uses_key(dissector,
-				      FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS)) {
+	} else if (addr_type == FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) {
 		return -EOPNOTSUPP;
 	}
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers
  2018-09-01  9:25 [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers YueHaibing
@ 2018-09-04  2:19 ` David Miller
  2018-09-04  6:01 ` Sathya Perla
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-09-04  2:19 UTC (permalink / raw)
  To: yuehaibing; +Cc: michael.chan, linux-kernel, netdev

From: YueHaibing <yuehaibing@huawei.com>
Date: Sat, 1 Sep 2018 17:25:29 +0800

> gcc '-Wunused-but-set-variable' warning:
> 
> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_parse_flow':
> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:186:6: warning:
>  variable 'addr_type' set but not used [-Wunused-but-set-variable]
> 
> As done elsewhere in TC/flower offload code, the address type of
> the encapsulation IP headers should be realized accroding to the
> addr_type field of the encapsulation control dissector key.
> 
> Fixes: 8c95f773b4a3 ("bnxt_en: add support for Flower based vxlan encap/decap offload")
> Fixes: 2ae7408fedfe ("bnxt_en: bnxt: add TC flower filter offload support")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Michael, please review.

And, if this fixes a bug, it should target 'net' not 'net-next'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers
  2018-09-01  9:25 [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers YueHaibing
  2018-09-04  2:19 ` David Miller
@ 2018-09-04  6:01 ` Sathya Perla
  2018-09-05 11:29   ` YueHaibing
  1 sibling, 1 reply; 4+ messages in thread
From: Sathya Perla @ 2018-09-04  6:01 UTC (permalink / raw)
  To: yuehaibing; +Cc: David Miller, Michael Chan, open list, Netdev

On Sat, Sep 1, 2018 at 2:56 PM YueHaibing <yuehaibing@huawei.com> wrote:
>
> gcc '-Wunused-but-set-variable' warning:
>
> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_parse_flow':
> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:186:6: warning:
>  variable 'addr_type' set but not used [-Wunused-but-set-variable]
>
> As done elsewhere in TC/flower offload code, the address type of
> the encapsulation IP headers should be realized accroding to the
> addr_type field of the encapsulation control dissector key.
...
>  drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
> index 092c817..5c625e5 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
> @@ -242,7 +242,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp,
>                 flow->l2_key.num_vlans = 1;
>         }
>
> -       if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {

 __skb_flow_dissect() (in net/core/flow_dissector.c) uses the same
construct. So, can you clarify what you are trying to fix here
functionally. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers
  2018-09-04  6:01 ` Sathya Perla
@ 2018-09-05 11:29   ` YueHaibing
  0 siblings, 0 replies; 4+ messages in thread
From: YueHaibing @ 2018-09-05 11:29 UTC (permalink / raw)
  To: Sathya Perla; +Cc: David Miller, Michael Chan, open list, Netdev

On 2018/9/4 14:01, Sathya Perla wrote:
> On Sat, Sep 1, 2018 at 2:56 PM YueHaibing <yuehaibing@huawei.com> wrote:
>>
>> gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_parse_flow':
>> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:186:6: warning:
>>  variable 'addr_type' set but not used [-Wunused-but-set-variable]
>>
>> As done elsewhere in TC/flower offload code, the address type of
>> the encapsulation IP headers should be realized accroding to the
>> addr_type field of the encapsulation control dissector key.
> ...
>>  drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 10 ++++------
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
>> index 092c817..5c625e5 100644
>> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
>> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
>> @@ -242,7 +242,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp,
>>                 flow->l2_key.num_vlans = 1;
>>         }
>>
>> -       if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {
> 
>  __skb_flow_dissect() (in net/core/flow_dissector.c) uses the same
> construct. So, can you clarify what you are trying to fix here
> functionally. Thanks.
> 
sorry, I misread the code.

However, the 'addr_type' can be removed.  Will send a new cleanup patch.

> .
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-05 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-01  9:25 [PATCH net-next] bnxt_en: Properly get address type of encapsulation IP headers YueHaibing
2018-09-04  2:19 ` David Miller
2018-09-04  6:01 ` Sathya Perla
2018-09-05 11:29   ` YueHaibing

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).