DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: refine API description
@ 2021-01-12 11:47 Qi Zhang
  2021-01-15 15:51 ` Thomas Monjalon
  2021-01-19  3:19 ` [dpdk-dev] [PATCH v2] ethdev: refine doxygen for add UDP tunnel port API Qi Zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Qi Zhang @ 2021-01-12 11:47 UTC (permalink / raw)
  To: thomas; +Cc: dev, ferruh.yigit, Qi Zhang

Refine the description for rte_eth_dev_udp_tunnel_port_add.
Claim this is an API for device (or port) level configuration.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 lib/librte_ethdev/rte_ethdev.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f5f891918..a7bb16d45 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -4030,6 +4030,16 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
  * to change or add more UDP port for the tunnel. So the offloading function
  * can take effect on the packets with the specific UDP port.
  *
+ * Due to different requirements from different use cases, NICs may have a
+ * different way to identify a UDP port as a tunnel type. Some NIC takes this
+ * as a device (or port) level configure while some NIC takes this as a flow
+ * based configure.
+ *
+ * This API is for the first case and typically it will only be implemented
+ * on a PF driver or a VF driver which have privilege right to configure for
+ * other VFs. For the second case, a tunnel configure could be embedded in a
+ * rte_flow rule.
+ *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param tunnel_udp
-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: refine API description
  2021-01-12 11:47 [dpdk-dev] [PATCH] ethdev: refine API description Qi Zhang
@ 2021-01-15 15:51 ` Thomas Monjalon
  2021-01-18  4:01   ` Zhang, Qi Z
  2021-01-19  3:19 ` [dpdk-dev] [PATCH v2] ethdev: refine doxygen for add UDP tunnel port API Qi Zhang
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2021-01-15 15:51 UTC (permalink / raw)
  To: Qi Zhang
  Cc: dev, ferruh.yigit, orika, getelson, andrew.rybchenko,
	ajit.khaparde, jerinj

Hi,

It seems we need to clarify how the API for UDP tunnel works
with rte_flow. Thanks for starting this patch.
I ask some questions below for writing a clear and exact API definition.

12/01/2021 12:47, Qi Zhang:
> Refine the description for rte_eth_dev_udp_tunnel_port_add.
> Claim this is an API for device (or port) level configuration.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -4030,6 +4030,16 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
>   * to change or add more UDP port for the tunnel. So the offloading function
>   * can take effect on the packets with the specific UDP port.
>   *
> + * Due to different requirements from different use cases, NICs may have a
> + * different way to identify a UDP port as a tunnel type. Some NIC takes this
> + * as a device (or port) level configure while some NIC takes this as a flow
> + * based configure.

I think this assumption is too vague to be useful.
It brings more confusion than it explains.

> + *
> + * This API is for the first case and typically it will only be implemented
> + * on a PF driver or a VF driver which have privilege right to configure for

What is a privileged VF exactly?

> + * other VFs. For the second case, a tunnel configure could be embedded in a
> + * rte_flow rule.

I suggest we make the explanation more API-oriented.

First thing to explain: this API will have effect on rte_flow rules only,
am I right?

What does it mean for a flow rule matching on a specific tunnel?
Let's take an example config:
	rte_eth_dev_udp_tunnel_port_add [UDP X] [tunnel T]
	rte_flow_create [tunnel T] [action A]
	rte_flow_create [UDP Y] [tunnel T] [action B]
Then action for these packets:
	1/ [UDP X] - no tunnel header
-> A (rte_eth_udp_tunnel skips the tunnel header check)
-> or none, tunnel header is checked according to rte_flow?
	2/ [UDP Y] - no tunnel header
-> none (flow rule requires a tunnel header)
	3/ [UDP X] [tunnel T]
-> A
	4/ [UDP Y] [tunnel T]
-> B
	5/ [UDP X] [tunnel U]
-> A (rte_eth_udp_tunnel skips the tunnel header check)
-> or none, tunnel header is checked according to rte_flow?
	6/ [UDP Y] [tunnel U]
-> none

Last question, how it plays with rte_flow_tunnel_match?
Should we replace rte_eth_udp_tunnel with rte_flow_tunnel_match?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: refine API description
  2021-01-15 15:51 ` Thomas Monjalon
@ 2021-01-18  4:01   ` Zhang, Qi Z
  2021-01-18  9:49     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Qi Z @ 2021-01-18  4:01 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Yigit, Ferruh, orika, getelson, andrew.rybchenko,
	ajit.khaparde, jerinj

Hi Thomas:
	Thanks for review, comment in line

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, January 15, 2021 11:52 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; orika@nvidia.com;
> getelson@nvidia.com; andrew.rybchenko@oktetlabs.ru;
> ajit.khaparde@broadcom.com; jerinj@marvell.com
> Subject: Re: [dpdk-dev] [PATCH] ethdev: refine API description
> 
> Hi,
> 
> It seems we need to clarify how the API for UDP tunnel works with rte_flow.
> Thanks for starting this patch.
> I ask some questions below for writing a clear and exact API definition.
> 
> 12/01/2021 12:47, Qi Zhang:
> > Refine the description for rte_eth_dev_udp_tunnel_port_add.
> > Claim this is an API for device (or port) level configuration.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> > @@ -4030,6 +4030,16 @@ rte_eth_dev_rss_hash_conf_get(uint16_t
> port_id,
> >   * to change or add more UDP port for the tunnel. So the offloading
> function
> >   * can take effect on the packets with the specific UDP port.
> >   *
> > + * Due to different requirements from different use cases, NICs may
> > + have a
> > + * different way to identify a UDP port as a tunnel type. Some NIC
> > + takes this
> > + * as a device (or port) level configure while some NIC takes this as
> > + a flow
> > + * based configure.
> 
> I think this assumption is too vague to be useful.
> It brings more confusion than it explains.

OK, let's focus on the API impact as you suggested.
> 
> > + *
> > + * This API is for the first case and typically it will only be
> > + implemented
> > + * on a PF driver or a VF driver which have privilege right to
> > + configure for
> 
> What is a privileged VF exactly?

Yes, looks like "a privileged VF" is not generic enough here, actually it should be a driver that implement DPDK ethdev API and able to perform device/port level configure, 
for example use rte_flow to steer traffic to specific VF, configure UDP tunnel port .... it is something like a "host driver"
It could be a pure user pace DPDK PF driver, or a vdev / SR-IOV driver back ended by a kernel driver but be granted to have privilege to access more device resource through some sw/hw channel.

> 
> > + * other VFs. For the second case, a tunnel configure could be
> > + embedded in a
> > + * rte_flow rule.
> 
> I suggest we make the explanation more API-oriented.
> 
> First thing to explain: this API will have effect on rte_flow rules only, am I right?

I think it should not only impact the rte_flow, but also may impact the packet type that extract from Rx Descriptor to mbuf on some devices
Because without this configure, the parser is not able to recognize the specific tunnel type

> 
> What does it mean for a flow rule matching on a specific tunnel?
> Let's take an example config:
> 	rte_eth_dev_udp_tunnel_port_add [UDP X] [tunnel T]
> 	rte_flow_create [tunnel T] [action A]
> 	rte_flow_create [UDP Y] [tunnel T] [action B] Then action for these

Some driver may not allow to specific a tunnel port in rte_flow as rte_eth_dev_udp_tunnel_port_add is prefer API to handle this.

> packets:
> 	1/ [UDP X] - no tunnel header
> -> A (rte_eth_udp_tunnel skips the tunnel header check) or none, tunnel
> -> header is checked according to rte_flow?

If a packet only have udp tunnel port but don't have tunnel header, so the packet will still not be recognized as a an tunnel packet by the parser, the pattern is not matched and action A should not be executed.

> 	2/ [UDP Y] - no tunnel header
> -> none (flow rule requires a tunnel header)

Yes, expected result

> 	3/ [UDP X] [tunnel T]
> -> A

Yes, expected result

> 	4/ [UDP Y] [tunnel T]
> -> B

Yes, expected result, if the rule #2 is allowed to create

> 	5/ [UDP X] [tunnel U]
> -> A (rte_eth_udp_tunnel skips the tunnel header check) or none, tunnel
> -> header is checked according to rte_flow?

Should be none.

> 	6/ [UDP Y] [tunnel U]
> -> none

Yes expected result.
> 
> Last question, how it plays with rte_flow_tunnel_match?
> Should we replace rte_eth_udp_tunnel with rte_flow_tunnel_match?

My understanding is rte_flow_tunnel_match is just a help function, it help to generate a set of rte_flow_items to feed a new rule creation, so looks like it is not expected to have any interaction with hardware? So I didn't figure out how can we use it to replace,  But maybe we can introduce something new like rte_flow_tunnel_create as we already have a rte_flow_tunnel structure which looks more generic than the existing API that only take udp port for tunnel configure.
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: refine API description
  2021-01-18  4:01   ` Zhang, Qi Z
@ 2021-01-18  9:49     ` Thomas Monjalon
  2021-01-19  0:47       ` Zhang, Qi Z
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2021-01-18  9:49 UTC (permalink / raw)
  To: Zhang, Qi Z
  Cc: dev, Yigit, Ferruh, orika, getelson, andrew.rybchenko,
	ajit.khaparde, jerinj

18/01/2021 05:01, Zhang, Qi Z:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 12/01/2021 12:47, Qi Zhang:
> > > + * This API is for the first case and typically it will only be
> > > + implemented
> > > + * on a PF driver or a VF driver which have privilege right to
> > > + configure for
> > 
> > What is a privileged VF exactly?
> 
> Yes, looks like "a privileged VF" is not generic enough here, actually it should be a driver that implement DPDK ethdev API and able to perform device/port level configure, 
> for example use rte_flow to steer traffic to specific VF, configure UDP tunnel port .... it is something like a "host driver"
> It could be a pure user pace DPDK PF driver, or a vdev / SR-IOV driver back ended by a kernel driver but be granted to have privilege to access more device resource through some sw/hw channel.

How such device is granted privilege?


> > > + * other VFs. For the second case, a tunnel configure could be
> > > + embedded in a
> > > + * rte_flow rule.
> > 
> > I suggest we make the explanation more API-oriented.
> > 
> > First thing to explain: this API will have effect on rte_flow rules only, am I right?
> 
> I think it should not only impact the rte_flow, but also may impact the packet type that extract from Rx Descriptor to mbuf on some devices
> Because without this configure, the parser is not able to recognize the specific tunnel type

Oh right.
This impact on mbuf classification should be part of the doxygen explanation.


> > What does it mean for a flow rule matching on a specific tunnel?
> > Let's take an example config:
> > 	rte_eth_dev_udp_tunnel_port_add [UDP X] [tunnel T]
> > 	rte_flow_create [tunnel T] [action A]
> > 	rte_flow_create [UDP Y] [tunnel T] [action B] Then action for these
> 
> Some driver may not allow to specific a tunnel port in rte_flow as rte_eth_dev_udp_tunnel_port_add is prefer API to handle this.

Every rte_flow items and actions have limitations in drivers, that's OK.

> > packets:
> > 	1/ [UDP X] - no tunnel header
> > -> A (rte_eth_udp_tunnel skips the tunnel header check) or none, tunnel
> > -> header is checked according to rte_flow?
> 
> If a packet only have udp tunnel port but don't have tunnel header, so the packet will still not be recognized as a an tunnel packet by the parser, the pattern is not matched and action A should not be executed.

OK I like it. Please make this behaviour clear in the doxygen.


> > 	2/ [UDP Y] - no tunnel header
> > -> none (flow rule requires a tunnel header)
> 
> Yes, expected result
> 
> > 	3/ [UDP X] [tunnel T]
> > -> A
> 
> Yes, expected result
> 
> > 	4/ [UDP Y] [tunnel T]
> > -> B
> 
> Yes, expected result, if the rule #2 is allowed to create

Yes of course, if the rule cannot be created, the driver will reject it
with an appropriate error code and a log mentioning the limitation.

> > 	5/ [UDP X] [tunnel U]
> > -> A (rte_eth_udp_tunnel skips the tunnel header check) or none, tunnel
> > -> header is checked according to rte_flow?
> 
> Should be none.

OK makes sense.

> > 	6/ [UDP Y] [tunnel U]
> > -> none
> 
> Yes expected result.
> > 
> > Last question, how it plays with rte_flow_tunnel_match?
> > Should we replace rte_eth_udp_tunnel with rte_flow_tunnel_match?
> 
> My understanding is rte_flow_tunnel_match is just a help function, it help to generate a set of rte_flow_items to feed a new rule creation, so looks like it is not expected to have any interaction with hardware? So I didn't figure out how can we use it to replace,  But maybe we can introduce something new like rte_flow_tunnel_create as we already have a rte_flow_tunnel structure which looks more generic than the existing API that only take udp port for tunnel configure.

Yes we need to think about it for future more generic API.
Ori, any thoughts?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: refine API description
  2021-01-18  9:49     ` Thomas Monjalon
@ 2021-01-19  0:47       ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2021-01-19  0:47 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Yigit, Ferruh, orika, getelson, andrew.rybchenko,
	ajit.khaparde, jerinj



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, January 18, 2021 5:50 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; orika@nvidia.com;
> getelson@nvidia.com; andrew.rybchenko@oktetlabs.ru;
> ajit.khaparde@broadcom.com; jerinj@marvell.com
> Subject: Re: [dpdk-dev] [PATCH] ethdev: refine API description
> 
> 18/01/2021 05:01, Zhang, Qi Z:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 12/01/2021 12:47, Qi Zhang:
> > > > + * This API is for the first case and typically it will only be
> > > > + implemented
> > > > + * on a PF driver or a VF driver which have privilege right to
> > > > + configure for
> > >
> > > What is a privileged VF exactly?
> >
> > Yes, looks like "a privileged VF" is not generic enough here, actually
> > it should be a driver that implement DPDK ethdev API and able to perform
> device/port level configure, for example use rte_flow to steer traffic to specific
> VF, configure UDP tunnel port .... it is something like a "host driver"
> > It could be a pure user pace DPDK PF driver, or a vdev / SR-IOV driver back
> ended by a kernel driver but be granted to have privilege to access more device
> resource through some sw/hw channel.
> 
> How such device is granted privilege?

There is no unified way currently as I know, but typically it should be configured from the host by an administrator through tools like ip / devlink ...

> 
> 
> > > > + * other VFs. For the second case, a tunnel configure could be
> > > > + embedded in a
> > > > + * rte_flow rule.
> > >
> > > I suggest we make the explanation more API-oriented.
> > >
> > > First thing to explain: this API will have effect on rte_flow rules only, am I
> right?
> >
> > I think it should not only impact the rte_flow, but also may impact
> > the packet type that extract from Rx Descriptor to mbuf on some
> > devices Because without this configure, the parser is not able to
> > recognize the specific tunnel type
> 
> Oh right.
> This impact on mbuf classification should be part of the doxygen explanation.
> 
> 
> > > What does it mean for a flow rule matching on a specific tunnel?
> > > Let's take an example config:
> > > 	rte_eth_dev_udp_tunnel_port_add [UDP X] [tunnel T]
> > > 	rte_flow_create [tunnel T] [action A]
> > > 	rte_flow_create [UDP Y] [tunnel T] [action B] Then action for these
> >
> > Some driver may not allow to specific a tunnel port in rte_flow as
> rte_eth_dev_udp_tunnel_port_add is prefer API to handle this.
> 
> Every rte_flow items and actions have limitations in drivers, that's OK.
> 
> > > packets:
> > > 	1/ [UDP X] - no tunnel header
> > > -> A (rte_eth_udp_tunnel skips the tunnel header check) or none,
> > > -> tunnel header is checked according to rte_flow?
> >
> > If a packet only have udp tunnel port but don't have tunnel header, so the
> packet will still not be recognized as a an tunnel packet by the parser, the pattern
> is not matched and action A should not be executed.
> 
> OK I like it. Please make this behaviour clear in the doxygen.
> 
> 
> > > 	2/ [UDP Y] - no tunnel header
> > > -> none (flow rule requires a tunnel header)
> >
> > Yes, expected result
> >
> > > 	3/ [UDP X] [tunnel T]
> > > -> A
> >
> > Yes, expected result
> >
> > > 	4/ [UDP Y] [tunnel T]
> > > -> B
> >
> > Yes, expected result, if the rule #2 is allowed to create
> 
> Yes of course, if the rule cannot be created, the driver will reject it with an
> appropriate error code and a log mentioning the limitation.
> 
> > > 	5/ [UDP X] [tunnel U]
> > > -> A (rte_eth_udp_tunnel skips the tunnel header check) or none,
> > > -> tunnel header is checked according to rte_flow?
> >
> > Should be none.
> 
> OK makes sense.
> 
> > > 	6/ [UDP Y] [tunnel U]
> > > -> none
> >
> > Yes expected result.
> > >
> > > Last question, how it plays with rte_flow_tunnel_match?
> > > Should we replace rte_eth_udp_tunnel with rte_flow_tunnel_match?
> >
> > My understanding is rte_flow_tunnel_match is just a help function, it help to
> generate a set of rte_flow_items to feed a new rule creation, so looks like it is
> not expected to have any interaction with hardware? So I didn't figure out how
> can we use it to replace,  But maybe we can introduce something new like
> rte_flow_tunnel_create as we already have a rte_flow_tunnel structure which
> looks more generic than the existing API that only take udp port for tunnel
> configure.
> 
> Yes we need to think about it for future more generic API.
> Ori, any thoughts?
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] ethdev: refine doxygen for add UDP tunnel port API
  2021-01-12 11:47 [dpdk-dev] [PATCH] ethdev: refine API description Qi Zhang
  2021-01-15 15:51 ` Thomas Monjalon
@ 2021-01-19  3:19 ` Qi Zhang
  1 sibling, 0 replies; 6+ messages in thread
From: Qi Zhang @ 2021-01-19  3:19 UTC (permalink / raw)
  To: thomas; +Cc: ferruh.yigit, dev, Qi Zhang

Refine the doxygen for rte_eth_dev_udp_tunnel_port_add.
Add more detail description of the impacted offload functions.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v2:
- reword doxygen that focus on API impact base on previous discussion. 

 lib/librte_ethdev/rte_ethdev.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f758ec837..ab50a7039 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -4031,6 +4031,17 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
  * to change or add more UDP port for the tunnel. So the offloading function
  * can take effect on the packets with the specific UDP port.
  *
+ * The impacted offloading functions include:
+ *
+ * - A specific tunnel type in mbuf->packet_type
+ *
+ * - A rte_flow rule that matches on specific tunnel header
+ *
+ * NOTE: If a packet only has a matched UDP port but don't have a legal tunnel
+ *       header, the packet may still not be recognized as a tunnel packet by
+ *       the device parser, then the related offloading function will not take
+ *       effect.
+ *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param tunnel_udp
-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-19  3:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 11:47 [dpdk-dev] [PATCH] ethdev: refine API description Qi Zhang
2021-01-15 15:51 ` Thomas Monjalon
2021-01-18  4:01   ` Zhang, Qi Z
2021-01-18  9:49     ` Thomas Monjalon
2021-01-19  0:47       ` Zhang, Qi Z
2021-01-19  3:19 ` [dpdk-dev] [PATCH v2] ethdev: refine doxygen for add UDP tunnel port API Qi Zhang

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git