bnx2x: tx_start_bd->vlan_or_ethertype is le16
PATCH 1/1 bnx2x: tx_start_bd->vlan_or_ethertype is le16
--- drivers/net/bnx2x/bnx2x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bnx2x/bnx2x.c +2 -1
@@ -2169,7 +2169,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_pstruct ether_hdr *eh = rte_pktmbuf_mtod(m0, struct ether_hdr *); - tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type)); } }
Signature · 1 line
2.1.0
Anyone to review please?
2015-11-03 12:26, Chas Williams:
Quoted 18 lines
Signed-off-by Chas Williams <[email protected]>--- drivers/net/bnx2x/bnx2x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/bnx2x/bnx2x.c +2
-1@@ -2169,7 +2169,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_pstruct ether_hdr *eh = rte_pktmbuf_mtod(m0, struct ether_hdr *); - tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type)); } }
Harish Patil
Acked-byQuoted 18 lines
Anyone to review please?
2015-11-03 12:26, Chas Williams:
Quoted 14 lines
Signed-off-by Chas Williams <[email protected]>--- drivers/net/bnx2x/bnx2x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/bnx2x/bnx2x.c +0
-0@@ -2169,7 +2169,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq,struct
rte_mbuf**m_head, intm_p
structether_hdr*eh
=rte_pktmbuf_mtod(m0, struct ether_hdr *);
Quoted 7 lines
drivers/net/bnx2x/bnx2x.c int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_p · line 2175
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type)); } }
Minor question - any specific reason to use rte_be_to_cpu_16() on ether_type alone before converting from native order to le16?
Thanks,
Harish
________________________________
This message and any attached documents contain information from the sending company or its parent company(s), subsidiaries, divisions or branch offices that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
Quoted 26 lines · On Tue, 1 Dec 2015 21:53:59 +0000 Harish Patil <[email protected]> wrote:
Quoted 18 lines
Anyone to review please?
2015-11-03 12:26, Chas Williams:
Quoted 14 lines
Signed-off-by Chas Williams <[email protected]>--- drivers/net/bnx2x/bnx2x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/bnx2x/bnx2x.c +0
-0@@ -2169,7 +2169,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq,struct
rte_mbuf**m_head, intm_p
structether_hdr*eh
=rte_pktmbuf_mtod(m0, struct ether_hdr *);Quoted 7 lines
drivers/net/bnx2x/bnx2x.c int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_p · line 2175
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type)); } }
Quoted 5 lines
Acked-by Harish Patil <[email protected]>Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?
ether_type is in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.
Quoted 33 lines
Quoted 29 lines · On Tue, 1 Dec 2015 21:53:59 +0000 Harish Patil <[email protected]> wrote:
Quoted 9 lines
Anyone to review please?
2015-11-03 12:26, Chas Williams:
Quoted 5 lines
Signed-off-by Chas Williams <[email protected]>--- drivers/net/bnx2x/bnx2x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Quoted 8 lines
Quoted 8 lines
drivers/net/bnx2x/bnx2x.c +0
-0@@ -2169,7 +2169,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq,struct
rte_mbuf**m_head, intm_p
structether_hdr*eh
= rte_pktmbuf_mtod(m0, struct
ether_hdr*);Quoted 2 lines
Quoted 2 lines
-
tx_start_bd->vlan_or_ethertype=
eh->ether_type;Quoted 2 lines
drivers/net/bnx2x/bnx2x.c
Quoted 2 lines
drivers/net/bnx2x/bnx2x.c +2
-0+ tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
Quoted 4 lines
Quoted 2 lines
} }
Quoted 9 lines
Quoted 5 lines
Acked-by Harish Patil <[email protected]>Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?
ether_typeis in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.
Thanks. Yes the question was for second step, second step would be a no-op on x86 - thanks for clarifying.
________________________________
This message and any attached documents contain information from the sending company or its parent company(s), subsidiaries, divisions or branch offices that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
2015-12-01 14:37, Stephen Hemminger:
Quoted 11 lines
Quoted 9 lines · Harish Patil
Quoted 6 lines
2015-11-03 12:26, Chas Williams:
drivers/net/bnx2x/bnx2x.c int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_p · line 2173
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type));Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?
Quoted 2 lines
ether_typeis in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.
Doesn't it deserve a macro rte_ntole16()?
It may be in lib/librte_eal/common/include/generic/rte_byteorder.h.
Quoted 12 lines · Thomas Monjalon
2015-12-01 14:37, Stephen Hemminger:
Quoted 11 lines
Quoted 9 lines · Harish Patil
Quoted 6 lines
2015-11-03 12:26, Chas Williams:
drivers/net/bnx2x/bnx2x.c int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_p · line 2173
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type));Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?
Quoted 5 lines
Quoted 2 lines
ether_typeis in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.Doesn't it deserve a macro
rte_ntole16()?
It may be inlib/librte_eal/common/include/generic/rte_byteorder.h.
I looked I didn't see anything. This value, according to the linux driver, wants to be little endian regardless of the host endian.
2015-12-01 18:58, Charles Williams:
Quoted 13 lines · Thomas Monjalon
Quoted 12 lines
2015-12-01 14:37, Stephen Hemminger:
Quoted 11 lines
Quoted 9 lines · Harish Patil
Quoted 6 lines
2015-11-03 12:26, Chas Williams:
drivers/net/bnx2x/bnx2x.c int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int m_p · line 2173
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type));Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
ether_typeis in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.Doesn't it deserve a macro
rte_ntole16()?
It may be inlib/librte_eal/common/include/generic/rte_byteorder.h.I looked I didn't see anything. This value, according to the linux driver, wants to be little endian regardless of the host endian.
Yes, that's why I suggest to create some macros to do this kind of conversion.
Example: rte_ntole16 means "network to little endian 16-bit".
Do you think it would be clearer to use?
Quoted 20 lines · Thomas Monjalon
2015-12-01 18:58, Charles Williams:
Quoted 19 lines · Thomas Monjalon
Quoted 17 lines
2015-12-01 14:37, Stephen Hemminger:
Quoted 11 lines
Quoted 9 lines · Harish Patil
Quoted 6 lines
2015-11-03 12:26, Chas Williams:
drivers/net/bnx2x/bnx2x.c
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type));Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?Quoted 2 lines
ether_typeis in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.Doesn't it deserve a macro
rte_ntole16()?
It may be inlib/librte_eal/common/include/generic/rte_byteorder.h.
Quoted 6 lines
Quoted 2 lines
I looked I didn't see anything. This value, according to the linux driver, wants to be little endian regardless of the host endian.
Yes, that's why I suggest to create some macros to do this kind of conversion.
Example:rte_ntole16means "network to little endian 16-bit".
Do you think it would be clearer to use?
This is the only example of this kind of conversion in the source code so it would be a macro for one user. If you create rte_ntole16() you might feel obligated to create the various permutations for which there are no consumers.
2015-12-02 05:18, Charles Williams:
Quoted 24 lines · Thomas Monjalon
Quoted 23 lines
2015-12-01 18:58, Charles Williams:
Quoted 21 lines · Thomas Monjalon
Quoted 12 lines
2015-12-01 14:37, Stephen Hemminger:
Quoted 11 lines
Quoted 9 lines · Harish Patil
Quoted 6 lines
2015-11-03 12:26, Chas Williams:
drivers/net/bnx2x/bnx2x.c
Quoted 5 lines
drivers/net/bnx2x/bnx2x.c +2
-1- tx_start_bd->vlan_or_ethertype = eh->ether_type; + tx_start_bd->vlan_or_ethertype + =rte_cpu_to_le_16 (rte_be_to_cpu_16 (eh->ether_type));Minor question - any specific reason to use
rte_be_to_cpu_16()onether_typealone before converting from native order to le16?Quoted 5 lines
Quoted 2 lines
ether_typeis in network byte order (big endian)
and hardware wants little endian. On x86 the second step is a nop.Doesn't it deserve a macro
rte_ntole16()?
It may be inlib/librte_eal/common/include/generic/rte_byteorder.h.I looked I didn't see anything. This value, according to the linux driver, wants to be little endian regardless of the host endian.
Quoted 8 lines
Quoted 3 lines
Yes, that's why I suggest to create some macros to do this kind of conversion.
Example:rte_ntole16means "network to little endian 16-bit".
Do you think it would be clearer to use?This is the only example of this kind of conversion in the source code so it would be a macro for one user. If you create
rte_ntole16()you might feel obligated to create the various permutations for which there are no consumers.
Yes, that's why I was not sure of the interest.
Thomas Monjalon
AppliedQuoted 3 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Chas Williams <[email protected]>Acked-by Harish Patil <[email protected]>
Applied, thanks