From: Ori Kam <orika@nvidia.com>
To: "NBU-Contact-Thomas Monjalon (EXTERNAL)" <thomas@monjalon.net>
Cc: Dariusz Sosnowski <dsosnowski@nvidia.com>,
"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
"cristian.dumitrescu@intel.com" <cristian.dumitrescu@intel.com>,
"andrew.rybchenko@oktetlabs.ru" <andrew.rybchenko@oktetlabs.ru>,
"stephen@networkplumber.org" <stephen@networkplumber.org>,
"dev@dpdk.org" <dev@dpdk.org>,
Raslan Darawsheh <rasland@nvidia.com>
Subject: RE: [PATCH 1/4] ethdev: introduce encap hash calculation
Date: Wed, 7 Feb 2024 06:56:40 +0000 [thread overview]
Message-ID: <MW2PR12MB466670CAB3C0F1AE003000E6D6452@MW2PR12MB4666.namprd12.prod.outlook.com> (raw)
In-Reply-To: <3266952.oiGErgHkdL@thomas>
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, February 7, 2024 12:40 AM
>
> 28/01/2024 10:39, Ori Kam:
> > During the encapsulation of a packet, it is expected to calculate the
> > hash value which is based on the original packet (the outer values,
> > which will become the inner values).
>
> It is not clear what the hash is for.
Will add explanation.
>
> > The tunnel protocol defines which tunnel field should hold this hash,
> > but it doesn't define the hash calculation algorithm.
>
> If the hash is stored in the packet header,
> I expect it to be reproducible when being checked.
> How the algorithm may be undefined?
>
The hash is not being checked it is used for hash the packets to different queues.
the actual value is not important. It is critical that all packets that belongs to the same
flow will have the same hash value.
> > An application that uses flow offloads gets the first few packets
> > and then decides to offload the flow. As a result, there are two
> > different paths that a packet from a given flow may take.
> > SW for the first few packets or HW for the rest.
> > When the packet goes through the SW, the SW encapsulates the packet
> > and must use the same hash calculation as the HW will do for
> > the rest of the packets in this flow.
> >
> > This patch gives the SW a way to query the hash value
> > for a given packet as if the packet was passed through the HW.
> >
> > Signed-off-by: Ori Kam <orika@nvidia.com>
> > ---
> > +Calculate encap hash
> > +~~~~~~~~~~~~~~~~~~~~
> > +
> > +Calculating hash of a packet in SW as it would be calculated in HW for the
> encap action
>
> We should give the real full name of the flow action.
>
> > +
> > +When the HW execute an encapsulation action, it may calculate an hash
> value which is based
> > +on the original packet. This hash is stored depending on the encapsulation
> protocol, in one
> > +of the outer fields.
>
> Give an example of such encapsulation protocol?
Sure,
Just to be clear something like this?
When the HW execute an encapsulation action for example for VXLAN tunnel,, it may ...
>
> > +This function allows the application to calculate the hash for a given
> packet as if the
> > +encapsulation was done in HW.
> > +
> > +.. code-block:: c
> > +
> > + int
> > + rte_flow_calc_encap_hash(uint16_t port_id,
> > + const struct rte_flow_item pattern[],
> > + enum rte_flow_encap_hash_field
> dest_field,
> > + uint8_t hash_len,
> > + uint8_t *hash,
> > + struct rte_flow_error *error);
>
> I don't think we should add the complete prototype in this guide.
Agree, will remove.
>
> [...]
> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice.
> > + *
> > + * Simulates HW hash calculation that is done when encap action is being
> used.
>
> s/Simulates/Simulate/
Will fix.
>
> > + *
> > + * @param[in] port_id
> > + * Port identifier of Ethernet device.
> > + * @param[in] pattern
> > + * The values to be used in the hash calculation.
> > + * @param[in] dest_field
> > + * Type of destination field for hash calculation.
> > + * @param[in] hash_len
> > + * The length of the hash pointer in bytes. Should be according to
> encap_hash_field.
> > + * @param[out] hash
> > + * Used to return the calculated hash. It will be written in network order,
> > + * so hash[0] is the MSB.
> > + * The number of bytes is based on the destination field type.
> > + * @param[out] error
> > + * Perform verbose error reporting if not NULL.
> > + * PMDs initialize this structure in case of error only.
> > + *
> > + * @return
> > + * - (0) if success.
> > + * - (-ENODEV) if *port_id* invalid.
> > + * - (-ENOTSUP) if underlying device does not support this functionality.
> > + * - (-EINVAL) if *pattern* doesn't hold enough information to calculate
> the hash
> > + * or the dest is not supported.
> > + */
> > +__rte_experimental
> > +int
> > +rte_flow_calc_encap_hash(uint16_t port_id, const struct rte_flow_item
> pattern[],
> > + enum rte_flow_encap_hash_field dest_field, uint8_t
> hash_len,
> > + uint8_t *hash, struct rte_flow_error *error);
>
>
next prev parent reply other threads:[~2024-02-07 6:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 9:39 [PATCH 0/4] " Ori Kam
2024-01-28 9:39 ` [PATCH 1/4] ethdev: " Ori Kam
2024-02-01 8:40 ` Ori Kam
2024-02-06 22:39 ` Thomas Monjalon
2024-02-07 6:56 ` Ori Kam [this message]
2024-02-07 9:25 ` Thomas Monjalon
2024-01-28 9:39 ` [PATCH 2/4] net/mlx5/hws: introduce encap entropy hash calculation API Ori Kam
2024-01-28 9:39 ` [PATCH 3/4] net/mlx5: add calc encap hash support Ori Kam
2024-01-28 9:39 ` [PATCH 4/4] app/testpmd: add encap hash calculation Ori Kam
2024-01-31 18:30 ` [PATCH 0/4] introduce " Dariusz Sosnowski
2024-02-08 9:09 ` [PATCH v2 1/4] ethdev: " Ori Kam
2024-02-08 9:09 ` [PATCH v2 2/4] net/mlx5/hws: introduce encap entropy hash calculation API Ori Kam
2024-02-08 9:09 ` [PATCH v2 3/4] net/mlx5: add calc encap hash support Ori Kam
2024-02-08 9:09 ` [PATCH v2 4/4] app/testpmd: add encap hash calculation Ori Kam
2024-02-08 17:13 ` [PATCH v2 1/4] ethdev: introduce " Ferruh Yigit
2024-02-11 7:29 ` Ori Kam
2024-02-12 17:05 ` Ferruh Yigit
2024-02-12 18:44 ` Ori Kam
2024-02-12 20:09 ` Ferruh Yigit
2024-02-13 7:05 ` Ori Kam
2024-02-13 13:48 ` [PATCH v3 " Ori Kam
2024-02-13 13:48 ` [PATCH v3 2/4] net/mlx5/hws: introduce encap entropy hash calculation API Ori Kam
2024-02-13 13:48 ` [PATCH v3 3/4] net/mlx5: add calc encap hash support Ori Kam
2024-02-13 13:48 ` [PATCH v3 4/4] app/testpmd: add encap hash calculation Ori Kam
2024-02-13 14:16 ` [PATCH v4 1/4] ethdev: introduce " Ori Kam
2024-02-13 14:16 ` [PATCH v4 2/4] net/mlx5/hws: introduce encap entropy hash calculation API Ori Kam
2024-02-13 14:16 ` [PATCH v4 3/4] net/mlx5: add calc encap hash support Ori Kam
2024-02-13 14:16 ` [PATCH v4 4/4] app/testpmd: add encap hash calculation Ori Kam
2024-02-13 15:45 ` Ferruh Yigit
2024-02-13 15:45 ` [PATCH v4 1/4] ethdev: introduce " Ferruh Yigit
2024-02-13 15:45 ` 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=MW2PR12MB466670CAB3C0F1AE003000E6D6452@MW2PR12MB4666.namprd12.prod.outlook.com \
--to=orika@nvidia.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=ferruh.yigit@amd.com \
--cc=rasland@nvidia.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).