diff mbox

[dpdk-dev,v4,05/12] pmd/fm10k: add dev_ptype_info_get implementation

Message ID 4341B239C0EFF9468EE453F9E9F4604D04453611@shsmsx102.ccr.corp.intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Chen, Jing D March 2, 2016, 8:11 p.m. UTC
Hi,

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jianfeng Tan
Sent: Thursday, February 25, 2016 6:09 PM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 05/12] pmd/fm10k: add dev_ptype_info_get implementation

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c   | 50 ++++++++++++++++++++++++++++++++++++++
 drivers/net/fm10k/fm10k_rxtx.c     |  3 +++
 drivers/net/fm10k/fm10k_rxtx_vec.c |  3 +++
 3 files changed, 56 insertions(+)

Comments

Jianfeng Tan March 3, 2016, 6:03 a.m. UTC | #1
Hi,

On 3/3/2016 4:11 AM, Chen, Jing D wrote:
> Hi,
>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jianfeng Tan
> Sent: Thursday, February 25, 2016 6:09 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 05/12] pmd/fm10k: add dev_ptype_info_get implementation
>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
>   drivers/net/fm10k/fm10k_ethdev.c   | 50 ++++++++++++++++++++++++++++++++++++++
>   drivers/net/fm10k/fm10k_rxtx.c     |  3 +++
>   drivers/net/fm10k/fm10k_rxtx_vec.c |  3 +++
>   3 files changed, 56 insertions(+)
>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> index 421266b..429cbdd 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -1335,6 +1335,55 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
>   	};
>   }
>   
> +#ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE
> +static const uint32_t *
> +fm10k_dev_ptype_info_get(struct rte_eth_dev *dev) {
> +	if (dev->rx_pkt_burst == fm10k_recv_pkts ||
> +	    dev->rx_pkt_burst == fm10k_recv_scattered_pkts) {
> +		static uint32_t ptypes[] = {
> +			/* refers to rx_desc_to_ol_flags() */
> +			RTE_PTYPE_L2_ETHER,
> +			RTE_PTYPE_L3_IPV4,
> +			RTE_PTYPE_L3_IPV4_EXT,
> +			RTE_PTYPE_L3_IPV6,
> +			RTE_PTYPE_L3_IPV6_EXT,
> +			RTE_PTYPE_L4_TCP,
> +			RTE_PTYPE_L4_UDP,
> +			RTE_PTYPE_UNKNOWN
> +		};
> +
> +		return ptypes;
> +	} else if (dev->rx_pkt_burst == fm10k_recv_pkts_vec ||
> +		   dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec) {
> +		static uint32_t ptypes_vec[] = {
> +			/* refers to fm10k_desc_to_pktype_v() */
> +			RTE_PTYPE_L3_IPV4,
> +			RTE_PTYPE_L3_IPV4_EXT,
> +			RTE_PTYPE_L3_IPV6,
> +			RTE_PTYPE_L3_IPV6_EXT,
> +			RTE_PTYPE_L4_TCP,
> +			RTE_PTYPE_L4_UDP,
> +			RTE_PTYPE_TUNNEL_GENEVE,
> +			RTE_PTYPE_TUNNEL_NVGRE,
> +			RTE_PTYPE_TUNNEL_VXLAN,
> +			RTE_PTYPE_TUNNEL_GRE,
> +			RTE_PTYPE_UNKNOWN
> +		};
> +
> +		return ptypes_vec;
> +	}
> +
> +	return NULL;
> +}
> May I know when " fm10k_dev_ptype_info_get " will be called? In fm10k, the actual
> Rx/tx func will be decided after port is started.

Thank you for pointing out this. It's indeed an issue here. And it makes 
no difference when all rx functions fill the same ptypes, which, 
unfortunately, does not apply to all PMDs. According to my analysis, 
only in fm10k's case, we should call ptype_info_get after dev_start(), 
and for other PMDs, it can called just after rx_queue_setup. So in all, 
I need to add this as a caution in API declaration.

__details__

eth_cxgbe_dev_init

eth_igb_dev_init
eth_igbvf_dev_init
eth_igb_rx_init <- eth_igb_start (makes no difference, rx functins fill 
same ptypes)
eth_igbvf_rx_init <- igbvf_dev_start (makes no difference, rx functins 
fill same ptypes)

eth_enicpmd_dev_init

fm10k_set_rx_function <- fm10k_dev_rx_init <- fm10k_dev_start

eth_i40e_dev_init
i40evf_dev_init
i40e_set_rx_function <- eth_i40e_dev_init
                                      <- i40evf_dev_init
                                      <- i40e_dev_rx_init <- 
i40e_dev_rxtx_init <- i40e_dev_start (makes no difference, rx functins 
fill same ptypes)
                                      <- i40evf_rx_init <- 
i40evf_dev_start (makes no difference, rx functins fill same ptypes)

ixgbe_set_rx_function <- eth_ixgbe_dev_init
                                        <- ixgbe_dev_rx_init <- 
ixgbe_dev_start (makes no difference, rx functions fill same ptypes)
                                        <- ixgbevf_dev_rx_init

mlx4_rx_queue_setup
mlx4_dev_set_mtu (makes no difference, rx functions fill same ptypes)

mlx5_rx_queue_setup
mlx5_dev_set_mtu (makes no difference, rx functions fill same ptypes)

nfp_net_init

eth_vmxnet3_dev_init

Thanks,
Jianfeng
Ananyev, Konstantin March 3, 2016, 3:47 p.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tan, Jianfeng
> Sent: Thursday, March 03, 2016 6:04 AM
> To: Chen, Jing D; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 05/12] pmd/fm10k: add dev_ptype_info_get implementation
> 
> Hi,
> 
> On 3/3/2016 4:11 AM, Chen, Jing D wrote:
> > Hi,
> >
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jianfeng Tan
> > Sent: Thursday, February 25, 2016 6:09 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4 05/12] pmd/fm10k: add dev_ptype_info_get implementation
> >
> > Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> > ---
> >   drivers/net/fm10k/fm10k_ethdev.c   | 50 ++++++++++++++++++++++++++++++++++++++
> >   drivers/net/fm10k/fm10k_rxtx.c     |  3 +++
> >   drivers/net/fm10k/fm10k_rxtx_vec.c |  3 +++
> >   3 files changed, 56 insertions(+)
> >
> > diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> > index 421266b..429cbdd 100644
> > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > @@ -1335,6 +1335,55 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
> >   	};
> >   }
> >
> > +#ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE
> > +static const uint32_t *
> > +fm10k_dev_ptype_info_get(struct rte_eth_dev *dev) {
> > +	if (dev->rx_pkt_burst == fm10k_recv_pkts ||
> > +	    dev->rx_pkt_burst == fm10k_recv_scattered_pkts) {
> > +		static uint32_t ptypes[] = {
> > +			/* refers to rx_desc_to_ol_flags() */
> > +			RTE_PTYPE_L2_ETHER,
> > +			RTE_PTYPE_L3_IPV4,
> > +			RTE_PTYPE_L3_IPV4_EXT,
> > +			RTE_PTYPE_L3_IPV6,
> > +			RTE_PTYPE_L3_IPV6_EXT,
> > +			RTE_PTYPE_L4_TCP,
> > +			RTE_PTYPE_L4_UDP,
> > +			RTE_PTYPE_UNKNOWN
> > +		};
> > +
> > +		return ptypes;
> > +	} else if (dev->rx_pkt_burst == fm10k_recv_pkts_vec ||
> > +		   dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec) {
> > +		static uint32_t ptypes_vec[] = {
> > +			/* refers to fm10k_desc_to_pktype_v() */
> > +			RTE_PTYPE_L3_IPV4,
> > +			RTE_PTYPE_L3_IPV4_EXT,
> > +			RTE_PTYPE_L3_IPV6,
> > +			RTE_PTYPE_L3_IPV6_EXT,
> > +			RTE_PTYPE_L4_TCP,
> > +			RTE_PTYPE_L4_UDP,
> > +			RTE_PTYPE_TUNNEL_GENEVE,
> > +			RTE_PTYPE_TUNNEL_NVGRE,
> > +			RTE_PTYPE_TUNNEL_VXLAN,
> > +			RTE_PTYPE_TUNNEL_GRE,
> > +			RTE_PTYPE_UNKNOWN
> > +		};
> > +
> > +		return ptypes_vec;
> > +	}
> > +
> > +	return NULL;
> > +}
> > May I know when " fm10k_dev_ptype_info_get " will be called? In fm10k, the actual
> > Rx/tx func will be decided after port is started.
> 
> Thank you for pointing out this. It's indeed an issue here. And it makes
> no difference when all rx functions fill the same ptypes, which,
> unfortunately, does not apply to all PMDs. According to my analysis,
> only in fm10k's case, we should call ptype_info_get after dev_start(),
> and for other PMDs, it can called just after rx_queue_setup. So in all,
> I need to add this as a caution in API declaration.

Good catch Mark :)
I think it should be called after dev_start() for all devices:
dev_start() is the usual point where final decision
what RX function should be used is made.
At least for the PMDs I am aware about (ixgbe, i40e, igb).

Konstantin

> 
> __details__
> 
> eth_cxgbe_dev_init
> 
> eth_igb_dev_init
> eth_igbvf_dev_init
> eth_igb_rx_init <- eth_igb_start (makes no difference, rx functins fill
> same ptypes)
> eth_igbvf_rx_init <- igbvf_dev_start (makes no difference, rx functins
> fill same ptypes)
> 
> eth_enicpmd_dev_init
> 
> fm10k_set_rx_function <- fm10k_dev_rx_init <- fm10k_dev_start
> 
> eth_i40e_dev_init
> i40evf_dev_init
> i40e_set_rx_function <- eth_i40e_dev_init
>                                       <- i40evf_dev_init
>                                       <- i40e_dev_rx_init <-
> i40e_dev_rxtx_init <- i40e_dev_start (makes no difference, rx functins
> fill same ptypes)
>                                       <- i40evf_rx_init <-
> i40evf_dev_start (makes no difference, rx functins fill same ptypes)
> 
> ixgbe_set_rx_function <- eth_ixgbe_dev_init
>                                         <- ixgbe_dev_rx_init <-
> ixgbe_dev_start (makes no difference, rx functions fill same ptypes)
>                                         <- ixgbevf_dev_rx_init
> 
> mlx4_rx_queue_setup
> mlx4_dev_set_mtu (makes no difference, rx functions fill same ptypes)
> 
> mlx5_rx_queue_setup
> mlx5_dev_set_mtu (makes no difference, rx functions fill same ptypes)
> 
> nfp_net_init
> 
> eth_vmxnet3_dev_init
> 
> Thanks,
> Jianfeng
> 
>
diff mbox

Patch

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 421266b..429cbdd 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1335,6 +1335,55 @@  fm10k_dev_infos_get(struct rte_eth_dev *dev,
 	};
 }
 
+#ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE
+static const uint32_t *
+fm10k_dev_ptype_info_get(struct rte_eth_dev *dev) {
+	if (dev->rx_pkt_burst == fm10k_recv_pkts ||
+	    dev->rx_pkt_burst == fm10k_recv_scattered_pkts) {
+		static uint32_t ptypes[] = {
+			/* refers to rx_desc_to_ol_flags() */
+			RTE_PTYPE_L2_ETHER,
+			RTE_PTYPE_L3_IPV4,
+			RTE_PTYPE_L3_IPV4_EXT,
+			RTE_PTYPE_L3_IPV6,
+			RTE_PTYPE_L3_IPV6_EXT,
+			RTE_PTYPE_L4_TCP,
+			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_UNKNOWN
+		};
+
+		return ptypes;
+	} else if (dev->rx_pkt_burst == fm10k_recv_pkts_vec ||
+		   dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec) {
+		static uint32_t ptypes_vec[] = {
+			/* refers to fm10k_desc_to_pktype_v() */
+			RTE_PTYPE_L3_IPV4,
+			RTE_PTYPE_L3_IPV4_EXT,
+			RTE_PTYPE_L3_IPV6,
+			RTE_PTYPE_L3_IPV6_EXT,
+			RTE_PTYPE_L4_TCP,
+			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_GENEVE,
+			RTE_PTYPE_TUNNEL_NVGRE,
+			RTE_PTYPE_TUNNEL_VXLAN,
+			RTE_PTYPE_TUNNEL_GRE,
+			RTE_PTYPE_UNKNOWN
+		};
+
+		return ptypes_vec;
+	}
+
+	return NULL;
+}
May I know when " fm10k_dev_ptype_info_get " will be called? In fm10k, the actual 
Rx/tx func will be decided after port is started.