net/bnx2x: handle guest vlan for SR-IOV case
PATCH v2 1/1 net/bnx2x: handle guest vlan for SR-IOV case
In case of bnx2xvf pmd, tx packets can support vland id in 2 ways :
1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the vlanid in mbuf->vlan_tci.
2. the tx packet itself has the vlan id included in the packet. The first case is working as expected but the second case where the vlan id is included in thetx packets itself was found not working as expected. To handle that we need to properly set the start_bd bitfield and the vlan_or_ethertype instead of setting it to just the ethertype in case of VF.
---
v2:
* Fix compilation issues.
* Changed the Subject Line as recommended.
drivers/net/bnx2x/bnx2x.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/net/bnx2x/bnx2x.c +17 -3
@@ -2216,11 +2216,25 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype =rte_cpu_to_le_16 (pkt_prod); else { +/* when transmitting in a vf, start bd must hold the ethertype +* for fw to enforce it +*/ struct rte_ether_hdr *eh = rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); - - tx_start_bd->vlan_or_ethertype = -rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type)); +/* Still need to consider inband vlan for enforced */ +if (eh->ether_type ==rte_cpu_to_be_16 (RTE_ETHER_TYPE_VLAN )) { +struct rte_vlan_hdr *vh = + (struct rte_vlan_hdr *)(eh +1 ); + tx_start_bd->bd_flags.as_bitfield |= + (X_ETH_INBAND_VLAN << +ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT ); + tx_start_bd->vlan_or_ethertype = +rte_cpu_to_le_16 (ntohs (vh->vlan_tci)); + }else { + tx_start_bd->vlan_or_ethertype = + (rte_cpu_to_le_16 + (rte_be_to_cpu_16 (eh->ether_type))); + } } }
Signature · 9 lines
2.9.3 ----------------------------------------------------------------------------------------------------------------------- Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments. -----------------------------------------------------------------------------------------------------------------------
Quoted 13 lines
From: dev <[email protected]> On Behalf Of Dey, Souvik
Sent: Monday, March 02, 2020 5:29 PMIn case of bnx2xvf pmd, tx packets can support vland id in 2 ways :
1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the vlanid inmbuf->vlan_tci.
2. the tx packet itself has the vlan id included in the packet. The first case is working as expected but the second case where the vlan id is included in thetx packets itself was found not working as expected. To handle that we need to properly set thestart_bdbitfield and thevlan_or_ethertypeinstead of setting it to just the ethertype in case of VF.
Quoted 2 lines
Signed-off-by "Dey, Souvik" <[email protected]>---
May be it would be good to use --in-reply-to when generating the patch and resubmit. This will ensure it lands up in the same thread as the first patch.
http://mails.dpdk.org/archives/test-report/2020-March/119108.html
Quoted 52 lines
v2:
* Fix compilation issues.
* Changed the Subject Line as recommended.
drivers/net/bnx2x/bnx2x.c| 20 +++++++++++++++++---1 file changed, 17 insertions(+), 3 deletions(-)drivers/net/bnx2x/bnx2x.c index renamed from drivers/net/bnx2x/bnx2x.c +0
-00b4030e..0afa602 100644
drivers/net/bnx2x/bnx2x.c +1
-0@@ -2216,11 +2216,25 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype =rte_cpu_to_le_16 (pkt_prod); else { +/* when transmitting in a vf, start bd must hold the ethertype
drivers/net/bnx2x/bnx2x.c +2
-0+* for fw to enforce it +*/ struct rte_ether_hdr *eh = rte_pktmbuf_mtod(m0, struct rte_ether_hdr *);drivers/net/bnx2x/bnx2x.c +0
-3- - tx_start_bd->vlan_or_ethertype = - rte_cpu_to_le_16(rte_be_to_cpu_16(eh-Quoted 1 line
ether_type));drivers/net/bnx2x/bnx2x.c +2
-0+/* Still need to consider inband vlan for enforced */ + if (eh->ether_type ==
rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {drivers/net/bnx2x/bnx2x.c +5
-0+struct rte_vlan_hdr *vh = + (struct rte_vlan_hdr *)(eh +1 ); + tx_start_bd->bd_flags.as_bitfield |= + (X_ETH_INBAND_VLAN << +ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);drivers/net/bnx2x/bnx2x.c +2
-0+ tx_start_bd->vlan_or_ethertype = + rte_cpu_to_le_16(ntohs(vh-Quoted 1 line
vlan_tci));drivers/net/bnx2x/bnx2x.c +4
-0+ }else { + tx_start_bd->vlan_or_ethertype = + (rte_cpu_to_le_16 + (rte_be_to_cpu_16(eh-Quoted 1 line
ether_type)));drivers/net/bnx2x/bnx2x.c +1
-0+ }} }--
2.9.3
Quoted 12 lines
-----------------------------------------------------------------------------------------------
------------------------
Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that
is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or
distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended
recipient, please notify the sender immediately and then delete all copies, including any attachments.
-----------------------------------------------------------------------------------------------
------------------------
When we are doing open source work, the contents of above footer is not compatible with what we are doing. Please remove the footer in patches and mailing list interactions for future.
Dey, Souvik
Acked-by Rasesh ModyThanks will do that. And will also try to remove the trailer in the patches. Thanks for pointing it out.
From: dev <[email protected]> On Behalf Of Rasesh Mody
Sent: Tuesday, March 3, 2020 6:01 PM
To: Dey, Souvik <[email protected]>; Shahed Shaikh <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/bnx2x: handle guest vlan for SR-IOV case
________________________________
NOTICE: This email was received from an EXTERNAL sender
________________________________
Quoted 13 lines
From: dev <[email protected]<mailto:[email protected]>> On Behalf Of Dey, Souvik
Sent: Monday, March 02, 2020 5:29 PMIn case of bnx2xvf pmd, tx packets can support vland id in 2 ways :
1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the vlanid inmbuf->vlan_tci.
2. the tx packet itself has the vlan id included in the packet. The first case is working as expected but the second case where the vlan id is included in thetx packets itself was found not working as expected. To handle that we need to properly set thestart_bdbitfield and thevlan_or_ethertypeinstead of setting it to just the ethertype in case of VF.
Quoted 2 lines
---
May be it would be good to use --in-reply-to when generating the patch and resubmit. This will ensure it lands up in the same thread as the first patch.
http://mails.dpdk.org/archives/test-report/2020-March/119108.html<http://mails.dpdk.org/archives/test-report/2020-March/119108.html>
Quoted 52 lines
v2:
* Fix compilation issues.
* Changed the Subject Line as recommended.
drivers/net/bnx2x/bnx2x.c| 20 +++++++++++++++++---1 file changed, 17 insertions(+), 3 deletions(-)drivers/net/bnx2x/bnx2x.c index renamed from drivers/net/bnx2x/bnx2x.c +0
-00b4030e..0afa602 100644
drivers/net/bnx2x/bnx2x.c +0
-0@@ -2216,11 +2216,25 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0)
tx_start_bd->vlan_or_ethertype=rte_cpu_to_le_16(pkt_prod);
else {
+ /* when transmitting in a vf, start bd must hold the ethertype
+ * for fw to enforce it
+ */
structrte_ether_hdr*eh =rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); -
-tx_start_bd->vlan_or_ethertype=
- rte_cpu_to_le_16(rte_be_to_cpu_16(eh-Quoted 1 line
ether_type));+ /* Still need to consider inband vlan for enforced */
+ if (eh->ether_type==rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
+ structrte_vlan_hdr*vh =
+ (structrte_vlan_hdr*)(eh + 1);
+tx_start_bd->bd_flags.as_bitfield|=
+ (X_ETH_INBAND_VLAN<<
+ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
+tx_start_bd->vlan_or_ethertype=
+ rte_cpu_to_le_16(ntohs(vh-Quoted 1 line
vlan_tci));+ } else {
+tx_start_bd->vlan_or_ethertype=
+ (rte_cpu_to_le_16
+ (rte_be_to_cpu_16(eh-Quoted 1 line
ether_type)));+ }
}
}--
2.9.3
Quoted 12 lines
-----------------------------------------------------------------------------------------------
------------------------
Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that
is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or
distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended
recipient, please notify the sender immediately and then delete all copies, including any attachments.
-----------------------------------------------------------------------------------------------
------------------------
When we are doing open source work, the contents of above footer is not compatible with what we are doing. Please remove the footer in patches and mailing list interactions for future.
-----------------------------------------------------------------------------------------------------------------------
Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments.
-----------------------------------------------------------------------------------------------------------------------
Quoted 8 lines · Souvik
Thanks will do that. And will also try to remove the trailer in the patches. Thanks for pointing it out.
From: dev <[email protected]> On Behalf Of Rasesh Mody
Sent: Tuesday, March 3, 2020 6:01 PM
To: Dey, Souvik <[email protected]>; Shahed Shaikh <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/bnx2x: handle guest vlan for SR-IOV case
1) Please change vlan to VLAN
2) Fix the following checkpatch issue. Probably move the new code to a new function
to get enough space.
[master][dpdk-next-net-mrvl] $ ./devtools/checkpatches.sh
### net/bnx2x: handle guest VLAN for SR-IOV case
WARNING:BAD_SIGN_OFF: email address '"Dey Souvik" <[email protected]>' might be better as 'Dey Souvik <[email protected]>'
#16:
WARNING:LONG_LINE_COMMENT: line over 80 characters #27: FILE: drivers/net/bnx2x/bnx2x.c:2219:
+ /* when transmitting in a vf, start bd must
hold the ethertype
WARNING:LONG_LINE: line over 80 characters
#36: FILE: drivers/net/bnx2x/bnx2x.c:2225:
+ if (eh->ether_type ==rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
WARNING:LONG_LINE: line over 80 characters
#41: FILE: drivers/net/bnx2x/bnx2x.c:2230:
+ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
WARNING:LONG_LINE: line over 80 characters
#47: FILE: drivers/net/bnx2x/bnx2x.c:2236:
+
(rte_be_to_cpu_16(eh->ether_type)));
WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Dey, Souvik <[email protected]>'
total: 0 errors, 6 warnings, 0 checks, 28 lines checked
0/1 valid patch
----------------------------------------------------------------------------
PATCH v3 1/1 net/bnx2x: handle guest VLAN for SR-IOV case
In reply to Dey, SouvikFrom: Souvik Dey <[email protected]>
In case of bnx2xvf pmd, tx packets can support vland id in 2 ways:
1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the vlanid in mbuf->vlan_tci.
2. the tx packet itself has the vlan id included in the packet. The first case is working as expected but the second case where the vlan id is included in thetx packets itself was found not working as expected. To handle that we need to properly set the start_bd bitfield and the vlan_or_ethertype instead of setting it to just the ethertype in case of VF.
---
v3:
* Fixed the checkpatch issue.
* Changed vlan to VLAN in the headline.
v2:
* Fix compilation issues.
* Changed the Subject Line as recommended.
drivers/net/bnx2x/bnx2x.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/net/bnx2x/bnx2x.c +18 -2
@@ -2216,11 +2216,27 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype =rte_cpu_to_le_16 (pkt_prod); else { +/* when transmitting in a vf, start bd +* must hold the ethertype for fw to enforce it +*/ struct rte_ether_hdr *eh = rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); - tx_start_bd->vlan_or_ethertype = -rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type)); +/* Still need to consider inband vlan for enforced */ +if (eh->ether_type == +rte_cpu_to_be_16 (RTE_ETHER_TYPE_VLAN )) { +struct rte_vlan_hdr *vh = + (struct rte_vlan_hdr *)(eh +1 ); + tx_start_bd->bd_flags.as_bitfield |= + (X_ETH_INBAND_VLAN << +ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT ); + tx_start_bd->vlan_or_ethertype = +rte_cpu_to_le_16 (ntohs (vh->vlan_tci)); + }else { + tx_start_bd->vlan_or_ethertype = + (rte_cpu_to_le_16 + (rte_be_to_cpu_16 (eh->ether_type))); + } } }
Signature · 1 line
2.9.3.windows.1
Just for reference also attached the changed patch in text format with the changes requested below. Have raised a v3 of the patch too. Now bit ceckpatches and check-git-logs works fine and also updated vlan to VLAN.
--
Thanks,
Souvik
From: Jerin Jacob <[email protected]>
Sent: Sunday, April 5, 2020 9:06 AM
To: Dey, Souvik <[email protected]>
Cc: Rasesh Mody <[email protected]>; Shahed Shaikh <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/bnx2x: handle guest vlan for SR-IOV case
________________________________
NOTICE: This email was received from an EXTERNAL sender
________________________________
Quoted 8 lines · On Thu, Mar 5, 2020 at 7:21 PM Dey, Souvik…
Thanks will do that. And will also try to remove the trailer in the patches. Thanks for pointing it out.
From: dev <[email protected]<mailto:[email protected]>> On Behalf Of Rasesh Mody
Sent: Tuesday, March 3, 2020 6:01 PM
To: Dey, Souvik <[email protected]<mailto:[email protected]>>; Shahed Shaikh <[email protected]<mailto:[email protected]>>; Jerin Jacob Kollanukkaran <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/bnx2x: handle guest vlan for SR-IOV case
1) Please change vlan to VLAN
2) Fix the following checkpatch issue. Probably move the new code to a new function
to get enough space.
[master][dpdk-next-net-mrvl] $ ./devtools/checkpatches.sh
### net/bnx2x: handle guest VLAN for SR-IOV case
WARNING:BAD_SIGN_OFF: email address '"Dey Souvik" <[email protected]<mailto:[email protected]>>' might be better as 'Dey Souvik <[email protected]<mailto:[email protected]>>' #16:
WARNING:LONG_LINE_COMMENT: line over 80 characters #27: FILE: drivers/net/bnx2x/bnx2x.c:2219:
+ /* when transmitting in a vf, start bd must hold the ethertype
WARNING:LONG_LINE: line over 80 characters
#36: FILE: drivers/net/bnx2x/bnx2x.c:2225:
+ if (eh->ether_type ==rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
WARNING:LONG_LINE: line over 80 characters
#41: FILE: drivers/net/bnx2x/bnx2x.c:2230:
+ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
WARNING:LONG_LINE: line over 80 characters
#47: FILE: drivers/net/bnx2x/bnx2x.c:2236:
+
(rte_be_to_cpu_16(eh->ether_type)));
WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Dey, Souvik <[email protected]<mailto:[email protected]>>'
total: 0 errors, 6 warnings, 0 checks, 28 lines checked
0/1 valid patch
----------------------------------------------------------------------------