[dpdk-dev,2/8] net/vmxnet3: return unknown IPv4 extension len ptype

Message ID 20180328154349.24976-3-didier.pallard@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Didier Pallard March 28, 2018, 3:43 p.m. UTC
  Rather than parsing IP header to get proper ptype to return, just return
RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, that tells application that we have an IP
packet with unknown header length.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
  

Comments

Yong Wang April 16, 2018, 7:46 p.m. UTC | #1
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Didier Pallard

> Sent: Wednesday, March 28, 2018 8:44 AM

> To: dev@dpdk.org

> Subject: [dpdk-dev] [PATCH 2/8] net/vmxnet3: return unknown IPv4

> extension len ptype

> 

> Rather than parsing IP header to get proper ptype to return, just return

> RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, that tells application that we have an

> IP

> packet with unknown header length.


Any specific reason of doing this? I can image there are applications that depend on this and the cost of parsing is simply shifted to the app or via rte_eth_add_rx_callback().

> 

> Signed-off-by: Didier Pallard <didier.pallard@6wind.com>

> ---

>  drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +-------

>  1 file changed, 1 insertion(+), 7 deletions(-)

> 

> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c

> b/drivers/net/vmxnet3/vmxnet3_rxtx.c

> index 3a8c62fc1..156dc8e52 100644

> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c

> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c

> @@ -659,13 +659,7 @@ vmxnet3_rx_offload(const Vmxnet3_RxCompDesc

> *rcd, struct rte_mbuf *rxm)

> 

>  	/* Check packet type, checksum errors, etc. Only support IPv4 for

> now. */

>  	if (rcd->v4) {

> -		struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct

> ether_hdr *);

> -		struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);

> -

> -		if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr))

> -			rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT;

> -		else

> -			rxm->packet_type = RTE_PTYPE_L3_IPV4;

> +		rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;

> 

>  		if (!rcd->cnc) {

>  			if (!rcd->ipc)

> --

> 2.11.0
  
Didier Pallard April 17, 2018, 9:09 a.m. UTC | #2
Hi wang,

Indeed, this one is not strictly needed and does not fix anything, anyway:

- If application does not need the information (ethernet bridge, for 
example),
this access is not needed and it will never be done, so application 
performance
will be improved.

- If application needs the information, you're true, the parsing will 
just  be shifted
to the application procedure, but I think that data access locality will 
be increased
since the application will certainly do other stuff around the same 
memory location.
And in this case, final performance figures should be at worst the same 
than before the
patch.

Didier


On 04/16/2018 09:46 PM, Yong Wang wrote:
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Didier Pallard
>> Sent: Wednesday, March 28, 2018 8:44 AM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH 2/8] net/vmxnet3: return unknown IPv4
>> extension len ptype
>>
>> Rather than parsing IP header to get proper ptype to return, just return
>> RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, that tells application that we have an
>> IP
>> packet with unknown header length.
> Any specific reason of doing this? I can image there are applications that depend on this and the cost of parsing is simply shifted to the app or via rte_eth_add_rx_callback().
>
>> Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
>> ---
>>   drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> b/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> index 3a8c62fc1..156dc8e52 100644
>> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> @@ -659,13 +659,7 @@ vmxnet3_rx_offload(const Vmxnet3_RxCompDesc
>> *rcd, struct rte_mbuf *rxm)
>>
>>   	/* Check packet type, checksum errors, etc. Only support IPv4 for
>> now. */
>>   	if (rcd->v4) {
>> -		struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct
>> ether_hdr *);
>> -		struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
>> -
>> -		if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr))
>> -			rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT;
>> -		else
>> -			rxm->packet_type = RTE_PTYPE_L3_IPV4;
>> +		rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
>>
>>   		if (!rcd->cnc) {
>>   			if (!rcd->ipc)
>> --
>> 2.11.0
  

Patch

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 3a8c62fc1..156dc8e52 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -659,13 +659,7 @@  vmxnet3_rx_offload(const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm)
 
 	/* Check packet type, checksum errors, etc. Only support IPv4 for now. */
 	if (rcd->v4) {
-		struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct ether_hdr *);
-		struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
-
-		if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr))
-			rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT;
-		else
-			rxm->packet_type = RTE_PTYPE_L3_IPV4;
+		rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
 
 		if (!rcd->cnc) {
 			if (!rcd->ipc)