DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Ferruh Yigit'" <ferruh.yigit@intel.com>, <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 01/32] net/ngbe: add packet type
Date: Wed, 22 Sep 2021 16:01:20 +0800	[thread overview]
Message-ID: <004801d7af88$08249ff0$186ddfd0$@trustnetic.com> (raw)
In-Reply-To: <c2412b5a-afcb-ff87-e6a5-bc037e79b432@intel.com>

On September 16, 2021 12:48 AM, Ferruh Yigit wrote:
> On 9/8/2021 9:37 AM, Jiawen Wu wrote:
> > Add packet type marco definition and convert ptype to ptid.
> >
> > Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> > ---
> >  doc/guides/nics/features/ngbe.ini |   1 +
> >  doc/guides/nics/ngbe.rst          |   1 +
> >  drivers/net/ngbe/meson.build      |   1 +
> >  drivers/net/ngbe/ngbe_ethdev.c    |   9 +
> >  drivers/net/ngbe/ngbe_ethdev.h    |   4 +
> >  drivers/net/ngbe/ngbe_ptypes.c    | 300
> ++++++++++++++++++++++++++++++
> >  drivers/net/ngbe/ngbe_ptypes.h    | 240 ++++++++++++++++++++++++
> >  drivers/net/ngbe/ngbe_rxtx.c      |  16 ++
> >  drivers/net/ngbe/ngbe_rxtx.h      |   2 +
> >  9 files changed, 574 insertions(+)
> >  create mode 100644 drivers/net/ngbe/ngbe_ptypes.c  create mode
> 100644
> > drivers/net/ngbe/ngbe_ptypes.h
> >
> > diff --git a/doc/guides/nics/features/ngbe.ini
> > b/doc/guides/nics/features/ngbe.ini
> > index 08d5f1b0dc..8b7588184a 100644
> > --- a/doc/guides/nics/features/ngbe.ini
> > +++ b/doc/guides/nics/features/ngbe.ini
> > @@ -8,6 +8,7 @@ Speed capabilities   = Y
> >  Link status          = Y
> >  Link status event    = Y
> >  Queue start/stop     = Y
> > +Packet type parsing  = Y
> 
> "Packet type parsing" also requires to support
> 'rte_eth_dev_get_supported_ptypes()' & 'rte_eth_dev_set_ptypes()' APIs.
> 
> Current implementation seems parses the packet type and updates mbuf field
> for it but doesn't support above APIs, can you please add them too? There is
> already 'ngbe_dev_supported_ptypes_get()' function but dev_ops seems not
> set.
> 

Oops.., I forgot it.

> <...>
> 
> > +++ b/drivers/net/ngbe/ngbe_ptypes.c
> > @@ -0,0 +1,300 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
> > + */
> > +
> > +#include <rte_mbuf.h>
> > +#include <rte_memory.h>
> > +
> > +#include "base/ngbe_type.h"
> > +#include "ngbe_ptypes.h"
> > +
> > +/* The ngbe_ptype_lookup is used to convert from the 8-bit ptid in
> > +the
> > + * hardware to a bit-field that can be used by SW to more easily
> > +determine the
> > + * packet type.
> > + *
> > + * Macros are used to shorten the table lines and make this table
> > +human
> > + * readable.
> > + *
> > + * We store the PTYPE in the top byte of the bit field - this is just
> > +so that
> > + * we can check that the table doesn't have a row missing, as the
> > +index into
> > + * the table should be the PTYPE.
> > + */
> > +#define TPTE(ptid, l2, l3, l4, tun, el2, el3, el4) \
> > +	[ptid] = (RTE_PTYPE_L2_##l2 | \
> > +		RTE_PTYPE_L3_##l3 | \
> > +		RTE_PTYPE_L4_##l4 | \
> > +		RTE_PTYPE_TUNNEL_##tun | \
> > +		RTE_PTYPE_INNER_L2_##el2 | \
> > +		RTE_PTYPE_INNER_L3_##el3 | \
> > +		RTE_PTYPE_INNER_L4_##el4)
> > +
> > +#define RTE_PTYPE_L2_NONE               0
> > +#define RTE_PTYPE_L3_NONE               0
> > +#define RTE_PTYPE_L4_NONE               0
> > +#define RTE_PTYPE_TUNNEL_NONE           0
> > +#define RTE_PTYPE_INNER_L2_NONE         0
> > +#define RTE_PTYPE_INNER_L3_NONE         0
> > +#define RTE_PTYPE_INNER_L4_NONE         0
> 
> Why you are defining new PTYPEs? If these are for driver internal you can drop
> the 'RTE_' prefix.
> 

I just want to use short macros, to make the lookup table readable.
So it needs 'RTE_' prefix here, to be compatible with other RTE mbuf packet types.

> <...>
> 
> > +
> > +#ifndef RTE_PTYPE_UNKNOWN
> > +#define RTE_PTYPE_UNKNOWN                   0x00000000
> > +#define RTE_PTYPE_L2_ETHER                  0x00000001
> > +#define RTE_PTYPE_L2_ETHER_TIMESYNC         0x00000002
> > +#define RTE_PTYPE_L2_ETHER_ARP              0x00000003
> > +#define RTE_PTYPE_L2_ETHER_LLDP             0x00000004
> > +#define RTE_PTYPE_L2_ETHER_NSH              0x00000005
> > +#define RTE_PTYPE_L2_ETHER_FCOE             0x00000009
> > +#define RTE_PTYPE_L3_IPV4                   0x00000010
> > +#define RTE_PTYPE_L3_IPV4_EXT               0x00000030
> > +#define RTE_PTYPE_L3_IPV6                   0x00000040
> > +#define RTE_PTYPE_L3_IPV4_EXT_UNKNOWN       0x00000090
> > +#define RTE_PTYPE_L3_IPV6_EXT               0x000000c0
> > +#define RTE_PTYPE_L3_IPV6_EXT_UNKNOWN       0x000000e0
> > +#define RTE_PTYPE_L4_TCP                    0x00000100
> > +#define RTE_PTYPE_L4_UDP                    0x00000200
> > +#define RTE_PTYPE_L4_FRAG                   0x00000300
> > +#define RTE_PTYPE_L4_SCTP                   0x00000400
> > +#define RTE_PTYPE_L4_ICMP                   0x00000500
> > +#define RTE_PTYPE_L4_NONFRAG                0x00000600
> > +#define RTE_PTYPE_TUNNEL_IP                 0x00001000
> > +#define RTE_PTYPE_TUNNEL_GRE                0x00002000
> > +#define RTE_PTYPE_TUNNEL_VXLAN              0x00003000
> > +#define RTE_PTYPE_TUNNEL_NVGRE              0x00004000
> > +#define RTE_PTYPE_TUNNEL_GENEVE             0x00005000
> > +#define RTE_PTYPE_TUNNEL_GRENAT             0x00006000
> > +#define RTE_PTYPE_INNER_L2_ETHER            0x00010000
> > +#define RTE_PTYPE_INNER_L2_ETHER_VLAN       0x00020000
> > +#define RTE_PTYPE_INNER_L3_IPV4             0x00100000
> > +#define RTE_PTYPE_INNER_L3_IPV4_EXT         0x00200000
> > +#define RTE_PTYPE_INNER_L3_IPV6             0x00300000
> > +#define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
> > +#define RTE_PTYPE_INNER_L3_IPV6_EXT         0x00500000
> > +#define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
> > +#define RTE_PTYPE_INNER_L4_TCP              0x01000000
> > +#define RTE_PTYPE_INNER_L4_UDP              0x02000000
> > +#define RTE_PTYPE_INNER_L4_FRAG             0x03000000
> > +#define RTE_PTYPE_INNER_L4_SCTP             0x04000000
> > +#define RTE_PTYPE_INNER_L4_ICMP             0x05000000
> > +#define RTE_PTYPE_INNER_L4_NONFRAG          0x06000000
> > +#endif /* !RTE_PTYPE_UNKNOWN */
> 
> These are already defined in the mbuf public header, why there are defined
> again?
> 

These can be removed directly. They were written previously for version compatibility.

> <...>
> 
> > @@ -378,6 +389,10 @@ ngbe_recv_pkts(void *rx_queue, struct rte_mbuf
> **rx_pkts,
> >  		rxm->data_len = pkt_len;
> >  		rxm->port = rxq->port_id;
> >
> > +		pkt_info = rte_le_to_cpu_32(rxd.qw0.dw0);
> > +		rxm->packet_type = ngbe_rxd_pkt_info_to_pkt_type(pkt_info,
> > +						       rxq->pkt_type_mask);
> > +
> >  		/*
> >  		 * Store the mbuf address into the next entry of the array
> >  		 * of returned packets.
> > @@ -799,6 +814,7 @@ ngbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
> >  	rxq->port_id = dev->data->port_id;
> >  	rxq->drop_en = rx_conf->rx_drop_en;
> >  	rxq->rx_deferred_start = rx_conf->rx_deferred_start;
> > +	rxq->pkt_type_mask = NGBE_PTID_MASK;
> 
> What is the use of the 'pkt_type_mask', it seems it is a fixed value, why keeping
> it per queue?




  reply	other threads:[~2021-09-22  8:01 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08  8:37 [dpdk-dev] [PATCH 00/32] net/ngbe: add many features Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 01/32] net/ngbe: add packet type Jiawen Wu
2021-09-15 16:47   ` Ferruh Yigit
2021-09-22  8:01     ` Jiawen Wu [this message]
2021-09-08  8:37 ` [dpdk-dev] [PATCH 02/32] net/ngbe: support scattered Rx Jiawen Wu
2021-09-15 13:22   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 03/32] net/ngbe: support Rx checksum offload Jiawen Wu
2021-09-15 16:48   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 04/32] net/ngbe: support TSO Jiawen Wu
2021-09-15 16:57   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 05/32] net/ngbe: support CRC offload Jiawen Wu
2021-09-15 16:48   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 06/32] net/ngbe: support jumbo frame Jiawen Wu
2021-09-15 16:48   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 07/32] net/ngbe: support VLAN and QinQ offload Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 08/32] net/ngbe: support basic statistics Jiawen Wu
2021-09-15 16:50   ` Ferruh Yigit
2021-10-14  2:51     ` Jiawen Wu
2021-10-14  7:59       ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 09/32] net/ngbe: support device xstats Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 10/32] net/ngbe: support MTU set Jiawen Wu
2021-09-15 16:52   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 11/32] net/ngbe: add device promiscuous and allmulticast mode Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 12/32] net/ngbe: support getting FW version Jiawen Wu
2021-09-15 16:53   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 13/32] net/ngbe: add loopback mode Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 14/32] net/ngbe: support Rx interrupt Jiawen Wu
2021-09-15 16:53   ` Ferruh Yigit
2021-10-14 10:11     ` Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 15/32] net/ngbe: support MAC filters Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 16/32] net/ngbe: support VLAN filter Jiawen Wu
2021-09-15 16:54   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 17/32] net/ngbe: support RSS hash Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 18/32] net/ngbe: support SRIOV Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 19/32] net/ngbe: add mailbox process operations Jiawen Wu
2021-09-15 16:56   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 20/32] net/ngbe: support flow control Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 21/32] net/ngbe: support device LED on and off Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 22/32] net/ngbe: support EEPROM dump Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 23/32] net/ngbe: support register dump Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 24/32] net/ngbe: support timesync Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 25/32] net/ngbe: add Rx and Tx queue info get Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 26/32] net/ngbe: add Rx and Tx descriptor status Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 27/32] net/ngbe: add Tx done cleanup Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 28/32] net/ngbe: add IPsec context creation Jiawen Wu
2021-09-15 16:58   ` Ferruh Yigit
2021-09-16  9:00     ` Hemant Agrawal
2021-09-16 17:15       ` Ferruh Yigit
2021-09-16  9:04   ` Hemant Agrawal
2021-09-08  8:37 ` [dpdk-dev] [PATCH 29/32] net/ngbe: create and destroy security session Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 30/32] net/ngbe: support security operations Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 31/32] net/ngbe: add security offload in Rx and Tx Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 32/32] doc: update for ngbe Jiawen Wu
2021-09-15 16:58   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004801d7af88$08249ff0$186ddfd0$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).