From: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
To: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH net-next 03/17] openvswitch: Change ovs_flow_tbl_lookup_xx() APIs
Date: Mon, 6 Jan 2014 16:16:02 -0800 [thread overview]
Message-ID: <1389053776-62865-4-git-send-email-jesse@nicira.com> (raw)
In-Reply-To: <1389053776-62865-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
From: Andy Zhou <azhou-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
API changes only for code readability. No functional chnages.
This patch removes the underscored version. Added a new API
ovs_flow_tbl_lookup_stats() that returns the n_mask_hits.
Reported by: Ben Pfaff <blp-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Thomas Graf <tgraf-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Andy Zhou <azhou-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
net/openvswitch/datapath.c | 16 ++++------------
net/openvswitch/flow_table.c | 10 +++++++++-
net/openvswitch/flow_table.h | 4 +++-
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 6f5e1dd..fcaed98 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -234,7 +234,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
}
/* Look up flow. */
- flow = ovs_flow_tbl_lookup(&dp->table, &key, &n_mask_hit);
+ flow = ovs_flow_tbl_lookup_stats(&dp->table, &key, &n_mask_hit);
if (unlikely(!flow)) {
struct dp_upcall_info upcall;
@@ -751,14 +751,6 @@ static struct sk_buff *ovs_flow_cmd_build_info(struct sw_flow *flow,
return skb;
}
-static struct sw_flow *__ovs_flow_tbl_lookup(struct flow_table *tbl,
- const struct sw_flow_key *key)
-{
- u32 __always_unused n_mask_hit;
-
- return ovs_flow_tbl_lookup(tbl, key, &n_mask_hit);
-}
-
static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
@@ -809,7 +801,7 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
goto err_unlock_ovs;
/* Check if this is a duplicate flow */
- flow = __ovs_flow_tbl_lookup(&dp->table, &key);
+ flow = ovs_flow_tbl_lookup(&dp->table, &key);
if (!flow) {
/* Bail out if we're not allowed to create a new flow. */
error = -ENOENT;
@@ -921,7 +913,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
goto unlock;
}
- flow = __ovs_flow_tbl_lookup(&dp->table, &key);
+ flow = ovs_flow_tbl_lookup(&dp->table, &key);
if (!flow || !ovs_flow_cmp_unmasked_key(flow, &match)) {
err = -ENOENT;
goto unlock;
@@ -969,7 +961,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
if (err)
goto unlock;
- flow = __ovs_flow_tbl_lookup(&dp->table, &key);
+ flow = ovs_flow_tbl_lookup(&dp->table, &key);
if (!flow || !ovs_flow_cmp_unmasked_key(flow, &match)) {
err = -ENOENT;
goto unlock;
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index f96ebd5..261a54e 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -429,7 +429,7 @@ static struct sw_flow *masked_flow_lookup(struct table_instance *ti,
return NULL;
}
-struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl,
+struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl,
const struct sw_flow_key *key,
u32 *n_mask_hit)
{
@@ -447,6 +447,14 @@ struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl,
return NULL;
}
+struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl,
+ const struct sw_flow_key *key)
+{
+ u32 __always_unused n_mask_hit;
+
+ return ovs_flow_tbl_lookup_stats(tbl, key, &n_mask_hit);
+}
+
int ovs_flow_tbl_num_masks(const struct flow_table *table)
{
struct sw_flow_mask *mask;
diff --git a/net/openvswitch/flow_table.h b/net/openvswitch/flow_table.h
index fbe45d5..f54aa82 100644
--- a/net/openvswitch/flow_table.h
+++ b/net/openvswitch/flow_table.h
@@ -69,9 +69,11 @@ void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow);
int ovs_flow_tbl_num_masks(const struct flow_table *table);
struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *table,
u32 *bucket, u32 *idx);
-struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
+struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *,
const struct sw_flow_key *,
u32 *n_mask_hit);
+struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
+ const struct sw_flow_key *);
bool ovs_flow_cmp_unmasked_key(const struct sw_flow *flow,
struct sw_flow_match *match);
--
1.8.3.2
next prev parent reply other threads:[~2014-01-07 0:16 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 0:15 [GIT net-next] Open vSwitch Jesse Gross
[not found] ` <1389053776-62865-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2014-01-07 0:16 ` [PATCH net-next 01/17] openvswitch: Correct comment Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 02/17] openvswitch: Shrink sw_flow_mask by 8 bytes (64-bit) or 4 bytes (32-bit) Jesse Gross
2014-01-07 21:36 ` Sergei Shtylyov
2014-01-07 0:16 ` Jesse Gross [this message]
2014-01-07 0:16 ` [PATCH net-next 04/17] openvswitch: Silence RCU lockdep checks from flow lookup Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 05/17] genl: Add genlmsg_new_unicast() for unicast message allocation Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 06/17] netlink: Avoid netlink mmap alloc if msg size exceeds frame size Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 07/17] openvswitch: Enable memory mapped Netlink i/o Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 08/17] openvswitch: Per cpu flow stats Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 09/17] net: ovs: use kfree_rcu instead of rcu_free_{sw_flow_mask_cb, acts_callback} Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 10/17] openvswitch: remove duplicated include from flow_table.c Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 11/17] net: Export skb_zerocopy() to zerocopy from one skb to another Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 12/17] openvswitch: Allow user space to announce ability to accept unaligned Netlink messages Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 13/17] openvswitch: Drop user features if old user space attempted to create datapath Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 14/17] openvswitch: Pass datapath into userspace queue functions Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 15/17] openvswitch: Use skb_zerocopy() for upcall Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 16/17] openvswitch: Compute checksum in skb_gso_segment() if needed Jesse Gross
2014-01-07 0:16 ` [PATCH net-next 17/17] ovs: make functions local Jesse Gross
2014-01-07 0:49 ` [GIT net-next] Open vSwitch David Miller
2014-01-08 14:49 ` [ovs-dev] " Zoltan Kiss
[not found] ` <52CD657F.7080806-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2014-01-08 15:10 ` Jesse Gross
2014-01-13 18:04 ` [ovs-dev] " Zoltan Kiss
[not found] ` <52D42A9E.1030805-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2014-01-14 0:31 ` Zoltan Kiss
[not found] ` <52D4857C.7020902-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2014-01-14 1:30 ` Jesse Gross
[not found] ` <CAEP_g=8nG6AHV9Y+5=48nPhkf5Oe=mG8EiyaKSqN4omnmGhv4A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-14 9:46 ` Thomas Graf
2014-01-14 12:31 ` [ovs-dev] " Zoltan Kiss
2014-01-14 16:16 ` [PATCH net-next] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed Thomas Graf
2014-01-14 16:19 ` Thomas Graf
2014-01-14 16:27 ` [PATCH net-next v2] " Thomas Graf
2014-01-14 18:56 ` Zoltan Kiss
2014-01-15 3:03 ` David Miller
2014-01-15 22:53 ` Jesse Gross
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=1389053776-62865-4-git-send-email-jesse@nicira.com \
--to=jesse-l0m0p4e3n4lqt0dzr+alfa@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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).