[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1409736300-12303-12-git-send-email-jiri@resnulli.us>
Date: Wed, 3 Sep 2014 11:24:58 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, nhorman@...driver.com, andy@...yhouse.net,
tgraf@...g.ch, dborkman@...hat.com, ogerlitz@...lanox.com,
jesse@...ira.com, pshelar@...ira.com, azhou@...ira.com,
ben@...adent.org.uk, stephen@...workplumber.org,
jeffrey.t.kirsher@...el.com, vyasevic@...hat.com,
xiyou.wangcong@...il.com, john.r.fastabend@...el.com,
edumazet@...gle.com, jhs@...atatu.com, sfeldma@...ulusnetworks.com,
f.fainelli@...il.com, roopa@...ulusnetworks.com,
linville@...driver.com, dev@...nvswitch.org, jasowang@...hat.com,
ebiederm@...ssion.com, nicolas.dichtel@...nd.com,
ryazanov.s.a@...il.com, buytenh@...tstofly.org,
aviadr@...lanox.com, nbd@...nwrt.org, alexei.starovoitov@...il.com,
Neil.Jerram@...aswitch.com, ronye@...lanox.com
Subject: [patch net-next 11/13] sw_flow: add misc section to key with in_port_ifindex field
Signed-off-by: Jiri Pirko <jiri@...nulli.us>
---
include/net/sw_flow.h | 3 +++
net/openvswitch/hw_offload.c | 22 ++++++++++++++++++++++
net/switchdev/switchdev.c | 2 ++
3 files changed, 27 insertions(+)
diff --git a/include/net/sw_flow.h b/include/net/sw_flow.h
index 3af7758..a144d8e 100644
--- a/include/net/sw_flow.h
+++ b/include/net/sw_flow.h
@@ -69,6 +69,9 @@ struct sw_flow_key {
} nd;
} ipv6;
};
+ struct {
+ u32 in_port_ifindex; /* Input switch port ifindex (or 0). */
+ } misc;
} __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */
struct sw_flow_key_range {
diff --git a/net/openvswitch/hw_offload.c b/net/openvswitch/hw_offload.c
index 45a0c5f..5c3edd0 100644
--- a/net/openvswitch/hw_offload.c
+++ b/net/openvswitch/hw_offload.c
@@ -83,6 +83,24 @@ errout:
return err;
}
+void ovs_hw_flow_adjust(struct datapath *dp, struct ovs_flow *flow)
+{
+ struct vport *vport;
+
+ flow->flow.key.misc.in_port_ifindex = 0;
+ flow->flow.mask->key.misc.in_port_ifindex = 0;
+ vport = ovs_vport_ovsl(dp, flow->flow.key.phy.in_port);
+ if (vport && vport->ops->type == OVS_VPORT_TYPE_NETDEV) {
+ struct net_device *dev;
+
+ dev = vport->ops->get_netdev(vport);
+ if (dev) {
+ flow->flow.key.misc.in_port_ifindex = dev->ifindex;
+ flow->flow.mask->key.misc.in_port_ifindex = 0xFFFFFFFF;
+ }
+ }
+}
+
int ovs_hw_flow_insert(struct datapath *dp, struct ovs_flow *flow)
{
struct sw_flow_actions *actions;
@@ -93,6 +111,8 @@ int ovs_hw_flow_insert(struct datapath *dp, struct ovs_flow *flow)
ASSERT_OVSL();
BUG_ON(flow->flow.actions);
+ ovs_hw_flow_adjust(dp, flow);
+
err = sw_flow_action_create(dp, &actions, flow->sf_acts);
if (err)
return err;
@@ -124,6 +144,8 @@ int ovs_hw_flow_remove(struct datapath *dp, struct ovs_flow *flow)
ASSERT_OVSL();
+ ovs_hw_flow_adjust(dp, flow);
+
if (!flow->flow.actions) {
err = sw_flow_action_create(dp, &actions, flow->sf_acts);
if (err)
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index e079707..05acb0b 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -129,6 +129,8 @@ static void print_flow(const struct sw_flow *flow, struct net_device *dev,
print_flow_key_ip(PREFIX_MASK, &flow->mask->key);
print_flow_key_ipv4(PREFIX_NONE, &flow->key);
print_flow_key_ipv4(PREFIX_MASK, &flow->mask->key);
+ print_flow_key_misc(PREFIX_NONE, &flow->key);
+ print_flow_key_misc(PREFIX_MASK, &flow->mask->key);
print_flow_actions(flow->actions);
}
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists