[ovs-dev] [PATCH] Datapath action should not refer to controller
pravin shelar
pshelar at nicira.com
Wed Jul 27 12:58:43 UTC 2011
ODP_ACTION_ATTR_CONTROLLER in the kernel actually sends packets to userspace,
not the controller.
To make it generic rename this action to ODP_ACTION_ATTR_USERSPACE.
Signed-off-by: pravin b shelar <pshelar at nicira.com>
---
datapath/actions.c | 6 +++---
datapath/datapath.c | 10 +++++-----
include/openvswitch/datapath-protocol.h | 10 +++++-----
lib/dpif-netdev.c | 4 ++--
lib/odp-util.c | 4 ++--
ofproto/ofproto-dpif.c | 4 ++--
6 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/datapath/actions.c b/datapath/actions.c
index ed61039..78712c6 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -218,7 +218,7 @@ error:
kfree_skb(skb);
}
-static int output_control(struct datapath *dp, struct sk_buff *skb, u64 arg)
+static int output_userspace(struct datapath *dp, struct sk_buff *skb, u64 arg)
{
struct dp_upcall_info upcall;
@@ -262,8 +262,8 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
prev_port = nla_get_u32(a);
break;
- case ODP_ACTION_ATTR_CONTROLLER:
- err = output_control(dp, skb, nla_get_u64(a));
+ case ODP_ACTION_ATTR_USERSPACE:
+ err = output_userspace(dp, skb, nla_get_u64(a));
break;
case ODP_ACTION_ATTR_SET_TUNNEL:
diff --git a/datapath/datapath.c b/datapath/datapath.c
index d149344..a964c27 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -84,7 +84,7 @@ EXPORT_SYMBOL(dp_ioctl_hook);
static LIST_HEAD(dps);
static struct vport *new_vport(const struct vport_parms *);
-static int queue_control_packets(struct datapath *, struct sk_buff *,
+static int queue_userspace_packets(struct datapath *, struct sk_buff *,
const struct dp_upcall_info *);
/* Must be called with rcu_read_lock, genl_mutex, or RTNL lock. */
@@ -415,7 +415,7 @@ int dp_upcall(struct datapath *dp, struct sk_buff *skb, const struct dp_upcall_i
skb = nskb;
}
- err = queue_control_packets(dp, skb, upcall_info);
+ err = queue_userspace_packets(dp, skb, upcall_info);
if (err)
goto err;
@@ -438,7 +438,7 @@ err:
* 'upcall_info'. There will be only one packet unless we broke up a GSO
* packet.
*/
-static int queue_control_packets(struct datapath *dp, struct sk_buff *skb,
+static int queue_userspace_packets(struct datapath *dp, struct sk_buff *skb,
const struct dp_upcall_info *upcall_info)
{
u32 group = packet_mc_group(dp, upcall_info->cmd);
@@ -552,7 +552,7 @@ static int validate_actions(const struct nlattr *attr)
nla_for_each_nested(a, attr, rem) {
static const u32 action_lens[ODP_ACTION_ATTR_MAX + 1] = {
[ODP_ACTION_ATTR_OUTPUT] = 4,
- [ODP_ACTION_ATTR_CONTROLLER] = 8,
+ [ODP_ACTION_ATTR_USERSPACE] = 8,
[ODP_ACTION_ATTR_SET_DL_TCI] = 2,
[ODP_ACTION_ATTR_STRIP_VLAN] = 0,
[ODP_ACTION_ATTR_SET_DL_SRC] = ETH_ALEN,
@@ -575,7 +575,7 @@ static int validate_actions(const struct nlattr *attr)
case ODP_ACTION_ATTR_UNSPEC:
return -EINVAL;
- case ODP_ACTION_ATTR_CONTROLLER:
+ case ODP_ACTION_ATTR_USERSPACE:
case ODP_ACTION_ATTR_STRIP_VLAN:
case ODP_ACTION_ATTR_SET_DL_SRC:
case ODP_ACTION_ATTR_SET_DL_DST:
diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h
index e7708ef..faaf064 100644
--- a/include/openvswitch/datapath-protocol.h
+++ b/include/openvswitch/datapath-protocol.h
@@ -145,7 +145,7 @@ enum odp_packet_cmd {
/* Kernel-to-user notifications. */
ODP_PACKET_CMD_MISS, /* Flow table miss. */
- ODP_PACKET_CMD_ACTION, /* ODP_ACTION_ATTR_CONTROLLER action. */
+ ODP_PACKET_CMD_ACTION, /* ODP_ACTION_ATTR_USERSPACE action. */
ODP_PACKET_CMD_SAMPLE, /* Sampled packet. */
/* User commands. */
@@ -157,14 +157,14 @@ enum odp_packet_cmd {
* @ODP_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
* packet as received, from the start of the Ethernet header onward. For
* %ODP_PACKET_CMD_ACTION, %ODP_PACKET_ATTR_PACKET reflects changes made by
- * actions preceding %ODP_ACTION_ATTR_CONTROLLER, but %ODP_PACKET_ATTR_KEY is
+ * actions preceding %ODP_ACTION_ATTR_USERSPACE, but %ODP_PACKET_ATTR_KEY is
* the flow key extracted from the packet as originally received.
* @ODP_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
* extracted from the packet as nested %ODP_KEY_ATTR_* attributes. This allows
* userspace to adapt its flow setup strategy by comparing its notion of the
* flow key against the kernel's.
* @ODP_PACKET_ATTR_USERDATA: Present for an %ODP_PACKET_CMD_ACTION
- * notification if the %ODP_ACTION_ATTR_CONTROLLER, action's argument was
+ * notification if the %ODP_ACTION_ATTR_USERSPACE, action's argument was
* nonzero.
* @ODP_PACKET_ATTR_SAMPLE_POOL: Present for %ODP_PACKET_CMD_SAMPLE. Contains
* the number of packets processed so far that were candidates for sampling.
@@ -179,7 +179,7 @@ enum odp_packet_attr {
ODP_PACKET_ATTR_UNSPEC,
ODP_PACKET_ATTR_PACKET, /* Packet data. */
ODP_PACKET_ATTR_KEY, /* Nested ODP_KEY_ATTR_* attributes. */
- ODP_PACKET_ATTR_USERDATA, /* u64 ODP_ACTION_ATTR_CONTROLLER arg. */
+ ODP_PACKET_ATTR_USERDATA, /* u64 ODP_ACTION_ATTR_USERSPACE arg. */
ODP_PACKET_ATTR_SAMPLE_POOL, /* # sampling candidate packets so far. */
ODP_PACKET_ATTR_ACTIONS, /* Nested ODP_ACTION_ATTR_* attributes. */
__ODP_PACKET_ATTR_MAX
@@ -409,7 +409,7 @@ enum odp_flow_attr {
enum odp_action_type {
ODP_ACTION_ATTR_UNSPEC,
ODP_ACTION_ATTR_OUTPUT, /* Output to switch port. */
- ODP_ACTION_ATTR_CONTROLLER, /* Send copy to controller. */
+ ODP_ACTION_ATTR_USERSPACE, /* Send copy to userpace. */
ODP_ACTION_ATTR_SET_DL_TCI, /* Set the 802.1q TCI value. */
ODP_ACTION_ATTR_STRIP_VLAN, /* Strip the 802.1q header. */
ODP_ACTION_ATTR_SET_DL_SRC, /* Ethernet source address. */
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 3b93a4c..771773e 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -707,7 +707,7 @@ dpif_netdev_validate_actions(const struct nlattr *actions,
}
break;
- case ODP_ACTION_ATTR_CONTROLLER:
+ case ODP_ACTION_ATTR_USERSPACE:
break;
case ODP_ACTION_ATTR_SET_DL_TCI:
@@ -1299,7 +1299,7 @@ dp_netdev_execute_actions(struct dp_netdev *dp,
dp_netdev_output_port(dp, packet, nl_attr_get_u32(a));
break;
- case ODP_ACTION_ATTR_CONTROLLER:
+ case ODP_ACTION_ATTR_USERSPACE:
dp_netdev_output_control(dp, packet, DPIF_UC_ACTION,
key, nl_attr_get_u64(a));
break;
diff --git a/lib/odp-util.c b/lib/odp-util.c
index d7a3118..b59ecaf 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -41,7 +41,7 @@ odp_action_len(uint16_t type)
switch ((enum odp_action_type) type) {
case ODP_ACTION_ATTR_OUTPUT: return 4;
- case ODP_ACTION_ATTR_CONTROLLER: return 8;
+ case ODP_ACTION_ATTR_USERSPACE: return 8;
case ODP_ACTION_ATTR_SET_DL_TCI: return 2;
case ODP_ACTION_ATTR_STRIP_VLAN: return 0;
case ODP_ACTION_ATTR_SET_DL_SRC: return ETH_ADDR_LEN;
@@ -99,7 +99,7 @@ format_odp_action(struct ds *ds, const struct nlattr *a)
case ODP_ACTION_ATTR_OUTPUT:
ds_put_format(ds, "%"PRIu16, nl_attr_get_u32(a));
break;
- case ODP_ACTION_ATTR_CONTROLLER:
+ case ODP_ACTION_ATTR_USERSPACE:
ds_put_format(ds, "ctl(%"PRIu64")", nl_attr_get_u64(a));
break;
case ODP_ACTION_ATTR_SET_TUNNEL:
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index a700d5e..ab6f508 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -2046,7 +2046,7 @@ execute_odp_actions(struct ofproto_dpif *ofproto, const struct flow *flow,
struct ofpbuf *packet)
{
if (actions_len == NLA_ALIGN(NLA_HDRLEN + sizeof(uint64_t))
- && odp_actions->nla_type == ODP_ACTION_ATTR_CONTROLLER) {
+ && odp_actions->nla_type == ODP_ACTION_ATTR_USERSPACE) {
/* As an optimization, avoid a round-trip from userspace to kernel to
* userspace. This also avoids possibly filling up kernel packet
* buffers along the way. */
@@ -2955,7 +2955,7 @@ xlate_output_action__(struct action_xlate_ctx *ctx,
break;
case OFPP_CONTROLLER:
commit_odp_actions(ctx);
- nl_msg_put_u64(ctx->odp_actions, ODP_ACTION_ATTR_CONTROLLER, max_len);
+ nl_msg_put_u64(ctx->odp_actions, ODP_ACTION_ATTR_USERSPACE, max_len);
break;
case OFPP_LOCAL:
add_output_action(ctx, OFPP_LOCAL);
--
1.7.6.134.gcf13f
More information about the dev
mailing list