From: "Iremonger, Bernard" <bernard.iremonger@intel.com>
To: "Singh, Jasvinder" <jasvinder.singh@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/3] lib/librte_flow_classy: add run api for flow classification
Date: Tue, 5 Dec 2017 11:01:20 +0000 [thread overview]
Message-ID: <8CEF83825BEC744B83065625E567D7C24E06464B@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <8CEF83825BEC744B83065625E567D7C24E063FA2@IRSMSX108.ger.corp.intel.com>
Hi Jasvinder,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> Sent: Monday, December 4, 2017 4:46 PM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/3] lib/librte_flow_classy: add run api for flow
> classification
>
> Hi Jasvinder,
>
> > -----Original Message-----
> > From: Singh, Jasvinder
> > Sent: Thursday, November 23, 2017 11:32 AM
> > To: dev@dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> > Subject: [PATCH 2/3] lib/librte_flow_classy: add run api for flow
> > classification
> >
> > This patch extends the flow classification library by adding run api.
> > This function classifies the packets based on the flow rules stored in
> > the classifier table.
> > During lookup operation, the table entry is identified on lookup hit
> > and based on meta-data stored at table entry, actions are performed on
> > the current packet.
> > The meta-information about the actions stored in the table entry is
> > determined from the actions fields specified in flow rules.
> >
> > Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> > ---
> > lib/librte_flow_classify/rte_flow_classify.c | 56
> > ++++++++++++++++++++++
> > lib/librte_flow_classify/rte_flow_classify.h | 24 ++++++++++
> > .../rte_flow_classify_version.map | 1 +
> > 3 files changed, 81 insertions(+)
> >
> > diff --git a/lib/librte_flow_classify/rte_flow_classify.c
> > b/lib/librte_flow_classify/rte_flow_classify.c
> > index ff1bc86..5433bfe 100644
> > --- a/lib/librte_flow_classify/rte_flow_classify.c
> > +++ b/lib/librte_flow_classify/rte_flow_classify.c
> > @@ -37,6 +37,9 @@
> > #include <rte_table_acl.h>
> > #include <stdbool.h>
> >
> > +#define RTE_PKT_METADATA_PTR(pkt, offset) \
> > + (&((uint32_t *)(pkt))[offset])
> > +
> > int librte_flow_classify_logtype;
> >
> > static uint32_t unique_id = 1;
> > @@ -674,6 +677,59 @@ action_apply(struct rte_flow_classifier *cls, }
> >
> > int
> > +rte_flow_classifier_run(struct rte_flow_classifier *cls,
> > + struct rte_mbuf **pkts,
> > + const uint16_t nb_pkts,
> > + uint32_t pkt_offset)
> > +{
> > + struct rte_flow_action_mark *mark;
> > + struct classify_action *action;
> > + uint64_t pkts_mask = RTE_LEN2MASK(nb_pkts, uint64_t);
> > + uint64_t action_mask;
> > + uint32_t *ptr, i, j;
> > + int ret = -EINVAL;
> > +
> > + if (!cls || !pkts || nb_pkts == 0)
> > + return ret;
> > +
> > + for (i = 0; i < cls->num_tables; i++) {
> > + if (cls->table_mask & (1LU << i)) {
> > + struct rte_cls_table *table = &cls->tables[i];
> > + uint64_t lookup_hit_mask;
> > +
> > + ret = table->ops.f_lookup(table->h_table,
> > + pkts, pkts_mask, &lookup_hit_mask,
> > + (void **)cls->entries);
> > + if (ret)
> > + return ret;
> > +
> > + if (lookup_hit_mask) {
> > + for (j = 0; j < nb_pkts; j++) {
> > + uint64_t pkt_mask = 1LLU << j;
> > +
> > + if ((lookup_hit_mask & pkt_mask) ==
> > 0)
> > + continue;
> > + /* Meta-data */
> > + enum rte_flow_action_type act_type
> > =
> > +
> > RTE_FLOW_ACTION_TYPE_MARK;
> > + action = &cls->entries[j]->action;
> > + action_mask = action->action_mask;
> > +
> > + if (action_mask & (1LLU << act_type))
> > {
> > + mark = &action->act.mark;
> > + ptr =
> > RTE_PKT_METADATA_PTR(
> > + pkts[j], pkt_offset);
> > + *ptr = mark->id;
> > + }
> > + }
> > + }
> > + }
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +int
> > rte_flow_classifier_query(struct rte_flow_classifier *cls,
> > struct rte_mbuf **pkts,
> > const uint16_t nb_pkts,
> > diff --git a/lib/librte_flow_classify/rte_flow_classify.h
> > b/lib/librte_flow_classify/rte_flow_classify.h
> > index b9b669f..b74bd11 100644
> > --- a/lib/librte_flow_classify/rte_flow_classify.h
> > +++ b/lib/librte_flow_classify/rte_flow_classify.h
> > @@ -273,6 +273,30 @@ rte_flow_classify_table_entry_delete(struct
> > rte_flow_classifier *cls,
> > struct rte_flow_classify_rule *rule);
> >
> > /**
> > + * Flow classifier run.
> > + *
> > + * As a result of lookup operation, flow classifer idenfies the
> > + * table entries that are hit and executes the actions on the packets.
> > + *
> > + * @param[in] cls
> > + * Flow classifier handle
> > + * @param[in] pkts
> > + * Pointer to packets to process
> > + * @param[in] nb_pkts
> > + * Number of packets to process
> > + * @param[in] pkt_offset
> > + * Offset to store action metadata in the mbuf headroom
> > + *
> > + * @return
> > + * 0 on success, error code otherwise.
> > + */
> > +int
> > +rte_flow_classifier_run(struct rte_flow_classifier *cls,
> > + struct rte_mbuf **pkts,
> > + const uint16_t nb_pkts,
> > + uint32_t pkt_offset);
> > +
> > +/**
> > * Query flow classifier for given rule.
> > *
> > * @param[in] cls
> > diff --git a/lib/librte_flow_classify/rte_flow_classify_version.map
> > b/lib/librte_flow_classify/rte_flow_classify_version.map
> > index 49bc25c..b51cb1a 100644
> > --- a/lib/librte_flow_classify/rte_flow_classify_version.map
> > +++ b/lib/librte_flow_classify/rte_flow_classify_version.map
> > @@ -4,6 +4,7 @@ EXPERIMENTAL {
> > rte_flow_classifier_create;
> > rte_flow_classifier_free;
> > rte_flow_classifier_query;
> > + rte_flow_classifier_run;
> > rte_flow_classify_table_create;
> > rte_flow_classify_table_entry_add;
> > rte_flow_classify_table_entry_delete;
> > --
> > 2.9.3
>
> This patch fails to apply to the 18.02 master branch, a rebase may be needed.
>
> Regards,
>
> Bernard.
False alarm, the patch applies ok on a fresh checkout.
Regards,
Bernard.
next prev parent reply other threads:[~2017-12-05 11:01 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 11:32 [dpdk-dev] [PATCH 1/3] lib/librte_flow_classify: remove table id parameter from apis Jasvinder Singh
2017-11-23 11:32 ` [dpdk-dev] [PATCH 2/3] lib/librte_flow_classy: add run api for flow classification Jasvinder Singh
2017-12-04 16:46 ` Iremonger, Bernard
2017-12-05 11:01 ` Iremonger, Bernard [this message]
2017-12-06 12:41 ` Iremonger, Bernard
2017-12-11 15:52 ` Singh, Jasvinder
2017-11-23 11:32 ` [dpdk-dev] [PATCH 3/3] doc: update documentation for flow classify lib Jasvinder Singh
2017-12-06 12:04 ` Iremonger, Bernard
2017-12-11 14:54 ` Mcnamara, John
2017-12-11 15:53 ` Singh, Jasvinder
2017-12-04 16:45 ` [dpdk-dev] [PATCH 1/3] lib/librte_flow_classify: remove table id parameter from apis Iremonger, Bernard
2017-12-05 10:59 ` Iremonger, Bernard
2017-12-06 12:34 ` Iremonger, Bernard
2017-12-11 15:51 ` Singh, Jasvinder
2017-12-11 16:26 ` [dpdk-dev] [PATCH v2 1/4] " Jasvinder Singh
2017-12-11 16:26 ` [dpdk-dev] [PATCH v2 2/4] test/test_flow_classify: update test to accomodate changes Jasvinder Singh
2017-12-11 16:26 ` [dpdk-dev] [PATCH v2 3/4] examples/flow_classify: update sample application Jasvinder Singh
2017-12-14 14:42 ` Iremonger, Bernard
2017-12-11 16:26 ` [dpdk-dev] [PATCH v2 4/4] doc: update documentation for flow classify lib Jasvinder Singh
2017-12-14 14:49 ` Iremonger, Bernard
2017-12-15 10:39 ` [dpdk-dev] [PATCH v3 1/4] lib/librte_flow_classify: remove table id parameter from apis Jasvinder Singh
2017-12-15 10:39 ` [dpdk-dev] [PATCH v3 2/4] test/test_flow_classify: update test to accommodate changes Jasvinder Singh
2017-12-19 12:06 ` Iremonger, Bernard
2017-12-15 10:39 ` [dpdk-dev] [PATCH v3 3/4] examples/flow_classify: update sample application Jasvinder Singh
2017-12-19 12:09 ` Iremonger, Bernard
2017-12-15 10:39 ` [dpdk-dev] [PATCH v3 4/4] doc: update documentation for flow classify lib Jasvinder Singh
2017-12-18 11:04 ` Kovacevic, Marko
2017-12-18 13:40 ` Singh, Jasvinder
2017-12-19 12:13 ` Iremonger, Bernard
2017-12-19 12:03 ` [dpdk-dev] [PATCH v3 1/4] lib/librte_flow_classify: remove table id parameter from apis Iremonger, Bernard
2017-12-19 14:29 ` [dpdk-dev] [PATCH v4 " Jasvinder Singh
2017-12-19 14:29 ` [dpdk-dev] [PATCH v4 2/4] test/test_flow_classify: update test to accommodate changes Jasvinder Singh
2017-12-19 14:29 ` [dpdk-dev] [PATCH v4 3/4] examples/flow_classify: update sample application Jasvinder Singh
2017-12-19 14:29 ` [dpdk-dev] [PATCH v4 4/4] doc: update documentation for flow classify lib Jasvinder Singh
2018-01-10 0:19 ` [dpdk-dev] [PATCH v4 1/4] lib/librte_flow_classify: remove table id parameter from apis Thomas Monjalon
2018-01-10 9:54 ` Singh, Jasvinder
2018-01-10 10:52 ` Thomas Monjalon
2018-01-10 10:59 ` Singh, Jasvinder
2018-01-10 11:07 ` Thomas Monjalon
2018-01-10 11:12 ` Singh, Jasvinder
2018-01-11 18:20 ` Thomas Monjalon
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=8CEF83825BEC744B83065625E567D7C24E06464B@IRSMSX108.ger.corp.intel.com \
--to=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=jasvinder.singh@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).