All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: "Bie, Tiwei" <tiwei.bie@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
	"Mcnamara, John" <john.mcnamara@intel.com>,
	"olivier.matz@6wind.com" <olivier.matz@6wind.com>,
	"thomas.monjalon@6wind.com" <thomas.monjalon@6wind.com>,
	"Zhang, Helin" <helin.zhang@intel.com>,
	"Dai, Wei" <wei.dai@intel.com>,
	"Wang, Xiao W" <xiao.w.wang@intel.com>
Subject: Re: [PATCH v5 3/8] ethdev: reserve capability flags for PMD-specific API
Date: Mon, 9 Jan 2017 15:41:38 +0100	[thread overview]
Message-ID: <20170109144138.GY12822@6wind.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB9772583F10241C@irsmsx105.ger.corp.intel.com>

Hi Konstantin,

On Sun, Jan 08, 2017 at 12:39:55PM +0000, Ananyev, Konstantin wrote:
> 
> Hi Adrien,
> 
> > 
> > Hi Konstantin,
> > 
> > On Thu, Jan 05, 2017 at 11:32:38AM +0000, Ananyev, Konstantin wrote:
> > > Hi Adrien,
[...]
> > > > PMD-specific symbols have nothing to do in the global namespace in my
> > > > opinion, they are not versioned and may evolve without notice. Neither
> > > > applications nor the bonding PMD can rely on them. That's the trade-off.
> > >
> > > Not sure I do understand your reasoning.
> > > For me MACSEC offload is just one of many HW offloads that we support
> > > and should be treated in exactly the same way.
> > > Applications should be able to use it in a transparent and reliable way,
> > > not only under some limited conditions.
> > > Otherwise what is the point to introduce it at all?
> > 
> > Well my first reply to this thread was asking why isn't the whole API global
> > from the start then?
> 
> That's good question, and my preference would always be to have the
> API to configure this feature as generic one.
> I guess the main reason why it is not right now we don't reach an agreement
> how this API should look like: 
> http://dpdk.org/ml/archives/dev/2016-September/047810.html
> But I'll leave it to the author to provide the real reason here. 
> 
> > Given there are valid reasons for it not to and no plan to make it so in the
> > near future, applications must be aware that they are including
> > rte_pmd_ixgbe.h to use it. That in itself is a limiting condition, right?
> 
> Yes, it is definitely a limiting factor.
> Though even if API to configure device to use macsec would be PMD specific right now,
> The API to query that capability and the API to use it at datapath (mbuf.ol_flags) still
> can be (and I think should be) device independent and transparent to use.  

With RESERVED flags, what is global and transparent is the fact the mbuf or
device features in question are PMD-specific and some extra knowledge about
the underlying port is necessary to handle them. I think that could be
useful to applications in order to get the necessary precautions.

> > > Yes, right now it is supported only by ixgbe PMD, but why that should be the
> > > reason to treat is as second-class citizen?
> > > Let say PKT_TX_TUNNEL_* offloads also are supported only by one PMD right now.
> > 
> > You are right about PKT_TX_TUNNEL_*, however these flags exist on their own
> > and are not tied to any API function calls, unlike in this series where
> > PKT_TX_MACSEC can only be used if the DEV_TX_OFFLOAD_MACSEC_INSERT
> > capability is present 
> 
> I don't think PKT_TX_TUNNEL_* 'exists on its own'.
> To use it well behaving app have to:
> 1) Query that device does provide that capability: DEV_TX_OFFLOAD_*_TNL_TSO
> 2) configure PMD( & device) to use that capability
> 3) use that offload at run-time TX code (mb->ol_flags |= ...; mb->tx_offload = ...)
> 
> For PKT_TX_TUNNEL_*  2) is pretty simple - user just need to make sure
> that full-featured TX function will be selected:
> txconf.txq_flags = 0; ...;  rte_eth_tx_queue_setup(..., &txconf);

Pretty much like any other offloads. Any PMD could implement them as well
without exposing additional callbacks.

> For TX_MACSEC, as I understand 2) will be more complicated and
> right now is PMD specific, but anyway the main pattern remains the same.
> So at least 1) and 3) could be kept device neutral.

Yes, however this discussion is precisely because I think it could be a
problem that this API "right now is PMD specific", particularly because it
will remain that way.

> >and the whole thing was configured through
> > rte_pmd_ixgbe_macsec_*() calls after including rte_pmd_ixgbe.h.
> > 
> > To be clear it is not about MACsec per se (as a standardized protocol, I
> > think related definitions for offloads have their place), but it has to do
> > with the fact that the rest of the API is PMD-specific and there is a
> > dependency between them.
> > 
> > > > Therefore until APIs are made global, the safe compromise is to define
> > > > neutral, reserved symbols that any PMD can use to implement their own
> > > > temporary APIs for testing purposes. These can be renamed later without
> > > > changing their value as long as a single PMD uses them.
> > >
> > > Ok, so what we'll gain by introducing PKT_TX_RESERVED instead of PKT_TX_MACSEC?
> > > As I said in my previous mail the redefinition for the same ol_flag bit (and dev capabilities)
> > > by different PMD might create a lot of confusion in future.
> > > Does the potential saving of 1 bit really worth it?
> > 
> > That is one benefit, but my point is mainly to keep applications aware that
> > they are using an API defined by a single PMD, which may be temporary and
> > whose symbols are not versioned.
> 
> As applications have to use PMD specific functions to configure it they definitely are aware.

Therefore they also know if they are only running on top of ixgbe adapters
of a mix with something else. By choosing the PMD-specific path, they know
what they are getting into.

> > Consider this:
> > 
> > rte_mbuf.h:
> > 
> >  #define PKT_TX_RESERVED_0 (1 << 42)
> > 
> > rte_pmd_ixgbe.h:
> > 
> >  #define PKT_TX_MACSEC PKT_TX_RESERVED_0
> > 
> > That way, applications have to get the PKT_TX_MACSEC definition where the
> > rest of the API is also defined.
> > 
> > Other PMDs may reuse PKT_TX_RESERVED_0 and other reserved flags to implement
> > their own experimental APIs.
> 
> That's the main thing I am opposed to.
> I think that by allowing PMD to redefine meaning of
> mbuf.ol_flags and dev_info.(rx| tx)_offload_capa 
> we just asking for trouble.
> 
> Let say tomorrow, i40e will redefine DEV_TX_OFFLOAD_RESERVED_0 and PKT_TX_RESERVED_0
> to implement new specific TX offload (PKT_TX_FEATURE_X).
> Now let say we have an application that works over both ixgbe and i40e
> and would like to use both TX_MACSEC and TC_FEATURE_X offloads whenever they are available.
> As I can see, with the approach you proposed the only way for the application to make it
> is to support 2 different TX code paths (or at least some parts of it).
> To me that way looks inconvenient to the users and source of future troubles.

Remember applications still have to clear PKT_TX_MACSEC and other flags on
ports that do not implement them, just like when the related offload is not
configured even if supported. Whichever approach is taken, applications have
to be careful and need a few extra checks in their TX path. There is no
extra cost involved compared to existing offloads.

> Same for RX:  somewhere at upper layer user got a packet with PKT_RX_RESERVED_0 set.
> What does it really mean if there are different NIC types in the system?

For RX, I agree things are more complicated, applications would have to know
what a given flag means from a particular port. We could define several
RESERVED_X flags that do not overlap on a case basis, so at least
applications know they are dealing with PMD-specific flags.

> > Applications and the bonding PMD can easily be made aware that such reserved
> > flags cannot be shared between ports unless they know what the underlying
> > PMD is, which is already a requirement to use this API in the first place
> > (for instance, calling rte_pmd_ixgbe_macsec_*() functions with another
> > vendor's port_id may crash the application).
> 
> I am talking about that code:
> rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
> {
> ...
> /* Take the first dev's offload capabilities */
> internals->rx_offload_capa = dev_info.rx_offload_capa;
> internals->tx_offload_capa = dev_info.tx_offload_capa;
> ...
> internals->rx_offload_capa &= dev_info.rx_offload_capa;
> internals->tx_offload_capa &= dev_info.tx_offload_capa;
> 
> Obviously with what you are suggesting it is not valid any more.
> Bonded device need to support a MASK of all device reserved offloads to exclude
> them from common subset. 
> Any user app(/lib) that does similar thing would also have to be changed.

Why can't they clear RESERVED flags as well? We just have to document the
expected behavior. Even if the bonding PMD does not, applications that do
not use those flags (since they are reserved) should not be impacted.

Because the bonding PMD won't forward PMD-specific API calls, I think it's
safer to clear them anyway.

By the way, how do you handle the case where the bonding PMD exposes the
MACSEC feature and as a result the application tries to configure MACSEC
support on the bonding port_id? How is the resulting crash documented in a
generic fashion?

> > So the idea if/when the API is made global is to rename PKT_TX_RESERVED_0 to
> > PKT_TX_MACSEC and keep its original value.
> > 
> > If other PMDs also implemented PKT_TX_RESERVED_0 in the meantime, it is
> > redefined using a different value. If there is no room left to do so, these
> > PMDs are out of luck I guess, and their specific API is disabled/removed
> > until something gets re-designed.
> > 
> > How about this?
> 
> I still think that we shouldn't allow PMDs to redefine mbuf.olflags and
> dev_info.(rx|tx)_offload_capa. 
> See above for my reasons.

I'm still not comfortable with partially global/specific APIs such as this,
because we assume applications are fully aware of the underlying port in
order to use them, while at the same time the related flags are part of the
global namespace, I find it confusing.

If application developers have no problem with that (so far they haven't
commented on this topic, which means they likely agree to go with anything),
I have no reason left to go against the majority.

-- 
Adrien Mazarguil
6WIND

  parent reply	other threads:[~2017-01-09 14:41 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-03 14:59 [PATCH 0/3] Add MACsec offload support for ixgbe Tiwei Bie
2016-12-03 14:59 ` [PATCH 1/3] lib: add MACsec offload flags Tiwei Bie
2016-12-03 14:59 ` [PATCH 2/3] net/ixgbe: add MACsec offload support Tiwei Bie
2016-12-03 14:59 ` [PATCH 3/3] app/testpmd: add ixgbe " Tiwei Bie
2016-12-16  1:43 ` [PATCH v2 0/4] Add MACsec offload support for ixgbe Tiwei Bie
2016-12-16  1:43   ` [PATCH v2 1/4] lib: add MACsec offload flags Tiwei Bie
2016-12-16  1:43   ` [PATCH v2 2/4] net/ixgbe: add MACsec offload support Tiwei Bie
2016-12-16  1:43   ` [PATCH v2 3/4] app/testpmd: add ixgbe " Tiwei Bie
2016-12-16  1:43   ` [PATCH v2 4/4] doc: add ixgbe specific APIs Tiwei Bie
2016-12-16 10:29     ` Mcnamara, John
2016-12-25 14:57   ` [PATCH v3 0/6] Add MACsec offload support for ixgbe Tiwei Bie
2016-12-25 14:57     ` [PATCH v3 1/6] mbuf: add flag for MACsec Tiwei Bie
2016-12-25 14:57     ` [PATCH v3 2/6] ethdev: add event type " Tiwei Bie
2016-12-25 14:57     ` [PATCH v3 3/6] ethdev: add MACsec offload capability flags Tiwei Bie
2016-12-25 14:57     ` [PATCH v3 4/6] net/ixgbe: add MACsec offload support Tiwei Bie
2016-12-25 14:57     ` [PATCH v3 5/6] app/testpmd: add MACsec offload commands Tiwei Bie
2016-12-25 14:58     ` [PATCH v3 6/6] doc: add ixgbe specific APIs Tiwei Bie
2016-12-26 15:15     ` [PATCH v3 0/6] Add MACsec offload support for ixgbe Adrien Mazarguil
2016-12-27  1:33       ` Tiwei Bie
2016-12-27 14:37         ` Adrien Mazarguil
2016-12-27 17:42           ` Tiwei Bie
2016-12-28 15:41     ` [PATCH v4 0/7] " Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 1/7] mbuf: reserve a Tx offload flag for PMD-specific API Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 2/7] ethdev: reserve an event type " Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 3/7] ethdev: reserve capability flags " Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 4/7] net/ixgbe: add MACsec offload support Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 5/7] app/testpmd: add MACsec offload commands Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 6/7] doc: add ixgbe specific APIs Tiwei Bie
2016-12-28 15:41       ` [PATCH v4 7/7] doc: update the release notes for the reserved flags Tiwei Bie
2017-01-03  6:15       ` [PATCH v4 0/7] Add MACsec offload support for ixgbe Lu, Wenzhuo
2017-01-04  7:21       ` [PATCH v5 0/8] " Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 1/8] mbuf: reserve a Tx offload flag for PMD-specific API Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 2/8] ethdev: reserve an event type " Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 3/8] ethdev: reserve capability flags " Tiwei Bie
2017-01-04 14:21           ` Ananyev, Konstantin
2017-01-04 14:39             ` Tiwei Bie
2017-01-04 15:14               ` Ananyev, Konstantin
2017-01-04 17:00                 ` Tiwei Bie
2017-01-04 17:44                   ` Ananyev, Konstantin
2017-01-04 23:56                     ` Tiwei Bie
2017-01-05  8:33                       ` Adrien Mazarguil
2017-01-05 10:05                         ` Tiwei Bie
2017-01-05 11:32                         ` Ananyev, Konstantin
2017-01-05 18:21                           ` Adrien Mazarguil
2017-01-08 12:39                             ` Ananyev, Konstantin
2017-01-09  3:57                               ` Tiwei Bie
2017-01-09 11:26                                 ` Thomas Monjalon
2017-01-10  2:08                                   ` Tiwei Bie
2017-01-11 17:32                                   ` Olivier MATZ
2017-01-12  2:08                                     ` Tiwei Bie
2017-01-12  2:42                                     ` Yuanhan Liu
2017-01-09 14:41                               ` Adrien Mazarguil [this message]
2017-01-04  7:21         ` [PATCH v5 4/8] net/ixgbe: add MACsec offload support Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 5/8] app/testpmd: add MACsec offload commands Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 6/8] doc: add ixgbe specific APIs Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 7/8] doc: update the release notes for the reserved flags Tiwei Bie
2017-01-04  7:21         ` [PATCH v5 8/8] doc: add MACsec offload into NIC feature list Tiwei Bie
2017-01-04  8:29         ` [PATCH v5 0/8] Add MACsec offload support for ixgbe Peng, Yuan
2017-01-11  4:31         ` [PATCH v6 0/6] " Tiwei Bie
2017-01-11  4:31           ` [PATCH v6 1/6] mbuf: add flag for MACsec Tiwei Bie
2017-01-11 17:41             ` Olivier MATZ
2017-01-11  4:31           ` [PATCH v6 2/6] ethdev: add event type " Tiwei Bie
2017-01-11  4:31           ` [PATCH v6 3/6] ethdev: add MACsec offload capability flags Tiwei Bie
2017-01-11  4:31           ` [PATCH v6 4/6] net/ixgbe: add MACsec offload support Tiwei Bie
2017-01-11  4:31           ` [PATCH v6 5/6] app/testpmd: add MACsec offload commands Tiwei Bie
2017-01-13  9:07             ` Thomas Monjalon
2017-01-13  9:16               ` Tiwei Bie
2017-01-11  4:31           ` [PATCH v6 6/6] doc: add ixgbe specific APIs Tiwei Bie
2017-01-13 11:21           ` [PATCH v7 0/6] Add MACsec offload support for ixgbe Tiwei Bie
2017-01-13 11:21             ` [PATCH v7 1/6] mbuf: add flag for MACsec Tiwei Bie
2017-01-13 11:21             ` [PATCH v7 2/6] ethdev: add event type " Tiwei Bie
2017-01-16  2:31               ` Ananyev, Konstantin
2017-01-13 11:21             ` [PATCH v7 3/6] ethdev: add MACsec offload capability flags Tiwei Bie
2017-01-16  2:33               ` Ananyev, Konstantin
2017-01-13 11:21             ` [PATCH v7 4/6] net/ixgbe: add MACsec offload support Tiwei Bie
2017-01-13 11:21             ` [PATCH v7 5/6] app/testpmd: add MACsec offload commands Tiwei Bie
2017-01-13 11:21             ` [PATCH v7 6/6] doc: add ixgbe specific APIs Tiwei Bie
2017-01-15 18:19             ` [PATCH v7 0/6] Add MACsec offload support for ixgbe Thomas Monjalon
2017-01-23  2:30             ` Peng, Yuan

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=20170109144138.GY12822@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=thomas.monjalon@6wind.com \
    --cc=tiwei.bie@intel.com \
    --cc=wei.dai@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiao.w.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.