diff mbox

[net-next,v2,04/27] qlcnic: remove assumption that vlan_tci != 0

Message ID 7ccac9ab645244db2797490cad10a42979d78a32.1483475202.git.mirq-linux@rere.qmqm.pl
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Michał Mirosław Jan. 3, 2017, 8:52 p.m. UTC
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Chopra, Manish Jan. 4, 2017, 11:29 a.m. UTC | #1
> -----Original Message-----

> From: Michał Mirosław [mailto:mirq-linux@rere.qmqm.pl]

> Sent: Wednesday, January 04, 2017 2:23 AM

> To: netdev@vger.kernel.org

> Cc: Patil, Harish <Harish.Patil@cavium.com>; Chopra, Manish

> <Manish.Chopra@cavium.com>; Dept-GE Linux NIC Dev <Dept-

> GELinuxNICDev@cavium.com>

> Subject: [PATCH net-next v2 04/27] qlcnic: remove assumption that vlan_tci != 0

> 

> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

> ---

>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 8 +++++---

>  1 file changed, 5 insertions(+), 3 deletions(-)

> 

> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c

> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c

> index fedd7366713c..c3cc707cc265 100644

> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c

> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c

> @@ -459,7 +459,7 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter,

>  			 struct cmd_desc_type0 *first_desc, struct sk_buff *skb,

>  			 struct qlcnic_host_tx_ring *tx_ring)

>  {

> -	u8 l4proto, opcode = 0, hdr_len = 0;

> +	u8 l4proto, opcode = 0, hdr_len = 0, tag_vlan = 0;

>  	u16 flags = 0, vlan_tci = 0;

>  	int copied, offset, copy_len, size;

>  	struct cmd_desc_type0 *hwdesc;

> @@ -472,14 +472,16 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter

> *adapter,

>  		flags = QLCNIC_FLAGS_VLAN_TAGGED;

>  		vlan_tci = ntohs(vh->h_vlan_TCI);

>  		protocol = ntohs(vh->h_vlan_encapsulated_proto);

> +		tag_vlan = 1;

>  	} else if (skb_vlan_tag_present(skb)) {

>  		flags = QLCNIC_FLAGS_VLAN_OOB;

>  		vlan_tci = skb_vlan_tag_get(skb);

> +		tag_vlan = 1;

>  	}

>  	if (unlikely(adapter->tx_pvid)) {

> -		if (vlan_tci && !(adapter->flags &

> QLCNIC_TAGGING_ENABLED))

> +		if (tag_vlan && !(adapter->flags &

> QLCNIC_TAGGING_ENABLED))

>  			return -EIO;

> -		if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED))

> +		if (tag_vlan && (adapter->flags &

> QLCNIC_TAGGING_ENABLED))

>  			goto set_flags;

> 

>  		flags = QLCNIC_FLAGS_VLAN_OOB;

> --

> 2.11.0

> 


It's possible that earlier driver tx flow for zero vlan_tci is handled differently by the driver and hence hardware.
Doing this change would cause changing the driver TX flow for zero vlan_tci [specially setting the things in the TX descriptors would be changed now for zero vlan_tci].
Is it really necessary to change the driver behavior for such change until unless there is functional problem with the driver or hardware in handling zero vlan_tci ?

Thanks.
diff mbox

Patch

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index fedd7366713c..c3cc707cc265 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -459,7 +459,7 @@  static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter,
 			 struct cmd_desc_type0 *first_desc, struct sk_buff *skb,
 			 struct qlcnic_host_tx_ring *tx_ring)
 {
-	u8 l4proto, opcode = 0, hdr_len = 0;
+	u8 l4proto, opcode = 0, hdr_len = 0, tag_vlan = 0;
 	u16 flags = 0, vlan_tci = 0;
 	int copied, offset, copy_len, size;
 	struct cmd_desc_type0 *hwdesc;
@@ -472,14 +472,16 @@  static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter,
 		flags = QLCNIC_FLAGS_VLAN_TAGGED;
 		vlan_tci = ntohs(vh->h_vlan_TCI);
 		protocol = ntohs(vh->h_vlan_encapsulated_proto);
+		tag_vlan = 1;
 	} else if (skb_vlan_tag_present(skb)) {
 		flags = QLCNIC_FLAGS_VLAN_OOB;
 		vlan_tci = skb_vlan_tag_get(skb);
+		tag_vlan = 1;
 	}
 	if (unlikely(adapter->tx_pvid)) {
-		if (vlan_tci && !(adapter->flags & QLCNIC_TAGGING_ENABLED))
+		if (tag_vlan && !(adapter->flags & QLCNIC_TAGGING_ENABLED))
 			return -EIO;
-		if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED))
+		if (tag_vlan && (adapter->flags & QLCNIC_TAGGING_ENABLED))
 			goto set_flags;
 
 		flags = QLCNIC_FLAGS_VLAN_OOB;