return err;
nh = ip_hdr(skb);
- nwaddr = nla_type(a) == ODP_ACTION_ATTR_SET_NW_SRC ? &nh->saddr : &nh->daddr;
+ nwaddr = nla_type(a) == OVS_ACTION_ATTR_SET_NW_SRC ? &nh->saddr : &nh->daddr;
check = get_l4_checksum(skb);
if (likely(check))
* supports those protocols.
*/
th = udp_hdr(skb);
- port = nla_type(a) == ODP_ACTION_ATTR_SET_TP_SRC ? &th->source : &th->dest;
+ port = nla_type(a) == OVS_ACTION_ATTR_SET_TP_SRC ? &th->source : &th->dest;
inet_proto_csum_replace2(check, skb, *port, nla_get_be16(a), 0);
*port = nla_get_be16(a);
skb_clear_rxhash(skb);
if (!skb)
return -ENOMEM;
- upcall.cmd = ODP_PACKET_CMD_ACTION;
+ upcall.cmd = OVS_PACKET_CMD_ACTION;
upcall.key = &OVS_CB(skb)->flow->key;
upcall.userdata = arg;
upcall.sample_pool = 0;
}
switch (nla_type(a)) {
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
prev_port = nla_get_u32(a);
break;
- case ODP_ACTION_ATTR_USERSPACE:
+ case OVS_ACTION_ATTR_USERSPACE:
err = output_userspace(dp, skb, nla_get_u64(a));
break;
- case ODP_ACTION_ATTR_SET_TUNNEL:
+ case OVS_ACTION_ATTR_SET_TUNNEL:
OVS_CB(skb)->tun_id = nla_get_be64(a);
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
err = modify_vlan_tci(skb, nla_get_be16(a));
break;
- case ODP_ACTION_ATTR_STRIP_VLAN:
+ case OVS_ACTION_ATTR_STRIP_VLAN:
err = strip_vlan(skb);
break;
- case ODP_ACTION_ATTR_SET_DL_SRC:
+ case OVS_ACTION_ATTR_SET_DL_SRC:
err = make_writable(skb, ETH_HLEN);
if (likely(!err))
memcpy(eth_hdr(skb)->h_source, nla_data(a), ETH_ALEN);
break;
- case ODP_ACTION_ATTR_SET_DL_DST:
+ case OVS_ACTION_ATTR_SET_DL_DST:
err = make_writable(skb, ETH_HLEN);
if (likely(!err))
memcpy(eth_hdr(skb)->h_dest, nla_data(a), ETH_ALEN);
break;
- case ODP_ACTION_ATTR_SET_NW_SRC:
- case ODP_ACTION_ATTR_SET_NW_DST:
+ case OVS_ACTION_ATTR_SET_NW_SRC:
+ case OVS_ACTION_ATTR_SET_NW_DST:
err = set_nw_addr(skb, a);
break;
- case ODP_ACTION_ATTR_SET_NW_TOS:
+ case OVS_ACTION_ATTR_SET_NW_TOS:
err = set_nw_tos(skb, nla_get_u8(a));
break;
- case ODP_ACTION_ATTR_SET_TP_SRC:
- case ODP_ACTION_ATTR_SET_TP_DST:
+ case OVS_ACTION_ATTR_SET_TP_SRC:
+ case OVS_ACTION_ATTR_SET_TP_DST:
err = set_tp_port(skb, a);
break;
- case ODP_ACTION_ATTR_SET_PRIORITY:
+ case OVS_ACTION_ATTR_SET_PRIORITY:
skb->priority = nla_get_u32(a);
break;
- case ODP_ACTION_ATTR_POP_PRIORITY:
+ case OVS_ACTION_ATTR_POP_PRIORITY:
skb->priority = priority;
break;
}
if (unlikely(!nskb))
return;
- upcall.cmd = ODP_PACKET_CMD_SAMPLE;
+ upcall.cmd = OVS_PACKET_CMD_SAMPLE;
upcall.key = &OVS_CB(skb)->flow->key;
upcall.userdata = 0;
upcall.sample_pool = atomic_read(&p->sflow_pool);
/* Must be called with rcu_read_lock or RTNL lock. */
const char *dp_name(const struct datapath *dp)
{
- return vport_get_name(rcu_dereference_rtnl(dp->ports[ODPP_LOCAL]));
+ return vport_get_name(rcu_dereference_rtnl(dp->ports[OVSP_LOCAL]));
}
static inline size_t br_nlmsg_size(void)
NLA_PUT_STRING(skb, IFLA_IFNAME, vport_get_name(port));
NLA_PUT_U32(skb, IFLA_MASTER,
- vport_get_ifindex(get_vport_protected(dp, ODPP_LOCAL)));
+ vport_get_ifindex(get_vport_protected(dp, OVSP_LOCAL)));
NLA_PUT_U32(skb, IFLA_MTU, vport_get_mtu(port));
#ifdef IFLA_OPERSTATE
NLA_PUT_U8(skb, IFLA_OPERSTATE,
{
ASSERT_RTNL();
- if (p->port_no != ODPP_LOCAL)
+ if (p->port_no != OVSP_LOCAL)
dp_sysfs_del_if(p);
dp_ifinfo_notify(RTM_DELLINK, p);
if (unlikely(!flow_node)) {
struct dp_upcall_info upcall;
- upcall.cmd = ODP_PACKET_CMD_MISS;
+ upcall.cmd = OVS_PACKET_CMD_MISS;
upcall.key = &key;
upcall.userdata = 0;
upcall.sample_pool = 0;
static struct genl_family dp_packet_genl_family = {
.id = GENL_ID_GENERATE,
- .hdrsize = sizeof(struct odp_header),
- .name = ODP_PACKET_FAMILY,
+ .hdrsize = sizeof(struct ovs_header),
+ .name = OVS_PACKET_FAMILY,
.version = 1,
- .maxattr = ODP_PACKET_ATTR_MAX
+ .maxattr = OVS_PACKET_ATTR_MAX
};
/* Generic Netlink multicast groups for upcalls.
* We really want three unique multicast groups per datapath, but we can't even
* get one, because genl_register_mc_group() takes genl_lock, which is also
* held during Generic Netlink message processing, so trying to acquire
- * multicast groups during ODP_DP_NEW processing deadlocks. Instead, we
+ * multicast groups during OVS_DP_NEW processing deadlocks. Instead, we
* preallocate a few groups and use them round-robin for datapaths. Collision
* isn't fatal--multicast listeners should check that the family is the one
* that they want and discard others--but it wastes time and memory to receive
int err;
do {
- struct odp_header *upcall;
+ struct ovs_header *upcall;
struct sk_buff *user_skb; /* to be queued to userspace */
struct nlattr *nla;
unsigned int len;
if (nla_attr_size(skb->len) > USHRT_MAX)
goto err_kfree_skbs;
- len = sizeof(struct odp_header);
+ len = sizeof(struct ovs_header);
len += nla_total_size(skb->len);
len += nla_total_size(FLOW_BUFSIZE);
if (upcall_info->userdata)
upcall = genlmsg_put(user_skb, 0, 0, &dp_packet_genl_family, 0, upcall_info->cmd);
upcall->dp_ifindex = dp->dp_ifindex;
- nla = nla_nest_start(user_skb, ODP_PACKET_ATTR_KEY);
+ nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_KEY);
flow_to_nlattrs(upcall_info->key, user_skb);
nla_nest_end(user_skb, nla);
if (upcall_info->userdata)
- nla_put_u64(user_skb, ODP_PACKET_ATTR_USERDATA, upcall_info->userdata);
+ nla_put_u64(user_skb, OVS_PACKET_ATTR_USERDATA, upcall_info->userdata);
if (upcall_info->sample_pool)
- nla_put_u32(user_skb, ODP_PACKET_ATTR_SAMPLE_POOL, upcall_info->sample_pool);
+ nla_put_u32(user_skb, OVS_PACKET_ATTR_SAMPLE_POOL, upcall_info->sample_pool);
if (upcall_info->actions_len) {
const struct nlattr *actions = upcall_info->actions;
u32 actions_len = upcall_info->actions_len;
- nla = nla_nest_start(user_skb, ODP_PACKET_ATTR_ACTIONS);
+ nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_ACTIONS);
memcpy(__skb_put(user_skb, actions_len), actions, actions_len);
nla_nest_end(user_skb, nla);
}
- nla = __nla_reserve(user_skb, ODP_PACKET_ATTR_PACKET, skb->len);
+ nla = __nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, skb->len);
if (skb->ip_summed == CHECKSUM_PARTIAL)
copy_and_csum_skb(skb, nla_data(nla));
else
int rem;
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_USERSPACE] = 8,
- [ODP_ACTION_ATTR_SET_DL_TCI] = 2,
- [ODP_ACTION_ATTR_STRIP_VLAN] = 0,
- [ODP_ACTION_ATTR_SET_DL_SRC] = ETH_ALEN,
- [ODP_ACTION_ATTR_SET_DL_DST] = ETH_ALEN,
- [ODP_ACTION_ATTR_SET_NW_SRC] = 4,
- [ODP_ACTION_ATTR_SET_NW_DST] = 4,
- [ODP_ACTION_ATTR_SET_NW_TOS] = 1,
- [ODP_ACTION_ATTR_SET_TP_SRC] = 2,
- [ODP_ACTION_ATTR_SET_TP_DST] = 2,
- [ODP_ACTION_ATTR_SET_TUNNEL] = 8,
- [ODP_ACTION_ATTR_SET_PRIORITY] = 4,
- [ODP_ACTION_ATTR_POP_PRIORITY] = 0,
+ static const u32 action_lens[OVS_ACTION_ATTR_MAX + 1] = {
+ [OVS_ACTION_ATTR_OUTPUT] = 4,
+ [OVS_ACTION_ATTR_USERSPACE] = 8,
+ [OVS_ACTION_ATTR_SET_DL_TCI] = 2,
+ [OVS_ACTION_ATTR_STRIP_VLAN] = 0,
+ [OVS_ACTION_ATTR_SET_DL_SRC] = ETH_ALEN,
+ [OVS_ACTION_ATTR_SET_DL_DST] = ETH_ALEN,
+ [OVS_ACTION_ATTR_SET_NW_SRC] = 4,
+ [OVS_ACTION_ATTR_SET_NW_DST] = 4,
+ [OVS_ACTION_ATTR_SET_NW_TOS] = 1,
+ [OVS_ACTION_ATTR_SET_TP_SRC] = 2,
+ [OVS_ACTION_ATTR_SET_TP_DST] = 2,
+ [OVS_ACTION_ATTR_SET_TUNNEL] = 8,
+ [OVS_ACTION_ATTR_SET_PRIORITY] = 4,
+ [OVS_ACTION_ATTR_POP_PRIORITY] = 0,
};
int type = nla_type(a);
- if (type > ODP_ACTION_ATTR_MAX || nla_len(a) != action_lens[type])
+ if (type > OVS_ACTION_ATTR_MAX || nla_len(a) != action_lens[type])
return -EINVAL;
switch (type) {
- case ODP_ACTION_ATTR_UNSPEC:
+ case OVS_ACTION_ATTR_UNSPEC:
return -EINVAL;
- 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:
- case ODP_ACTION_ATTR_SET_NW_SRC:
- case ODP_ACTION_ATTR_SET_NW_DST:
- case ODP_ACTION_ATTR_SET_TP_SRC:
- case ODP_ACTION_ATTR_SET_TP_DST:
- case ODP_ACTION_ATTR_SET_TUNNEL:
- case ODP_ACTION_ATTR_SET_PRIORITY:
- case ODP_ACTION_ATTR_POP_PRIORITY:
+ case OVS_ACTION_ATTR_USERSPACE:
+ case OVS_ACTION_ATTR_STRIP_VLAN:
+ case OVS_ACTION_ATTR_SET_DL_SRC:
+ case OVS_ACTION_ATTR_SET_DL_DST:
+ case OVS_ACTION_ATTR_SET_NW_SRC:
+ case OVS_ACTION_ATTR_SET_NW_DST:
+ case OVS_ACTION_ATTR_SET_TP_SRC:
+ case OVS_ACTION_ATTR_SET_TP_DST:
+ case OVS_ACTION_ATTR_SET_TUNNEL:
+ case OVS_ACTION_ATTR_SET_PRIORITY:
+ case OVS_ACTION_ATTR_POP_PRIORITY:
/* No validation needed. */
break;
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
if (nla_get_u32(a) >= DP_MAX_PORTS)
return -EINVAL;
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
if (nla_get_be16(a) & htons(VLAN_CFI_MASK))
return -EINVAL;
break;
- case ODP_ACTION_ATTR_SET_NW_TOS:
+ case OVS_ACTION_ATTR_SET_NW_TOS:
if (nla_get_u8(a) & INET_ECN_MASK)
return -EINVAL;
break;
return 0;
}
-static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
+static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
{
- struct odp_header *odp_header = info->userhdr;
+ struct ovs_header *ovs_header = info->userhdr;
struct nlattr **a = info->attrs;
struct sw_flow_actions *acts;
struct sk_buff *packet;
int key_len;
err = -EINVAL;
- if (!a[ODP_PACKET_ATTR_PACKET] || !a[ODP_PACKET_ATTR_KEY] ||
- !a[ODP_PACKET_ATTR_ACTIONS] ||
- nla_len(a[ODP_PACKET_ATTR_PACKET]) < ETH_HLEN)
+ if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
+ !a[OVS_PACKET_ATTR_ACTIONS] ||
+ nla_len(a[OVS_PACKET_ATTR_PACKET]) < ETH_HLEN)
goto err;
- err = validate_actions(a[ODP_PACKET_ATTR_ACTIONS]);
+ err = validate_actions(a[OVS_PACKET_ATTR_ACTIONS]);
if (err)
goto err;
- len = nla_len(a[ODP_PACKET_ATTR_PACKET]);
+ len = nla_len(a[OVS_PACKET_ATTR_PACKET]);
packet = __dev_alloc_skb(NET_IP_ALIGN + len, GFP_KERNEL);
err = -ENOMEM;
if (!packet)
goto err;
skb_reserve(packet, NET_IP_ALIGN);
- memcpy(__skb_put(packet, len), nla_data(a[ODP_PACKET_ATTR_PACKET]), len);
+ memcpy(__skb_put(packet, len), nla_data(a[OVS_PACKET_ATTR_PACKET]), len);
skb_reset_mac_header(packet);
eth = eth_hdr(packet);
err = flow_metadata_from_nlattrs(&flow->key.eth.in_port,
&flow->key.eth.tun_id,
- a[ODP_PACKET_ATTR_KEY]);
+ a[OVS_PACKET_ATTR_KEY]);
if (err)
goto err_flow_put;
- acts = flow_actions_alloc(a[ODP_PACKET_ATTR_ACTIONS]);
+ acts = flow_actions_alloc(a[OVS_PACKET_ATTR_ACTIONS]);
err = PTR_ERR(acts);
if (IS_ERR(acts))
goto err_flow_put;
OVS_CB(packet)->flow = flow;
rcu_read_lock();
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
err = -ENODEV;
if (!dp)
goto err_unlock;
return err;
}
-static const struct nla_policy packet_policy[ODP_PACKET_ATTR_MAX + 1] = {
- [ODP_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC },
- [ODP_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
- [ODP_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
+static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
+ [OVS_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC },
+ [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
+ [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
};
static struct genl_ops dp_packet_genl_ops[] = {
- { .cmd = ODP_PACKET_CMD_EXECUTE,
+ { .cmd = OVS_PACKET_CMD_EXECUTE,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = packet_policy,
- .doit = odp_packet_cmd_execute
+ .doit = ovs_packet_cmd_execute
}
};
-static void get_dp_stats(struct datapath *dp, struct odp_stats *stats)
+static void get_dp_stats(struct datapath *dp, struct ovs_dp_stats *stats)
{
int i;
struct tbl *table = get_table_protected(dp);
}
}
-static const struct nla_policy flow_policy[ODP_FLOW_ATTR_MAX + 1] = {
- [ODP_FLOW_ATTR_KEY] = { .type = NLA_NESTED },
- [ODP_FLOW_ATTR_ACTIONS] = { .type = NLA_NESTED },
- [ODP_FLOW_ATTR_CLEAR] = { .type = NLA_FLAG },
+static const struct nla_policy flow_policy[OVS_FLOW_ATTR_MAX + 1] = {
+ [OVS_FLOW_ATTR_KEY] = { .type = NLA_NESTED },
+ [OVS_FLOW_ATTR_ACTIONS] = { .type = NLA_NESTED },
+ [OVS_FLOW_ATTR_CLEAR] = { .type = NLA_FLAG },
};
static struct genl_family dp_flow_genl_family = {
.id = GENL_ID_GENERATE,
- .hdrsize = sizeof(struct odp_header),
- .name = ODP_FLOW_FAMILY,
+ .hdrsize = sizeof(struct ovs_header),
+ .name = OVS_FLOW_FAMILY,
.version = 1,
- .maxattr = ODP_FLOW_ATTR_MAX
+ .maxattr = OVS_FLOW_ATTR_MAX
};
static struct genl_multicast_group dp_flow_multicast_group = {
- .name = ODP_FLOW_MCGROUP
+ .name = OVS_FLOW_MCGROUP
};
/* Called with genl_lock. */
-static int odp_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
+static int ovs_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
struct sk_buff *skb, u32 pid, u32 seq, u32 flags, u8 cmd)
{
const int skb_orig_len = skb->len;
const struct sw_flow_actions *sf_acts;
- struct odp_flow_stats stats;
- struct odp_header *odp_header;
+ struct ovs_flow_stats stats;
+ struct ovs_header *ovs_header;
struct nlattr *nla;
unsigned long used;
u8 tcp_flags;
sf_acts = rcu_dereference_protected(flow->sf_acts,
lockdep_genl_is_held());
- odp_header = genlmsg_put(skb, pid, seq, &dp_flow_genl_family, flags, cmd);
- if (!odp_header)
+ ovs_header = genlmsg_put(skb, pid, seq, &dp_flow_genl_family, flags, cmd);
+ if (!ovs_header)
return -EMSGSIZE;
- odp_header->dp_ifindex = dp->dp_ifindex;
+ ovs_header->dp_ifindex = dp->dp_ifindex;
- nla = nla_nest_start(skb, ODP_FLOW_ATTR_KEY);
+ nla = nla_nest_start(skb, OVS_FLOW_ATTR_KEY);
if (!nla)
goto nla_put_failure;
err = flow_to_nlattrs(&flow->key, skb);
spin_unlock_bh(&flow->lock);
if (used)
- NLA_PUT_U64(skb, ODP_FLOW_ATTR_USED, flow_used_time(used));
+ NLA_PUT_U64(skb, OVS_FLOW_ATTR_USED, flow_used_time(used));
if (stats.n_packets)
- NLA_PUT(skb, ODP_FLOW_ATTR_STATS, sizeof(struct odp_flow_stats), &stats);
+ NLA_PUT(skb, OVS_FLOW_ATTR_STATS, sizeof(struct ovs_flow_stats), &stats);
if (tcp_flags)
- NLA_PUT_U8(skb, ODP_FLOW_ATTR_TCP_FLAGS, tcp_flags);
+ NLA_PUT_U8(skb, OVS_FLOW_ATTR_TCP_FLAGS, tcp_flags);
- /* If ODP_FLOW_ATTR_ACTIONS doesn't fit, skip dumping the actions if
+ /* If OVS_FLOW_ATTR_ACTIONS doesn't fit, skip dumping the actions if
* this is the first flow to be dumped into 'skb'. This is unusual for
* Netlink but individual action lists can be longer than
* NLMSG_GOODSIZE and thus entirely undumpable if we didn't do this.
* This can only fail for dump operations because the skb is always
* properly sized for single flows.
*/
- err = nla_put(skb, ODP_FLOW_ATTR_ACTIONS, sf_acts->actions_len,
+ err = nla_put(skb, OVS_FLOW_ATTR_ACTIONS, sf_acts->actions_len,
sf_acts->actions);
if (err < 0 && skb_orig_len)
goto error;
- return genlmsg_end(skb, odp_header);
+ return genlmsg_end(skb, ovs_header);
nla_put_failure:
err = -EMSGSIZE;
error:
- genlmsg_cancel(skb, odp_header);
+ genlmsg_cancel(skb, ovs_header);
return err;
}
-static struct sk_buff *odp_flow_cmd_alloc_info(struct sw_flow *flow)
+static struct sk_buff *ovs_flow_cmd_alloc_info(struct sw_flow *flow)
{
const struct sw_flow_actions *sf_acts;
int len;
sf_acts = rcu_dereference_protected(flow->sf_acts,
lockdep_genl_is_held());
- len = nla_total_size(FLOW_BUFSIZE); /* ODP_FLOW_ATTR_KEY */
- len += nla_total_size(sf_acts->actions_len); /* ODP_FLOW_ATTR_ACTIONS */
- len += nla_total_size(sizeof(struct odp_flow_stats)); /* ODP_FLOW_ATTR_STATS */
- len += nla_total_size(1); /* ODP_FLOW_ATTR_TCP_FLAGS */
- len += nla_total_size(8); /* ODP_FLOW_ATTR_USED */
- return genlmsg_new(NLMSG_ALIGN(sizeof(struct odp_header)) + len, GFP_KERNEL);
+ len = nla_total_size(FLOW_BUFSIZE); /* OVS_FLOW_ATTR_KEY */
+ len += nla_total_size(sf_acts->actions_len); /* OVS_FLOW_ATTR_ACTIONS */
+ len += nla_total_size(sizeof(struct ovs_flow_stats)); /* OVS_FLOW_ATTR_STATS */
+ len += nla_total_size(1); /* OVS_FLOW_ATTR_TCP_FLAGS */
+ len += nla_total_size(8); /* OVS_FLOW_ATTR_USED */
+ return genlmsg_new(NLMSG_ALIGN(sizeof(struct ovs_header)) + len, GFP_KERNEL);
}
-static struct sk_buff *odp_flow_cmd_build_info(struct sw_flow *flow, struct datapath *dp,
+static struct sk_buff *ovs_flow_cmd_build_info(struct sw_flow *flow, struct datapath *dp,
u32 pid, u32 seq, u8 cmd)
{
struct sk_buff *skb;
int retval;
- skb = odp_flow_cmd_alloc_info(flow);
+ skb = ovs_flow_cmd_alloc_info(flow);
if (!skb)
return ERR_PTR(-ENOMEM);
- retval = odp_flow_cmd_fill_info(flow, dp, skb, pid, seq, 0, cmd);
+ retval = ovs_flow_cmd_fill_info(flow, dp, skb, pid, seq, 0, cmd);
BUG_ON(retval < 0);
return skb;
}
-static int odp_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
+static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
- struct odp_header *odp_header = info->userhdr;
+ struct ovs_header *ovs_header = info->userhdr;
struct tbl_node *flow_node;
struct sw_flow_key key;
struct sw_flow *flow;
/* Extract key. */
error = -EINVAL;
- if (!a[ODP_FLOW_ATTR_KEY])
+ if (!a[OVS_FLOW_ATTR_KEY])
goto error;
- error = flow_from_nlattrs(&key, &key_len, a[ODP_FLOW_ATTR_KEY]);
+ error = flow_from_nlattrs(&key, &key_len, a[OVS_FLOW_ATTR_KEY]);
if (error)
goto error;
/* Validate actions. */
- if (a[ODP_FLOW_ATTR_ACTIONS]) {
- error = validate_actions(a[ODP_FLOW_ATTR_ACTIONS]);
+ if (a[OVS_FLOW_ATTR_ACTIONS]) {
+ error = validate_actions(a[OVS_FLOW_ATTR_ACTIONS]);
if (error)
goto error;
- } else if (info->genlhdr->cmd == ODP_FLOW_CMD_NEW) {
+ } else if (info->genlhdr->cmd == OVS_FLOW_CMD_NEW) {
error = -EINVAL;
goto error;
}
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
error = -ENODEV;
if (!dp)
goto error;
/* Bail out if we're not allowed to create a new flow. */
error = -ENOENT;
- if (info->genlhdr->cmd == ODP_FLOW_CMD_SET)
+ if (info->genlhdr->cmd == OVS_FLOW_CMD_SET)
goto error;
/* Expand table, if necessary, to make room. */
clear_stats(flow);
/* Obtain actions. */
- acts = flow_actions_alloc(a[ODP_FLOW_ATTR_ACTIONS]);
+ acts = flow_actions_alloc(a[OVS_FLOW_ATTR_ACTIONS]);
error = PTR_ERR(acts);
if (IS_ERR(acts))
goto error_free_flow;
if (error)
goto error_free_flow;
- reply = odp_flow_cmd_build_info(flow, dp, info->snd_pid,
- info->snd_seq, ODP_FLOW_CMD_NEW);
+ reply = ovs_flow_cmd_build_info(flow, dp, info->snd_pid,
+ info->snd_seq, OVS_FLOW_CMD_NEW);
} else {
/* We found a matching flow. */
struct sw_flow_actions *old_acts;
* gets fixed.
*/
error = -EEXIST;
- if (info->genlhdr->cmd == ODP_FLOW_CMD_NEW &&
+ if (info->genlhdr->cmd == OVS_FLOW_CMD_NEW &&
info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_EXCL))
goto error;
flow = flow_cast(flow_node);
old_acts = rcu_dereference_protected(flow->sf_acts,
lockdep_genl_is_held());
- if (a[ODP_FLOW_ATTR_ACTIONS] &&
- (old_acts->actions_len != nla_len(a[ODP_FLOW_ATTR_ACTIONS]) ||
- memcmp(old_acts->actions, nla_data(a[ODP_FLOW_ATTR_ACTIONS]),
+ if (a[OVS_FLOW_ATTR_ACTIONS] &&
+ (old_acts->actions_len != nla_len(a[OVS_FLOW_ATTR_ACTIONS]) ||
+ memcmp(old_acts->actions, nla_data(a[OVS_FLOW_ATTR_ACTIONS]),
old_acts->actions_len))) {
struct sw_flow_actions *new_acts;
- new_acts = flow_actions_alloc(a[ODP_FLOW_ATTR_ACTIONS]);
+ new_acts = flow_actions_alloc(a[OVS_FLOW_ATTR_ACTIONS]);
error = PTR_ERR(new_acts);
if (IS_ERR(new_acts))
goto error;
flow_deferred_free_acts(old_acts);
}
- reply = odp_flow_cmd_build_info(flow, dp, info->snd_pid,
- info->snd_seq, ODP_FLOW_CMD_NEW);
+ reply = ovs_flow_cmd_build_info(flow, dp, info->snd_pid,
+ info->snd_seq, OVS_FLOW_CMD_NEW);
/* Clear stats. */
- if (a[ODP_FLOW_ATTR_CLEAR]) {
+ if (a[OVS_FLOW_ATTR_CLEAR]) {
spin_lock_bh(&flow->lock);
clear_stats(flow);
spin_unlock_bh(&flow->lock);
return error;
}
-static int odp_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
+static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
- struct odp_header *odp_header = info->userhdr;
+ struct ovs_header *ovs_header = info->userhdr;
struct sw_flow_key key;
struct tbl_node *flow_node;
struct sk_buff *reply;
int err;
int key_len;
- if (!a[ODP_FLOW_ATTR_KEY])
+ if (!a[OVS_FLOW_ATTR_KEY])
return -EINVAL;
- err = flow_from_nlattrs(&key, &key_len, a[ODP_FLOW_ATTR_KEY]);
+ err = flow_from_nlattrs(&key, &key_len, a[OVS_FLOW_ATTR_KEY]);
if (err)
return err;
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
if (!dp)
return -ENODEV;
return -ENOENT;
flow = flow_cast(flow_node);
- reply = odp_flow_cmd_build_info(flow, dp, info->snd_pid, info->snd_seq, ODP_FLOW_CMD_NEW);
+ reply = ovs_flow_cmd_build_info(flow, dp, info->snd_pid, info->snd_seq, OVS_FLOW_CMD_NEW);
if (IS_ERR(reply))
return PTR_ERR(reply);
return genlmsg_reply(reply, info);
}
-static int odp_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
+static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
- struct odp_header *odp_header = info->userhdr;
+ struct ovs_header *ovs_header = info->userhdr;
struct sw_flow_key key;
struct tbl_node *flow_node;
struct sk_buff *reply;
int err;
int key_len;
- if (!a[ODP_FLOW_ATTR_KEY])
- return flush_flows(odp_header->dp_ifindex);
- err = flow_from_nlattrs(&key, &key_len, a[ODP_FLOW_ATTR_KEY]);
+ if (!a[OVS_FLOW_ATTR_KEY])
+ return flush_flows(ovs_header->dp_ifindex);
+ err = flow_from_nlattrs(&key, &key_len, a[OVS_FLOW_ATTR_KEY]);
if (err)
return err;
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
if (!dp)
return -ENODEV;
return -ENOENT;
flow = flow_cast(flow_node);
- reply = odp_flow_cmd_alloc_info(flow);
+ reply = ovs_flow_cmd_alloc_info(flow);
if (!reply)
return -ENOMEM;
return err;
}
- err = odp_flow_cmd_fill_info(flow, dp, reply, info->snd_pid,
- info->snd_seq, 0, ODP_FLOW_CMD_DEL);
+ err = ovs_flow_cmd_fill_info(flow, dp, reply, info->snd_pid,
+ info->snd_seq, 0, OVS_FLOW_CMD_DEL);
BUG_ON(err < 0);
flow_deferred_free(flow);
return 0;
}
-static int odp_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
+static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
- struct odp_header *odp_header = genlmsg_data(nlmsg_data(cb->nlh));
+ struct ovs_header *ovs_header = genlmsg_data(nlmsg_data(cb->nlh));
struct datapath *dp;
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
if (!dp)
return -ENODEV;
break;
flow = flow_cast(flow_node);
- if (odp_flow_cmd_fill_info(flow, dp, skb, NETLINK_CB(cb->skb).pid,
+ if (ovs_flow_cmd_fill_info(flow, dp, skb, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
- ODP_FLOW_CMD_NEW) < 0)
+ OVS_FLOW_CMD_NEW) < 0)
break;
cb->args[0] = bucket;
}
static struct genl_ops dp_flow_genl_ops[] = {
- { .cmd = ODP_FLOW_CMD_NEW,
+ { .cmd = OVS_FLOW_CMD_NEW,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = flow_policy,
- .doit = odp_flow_cmd_new_or_set
+ .doit = ovs_flow_cmd_new_or_set
},
- { .cmd = ODP_FLOW_CMD_DEL,
+ { .cmd = OVS_FLOW_CMD_DEL,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = flow_policy,
- .doit = odp_flow_cmd_del
+ .doit = ovs_flow_cmd_del
},
- { .cmd = ODP_FLOW_CMD_GET,
+ { .cmd = OVS_FLOW_CMD_GET,
.flags = 0, /* OK for unprivileged users. */
.policy = flow_policy,
- .doit = odp_flow_cmd_get,
- .dumpit = odp_flow_cmd_dump
+ .doit = ovs_flow_cmd_get,
+ .dumpit = ovs_flow_cmd_dump
},
- { .cmd = ODP_FLOW_CMD_SET,
+ { .cmd = OVS_FLOW_CMD_SET,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = flow_policy,
- .doit = odp_flow_cmd_new_or_set,
+ .doit = ovs_flow_cmd_new_or_set,
},
};
-static const struct nla_policy datapath_policy[ODP_DP_ATTR_MAX + 1] = {
+static const struct nla_policy datapath_policy[OVS_DP_ATTR_MAX + 1] = {
#ifdef HAVE_NLA_NUL_STRING
- [ODP_DP_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
+ [OVS_DP_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
#endif
- [ODP_DP_ATTR_IPV4_FRAGS] = { .type = NLA_U32 },
- [ODP_DP_ATTR_SAMPLING] = { .type = NLA_U32 },
+ [OVS_DP_ATTR_IPV4_FRAGS] = { .type = NLA_U32 },
+ [OVS_DP_ATTR_SAMPLING] = { .type = NLA_U32 },
};
static struct genl_family dp_datapath_genl_family = {
.id = GENL_ID_GENERATE,
- .hdrsize = sizeof(struct odp_header),
- .name = ODP_DATAPATH_FAMILY,
+ .hdrsize = sizeof(struct ovs_header),
+ .name = OVS_DATAPATH_FAMILY,
.version = 1,
- .maxattr = ODP_DP_ATTR_MAX
+ .maxattr = OVS_DP_ATTR_MAX
};
static struct genl_multicast_group dp_datapath_multicast_group = {
- .name = ODP_DATAPATH_MCGROUP
+ .name = OVS_DATAPATH_MCGROUP
};
-static int odp_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
+static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
u32 pid, u32 seq, u32 flags, u8 cmd)
{
- struct odp_header *odp_header;
+ struct ovs_header *ovs_header;
struct nlattr *nla;
int err;
- odp_header = genlmsg_put(skb, pid, seq, &dp_datapath_genl_family,
+ ovs_header = genlmsg_put(skb, pid, seq, &dp_datapath_genl_family,
flags, cmd);
- if (!odp_header)
+ if (!ovs_header)
goto error;
- odp_header->dp_ifindex = dp->dp_ifindex;
+ ovs_header->dp_ifindex = dp->dp_ifindex;
rcu_read_lock();
- err = nla_put_string(skb, ODP_DP_ATTR_NAME, dp_name(dp));
+ err = nla_put_string(skb, OVS_DP_ATTR_NAME, dp_name(dp));
rcu_read_unlock();
if (err)
goto nla_put_failure;
- nla = nla_reserve(skb, ODP_DP_ATTR_STATS, sizeof(struct odp_stats));
+ nla = nla_reserve(skb, OVS_DP_ATTR_STATS, sizeof(struct ovs_dp_stats));
if (!nla)
goto nla_put_failure;
get_dp_stats(dp, nla_data(nla));
- NLA_PUT_U32(skb, ODP_DP_ATTR_IPV4_FRAGS,
- dp->drop_frags ? ODP_DP_FRAG_DROP : ODP_DP_FRAG_ZERO);
+ NLA_PUT_U32(skb, OVS_DP_ATTR_IPV4_FRAGS,
+ dp->drop_frags ? OVS_DP_FRAG_DROP : OVS_DP_FRAG_ZERO);
if (dp->sflow_probability)
- NLA_PUT_U32(skb, ODP_DP_ATTR_SAMPLING, dp->sflow_probability);
+ NLA_PUT_U32(skb, OVS_DP_ATTR_SAMPLING, dp->sflow_probability);
- nla = nla_nest_start(skb, ODP_DP_ATTR_MCGROUPS);
+ nla = nla_nest_start(skb, OVS_DP_ATTR_MCGROUPS);
if (!nla)
goto nla_put_failure;
- NLA_PUT_U32(skb, ODP_PACKET_CMD_MISS, packet_mc_group(dp, ODP_PACKET_CMD_MISS));
- NLA_PUT_U32(skb, ODP_PACKET_CMD_ACTION, packet_mc_group(dp, ODP_PACKET_CMD_ACTION));
- NLA_PUT_U32(skb, ODP_PACKET_CMD_SAMPLE, packet_mc_group(dp, ODP_PACKET_CMD_SAMPLE));
+ NLA_PUT_U32(skb, OVS_PACKET_CMD_MISS, packet_mc_group(dp, OVS_PACKET_CMD_MISS));
+ NLA_PUT_U32(skb, OVS_PACKET_CMD_ACTION, packet_mc_group(dp, OVS_PACKET_CMD_ACTION));
+ NLA_PUT_U32(skb, OVS_PACKET_CMD_SAMPLE, packet_mc_group(dp, OVS_PACKET_CMD_SAMPLE));
nla_nest_end(skb, nla);
- return genlmsg_end(skb, odp_header);
+ return genlmsg_end(skb, ovs_header);
nla_put_failure:
- genlmsg_cancel(skb, odp_header);
+ genlmsg_cancel(skb, ovs_header);
error:
return -EMSGSIZE;
}
-static struct sk_buff *odp_dp_cmd_build_info(struct datapath *dp, u32 pid,
+static struct sk_buff *ovs_dp_cmd_build_info(struct datapath *dp, u32 pid,
u32 seq, u8 cmd)
{
struct sk_buff *skb;
if (!skb)
return ERR_PTR(-ENOMEM);
- retval = odp_dp_cmd_fill_info(dp, skb, pid, seq, 0, cmd);
+ retval = ovs_dp_cmd_fill_info(dp, skb, pid, seq, 0, cmd);
if (retval < 0) {
kfree_skb(skb);
return ERR_PTR(retval);
return skb;
}
-static int odp_dp_cmd_validate(struct nlattr *a[ODP_DP_ATTR_MAX + 1])
+static int ovs_dp_cmd_validate(struct nlattr *a[OVS_DP_ATTR_MAX + 1])
{
- if (a[ODP_DP_ATTR_IPV4_FRAGS]) {
- u32 frags = nla_get_u32(a[ODP_DP_ATTR_IPV4_FRAGS]);
+ if (a[OVS_DP_ATTR_IPV4_FRAGS]) {
+ u32 frags = nla_get_u32(a[OVS_DP_ATTR_IPV4_FRAGS]);
- if (frags != ODP_DP_FRAG_ZERO && frags != ODP_DP_FRAG_DROP)
+ if (frags != OVS_DP_FRAG_ZERO && frags != OVS_DP_FRAG_DROP)
return -EINVAL;
}
- return CHECK_NUL_STRING(a[ODP_DP_ATTR_NAME], IFNAMSIZ - 1);
+ return CHECK_NUL_STRING(a[OVS_DP_ATTR_NAME], IFNAMSIZ - 1);
}
/* Called with genl_mutex and optionally with RTNL lock also. */
-static struct datapath *lookup_datapath(struct odp_header *odp_header, struct nlattr *a[ODP_DP_ATTR_MAX + 1])
+static struct datapath *lookup_datapath(struct ovs_header *ovs_header, struct nlattr *a[OVS_DP_ATTR_MAX + 1])
{
struct datapath *dp;
- if (!a[ODP_DP_ATTR_NAME])
- dp = get_dp(odp_header->dp_ifindex);
+ if (!a[OVS_DP_ATTR_NAME])
+ dp = get_dp(ovs_header->dp_ifindex);
else {
struct vport *vport;
rcu_read_lock();
- vport = vport_locate(nla_data(a[ODP_DP_ATTR_NAME]));
- dp = vport && vport->port_no == ODPP_LOCAL ? vport->dp : NULL;
+ vport = vport_locate(nla_data(a[OVS_DP_ATTR_NAME]));
+ dp = vport && vport->port_no == OVSP_LOCAL ? vport->dp : NULL;
rcu_read_unlock();
}
return dp ? dp : ERR_PTR(-ENODEV);
}
/* Called with genl_mutex. */
-static void change_datapath(struct datapath *dp, struct nlattr *a[ODP_DP_ATTR_MAX + 1])
+static void change_datapath(struct datapath *dp, struct nlattr *a[OVS_DP_ATTR_MAX + 1])
{
- if (a[ODP_DP_ATTR_IPV4_FRAGS])
- dp->drop_frags = nla_get_u32(a[ODP_DP_ATTR_IPV4_FRAGS]) == ODP_DP_FRAG_DROP;
- if (a[ODP_DP_ATTR_SAMPLING])
- dp->sflow_probability = nla_get_u32(a[ODP_DP_ATTR_SAMPLING]);
+ if (a[OVS_DP_ATTR_IPV4_FRAGS])
+ dp->drop_frags = nla_get_u32(a[OVS_DP_ATTR_IPV4_FRAGS]) == OVS_DP_FRAG_DROP;
+ if (a[OVS_DP_ATTR_SAMPLING])
+ dp->sflow_probability = nla_get_u32(a[OVS_DP_ATTR_SAMPLING]);
}
-static int odp_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
+static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
struct vport_parms parms;
int err;
err = -EINVAL;
- if (!a[ODP_DP_ATTR_NAME])
+ if (!a[OVS_DP_ATTR_NAME])
goto err;
- err = odp_dp_cmd_validate(a);
+ err = ovs_dp_cmd_validate(a);
if (err)
goto err;
goto err_free_dp;
/* Set up our datapath device. */
- parms.name = nla_data(a[ODP_DP_ATTR_NAME]);
- parms.type = ODP_VPORT_TYPE_INTERNAL;
+ parms.name = nla_data(a[OVS_DP_ATTR_NAME]);
+ parms.type = OVS_VPORT_TYPE_INTERNAL;
parms.options = NULL;
parms.dp = dp;
- parms.port_no = ODPP_LOCAL;
+ parms.port_no = OVSP_LOCAL;
vport = new_vport(&parms);
if (IS_ERR(vport)) {
err = PTR_ERR(vport);
change_datapath(dp, a);
- reply = odp_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, ODP_DP_CMD_NEW);
+ reply = ovs_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, OVS_DP_CMD_NEW);
err = PTR_ERR(reply);
if (IS_ERR(reply))
goto err_destroy_local_port;
return 0;
err_destroy_local_port:
- dp_detach_port(get_vport_protected(dp, ODPP_LOCAL));
+ dp_detach_port(get_vport_protected(dp, OVSP_LOCAL));
err_destroy_table:
tbl_destroy(get_table_protected(dp), NULL);
err_free_dp:
return err;
}
-static int odp_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
+static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
{
struct vport *vport, *next_vport;
struct sk_buff *reply;
struct datapath *dp;
int err;
- err = odp_dp_cmd_validate(info->attrs);
+ err = ovs_dp_cmd_validate(info->attrs);
if (err)
goto exit;
if (IS_ERR(dp))
goto exit_unlock;
- reply = odp_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, ODP_DP_CMD_DEL);
+ reply = ovs_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, OVS_DP_CMD_DEL);
err = PTR_ERR(reply);
if (IS_ERR(reply))
goto exit_unlock;
list_for_each_entry_safe (vport, next_vport, &dp->port_list, node)
- if (vport->port_no != ODPP_LOCAL)
+ if (vport->port_no != OVSP_LOCAL)
dp_detach_port(vport);
dp_sysfs_del_dp(dp);
list_del(&dp->list_node);
- dp_detach_port(get_vport_protected(dp, ODPP_LOCAL));
+ dp_detach_port(get_vport_protected(dp, OVSP_LOCAL));
/* rtnl_unlock() will wait until all the references to devices that
* are pending unregistration have been dropped. We do it here to
return err;
}
-static int odp_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
+static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
{
struct sk_buff *reply;
struct datapath *dp;
int err;
- err = odp_dp_cmd_validate(info->attrs);
+ err = ovs_dp_cmd_validate(info->attrs);
if (err)
return err;
change_datapath(dp, info->attrs);
- reply = odp_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, ODP_DP_CMD_NEW);
+ reply = ovs_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, OVS_DP_CMD_NEW);
if (IS_ERR(reply)) {
err = PTR_ERR(reply);
netlink_set_err(INIT_NET_GENL_SOCK, 0,
return 0;
}
-static int odp_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
+static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
{
struct sk_buff *reply;
struct datapath *dp;
int err;
- err = odp_dp_cmd_validate(info->attrs);
+ err = ovs_dp_cmd_validate(info->attrs);
if (err)
return err;
if (IS_ERR(dp))
return PTR_ERR(dp);
- reply = odp_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, ODP_DP_CMD_NEW);
+ reply = ovs_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, OVS_DP_CMD_NEW);
if (IS_ERR(reply))
return PTR_ERR(reply);
return genlmsg_reply(reply, info);
}
-static int odp_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
+static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
struct datapath *dp;
int skip = cb->args[0];
list_for_each_entry (dp, &dps, list_node) {
if (i < skip)
continue;
- if (odp_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).pid,
+ if (ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
- ODP_DP_CMD_NEW) < 0)
+ OVS_DP_CMD_NEW) < 0)
break;
i++;
}
}
static struct genl_ops dp_datapath_genl_ops[] = {
- { .cmd = ODP_DP_CMD_NEW,
+ { .cmd = OVS_DP_CMD_NEW,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = datapath_policy,
- .doit = odp_dp_cmd_new
+ .doit = ovs_dp_cmd_new
},
- { .cmd = ODP_DP_CMD_DEL,
+ { .cmd = OVS_DP_CMD_DEL,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = datapath_policy,
- .doit = odp_dp_cmd_del
+ .doit = ovs_dp_cmd_del
},
- { .cmd = ODP_DP_CMD_GET,
+ { .cmd = OVS_DP_CMD_GET,
.flags = 0, /* OK for unprivileged users. */
.policy = datapath_policy,
- .doit = odp_dp_cmd_get,
- .dumpit = odp_dp_cmd_dump
+ .doit = ovs_dp_cmd_get,
+ .dumpit = ovs_dp_cmd_dump
},
- { .cmd = ODP_DP_CMD_SET,
+ { .cmd = OVS_DP_CMD_SET,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = datapath_policy,
- .doit = odp_dp_cmd_set,
+ .doit = ovs_dp_cmd_set,
},
};
-static const struct nla_policy vport_policy[ODP_VPORT_ATTR_MAX + 1] = {
+static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
#ifdef HAVE_NLA_NUL_STRING
- [ODP_VPORT_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
- [ODP_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
- [ODP_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
- [ODP_VPORT_ATTR_STATS] = { .len = sizeof(struct rtnl_link_stats64) },
- [ODP_VPORT_ATTR_ADDRESS] = { .len = ETH_ALEN },
+ [OVS_VPORT_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
+ [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
+ [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
+ [OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct rtnl_link_stats64) },
+ [OVS_VPORT_ATTR_ADDRESS] = { .len = ETH_ALEN },
#else
- [ODP_VPORT_ATTR_STATS] = { .minlen = sizeof(struct rtnl_link_stats64) },
- [ODP_VPORT_ATTR_ADDRESS] = { .minlen = ETH_ALEN },
+ [OVS_VPORT_ATTR_STATS] = { .minlen = sizeof(struct rtnl_link_stats64) },
+ [OVS_VPORT_ATTR_ADDRESS] = { .minlen = ETH_ALEN },
#endif
- [ODP_VPORT_ATTR_MTU] = { .type = NLA_U32 },
- [ODP_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
+ [OVS_VPORT_ATTR_MTU] = { .type = NLA_U32 },
+ [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
};
static struct genl_family dp_vport_genl_family = {
.id = GENL_ID_GENERATE,
- .hdrsize = sizeof(struct odp_header),
- .name = ODP_VPORT_FAMILY,
+ .hdrsize = sizeof(struct ovs_header),
+ .name = OVS_VPORT_FAMILY,
.version = 1,
- .maxattr = ODP_VPORT_ATTR_MAX
+ .maxattr = OVS_VPORT_ATTR_MAX
};
static struct genl_multicast_group dp_vport_multicast_group = {
- .name = ODP_VPORT_MCGROUP
+ .name = OVS_VPORT_MCGROUP
};
/* Called with RTNL lock or RCU read lock. */
-static int odp_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,
+static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,
u32 pid, u32 seq, u32 flags, u8 cmd)
{
- struct odp_header *odp_header;
+ struct ovs_header *ovs_header;
struct nlattr *nla;
int ifindex, iflink;
int mtu;
int err;
- odp_header = genlmsg_put(skb, pid, seq, &dp_vport_genl_family,
+ ovs_header = genlmsg_put(skb, pid, seq, &dp_vport_genl_family,
flags, cmd);
- if (!odp_header)
+ if (!ovs_header)
return -EMSGSIZE;
- odp_header->dp_ifindex = vport->dp->dp_ifindex;
+ ovs_header->dp_ifindex = vport->dp->dp_ifindex;
- NLA_PUT_U32(skb, ODP_VPORT_ATTR_PORT_NO, vport->port_no);
- NLA_PUT_U32(skb, ODP_VPORT_ATTR_TYPE, vport_get_type(vport));
- NLA_PUT_STRING(skb, ODP_VPORT_ATTR_NAME, vport_get_name(vport));
+ NLA_PUT_U32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no);
+ NLA_PUT_U32(skb, OVS_VPORT_ATTR_TYPE, vport_get_type(vport));
+ NLA_PUT_STRING(skb, OVS_VPORT_ATTR_NAME, vport_get_name(vport));
- nla = nla_reserve(skb, ODP_VPORT_ATTR_STATS, sizeof(struct rtnl_link_stats64));
+ nla = nla_reserve(skb, OVS_VPORT_ATTR_STATS, sizeof(struct rtnl_link_stats64));
if (!nla)
goto nla_put_failure;
if (vport_get_stats(vport, nla_data(nla)))
__skb_trim(skb, skb->len - nla->nla_len);
- NLA_PUT(skb, ODP_VPORT_ATTR_ADDRESS, ETH_ALEN, vport_get_addr(vport));
+ NLA_PUT(skb, OVS_VPORT_ATTR_ADDRESS, ETH_ALEN, vport_get_addr(vport));
mtu = vport_get_mtu(vport);
if (mtu)
- NLA_PUT_U32(skb, ODP_VPORT_ATTR_MTU, mtu);
+ NLA_PUT_U32(skb, OVS_VPORT_ATTR_MTU, mtu);
err = vport_get_options(vport, skb);
if (err == -EMSGSIZE)
ifindex = vport_get_ifindex(vport);
if (ifindex > 0)
- NLA_PUT_U32(skb, ODP_VPORT_ATTR_IFINDEX, ifindex);
+ NLA_PUT_U32(skb, OVS_VPORT_ATTR_IFINDEX, ifindex);
iflink = vport_get_iflink(vport);
if (iflink > 0)
- NLA_PUT_U32(skb, ODP_VPORT_ATTR_IFLINK, iflink);
+ NLA_PUT_U32(skb, OVS_VPORT_ATTR_IFLINK, iflink);
- return genlmsg_end(skb, odp_header);
+ return genlmsg_end(skb, ovs_header);
nla_put_failure:
err = -EMSGSIZE;
error:
- genlmsg_cancel(skb, odp_header);
+ genlmsg_cancel(skb, ovs_header);
return err;
}
/* Called with RTNL lock or RCU read lock. */
-static struct sk_buff *odp_vport_cmd_build_info(struct vport *vport, u32 pid,
+static struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 pid,
u32 seq, u8 cmd)
{
struct sk_buff *skb;
if (!skb)
return ERR_PTR(-ENOMEM);
- retval = odp_vport_cmd_fill_info(vport, skb, pid, seq, 0, cmd);
+ retval = ovs_vport_cmd_fill_info(vport, skb, pid, seq, 0, cmd);
if (retval < 0) {
kfree_skb(skb);
return ERR_PTR(retval);
return skb;
}
-static int odp_vport_cmd_validate(struct nlattr *a[ODP_VPORT_ATTR_MAX + 1])
+static int ovs_vport_cmd_validate(struct nlattr *a[OVS_VPORT_ATTR_MAX + 1])
{
- return CHECK_NUL_STRING(a[ODP_VPORT_ATTR_NAME], IFNAMSIZ - 1);
+ return CHECK_NUL_STRING(a[OVS_VPORT_ATTR_NAME], IFNAMSIZ - 1);
}
/* Called with RTNL lock or RCU read lock. */
-static struct vport *lookup_vport(struct odp_header *odp_header,
- struct nlattr *a[ODP_VPORT_ATTR_MAX + 1])
+static struct vport *lookup_vport(struct ovs_header *ovs_header,
+ struct nlattr *a[OVS_VPORT_ATTR_MAX + 1])
{
struct datapath *dp;
struct vport *vport;
- if (a[ODP_VPORT_ATTR_NAME]) {
- vport = vport_locate(nla_data(a[ODP_VPORT_ATTR_NAME]));
+ if (a[OVS_VPORT_ATTR_NAME]) {
+ vport = vport_locate(nla_data(a[OVS_VPORT_ATTR_NAME]));
if (!vport)
return ERR_PTR(-ENODEV);
return vport;
- } else if (a[ODP_VPORT_ATTR_PORT_NO]) {
- u32 port_no = nla_get_u32(a[ODP_VPORT_ATTR_PORT_NO]);
+ } else if (a[OVS_VPORT_ATTR_PORT_NO]) {
+ u32 port_no = nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]);
if (port_no >= DP_MAX_PORTS)
return ERR_PTR(-EFBIG);
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
if (!dp)
return ERR_PTR(-ENODEV);
}
/* Called with RTNL lock. */
-static int change_vport(struct vport *vport, struct nlattr *a[ODP_VPORT_ATTR_MAX + 1])
+static int change_vport(struct vport *vport, struct nlattr *a[OVS_VPORT_ATTR_MAX + 1])
{
int err = 0;
- if (a[ODP_VPORT_ATTR_STATS])
- err = vport_set_stats(vport, nla_data(a[ODP_VPORT_ATTR_STATS]));
- if (!err && a[ODP_VPORT_ATTR_ADDRESS])
- err = vport_set_addr(vport, nla_data(a[ODP_VPORT_ATTR_ADDRESS]));
- if (!err && a[ODP_VPORT_ATTR_MTU])
- err = vport_set_mtu(vport, nla_get_u32(a[ODP_VPORT_ATTR_MTU]));
+ if (a[OVS_VPORT_ATTR_STATS])
+ err = vport_set_stats(vport, nla_data(a[OVS_VPORT_ATTR_STATS]));
+ if (!err && a[OVS_VPORT_ATTR_ADDRESS])
+ err = vport_set_addr(vport, nla_data(a[OVS_VPORT_ATTR_ADDRESS]));
+ if (!err && a[OVS_VPORT_ATTR_MTU])
+ err = vport_set_mtu(vport, nla_get_u32(a[OVS_VPORT_ATTR_MTU]));
return err;
}
-static int odp_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
+static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
- struct odp_header *odp_header = info->userhdr;
+ struct ovs_header *ovs_header = info->userhdr;
struct vport_parms parms;
struct sk_buff *reply;
struct vport *vport;
int err;
err = -EINVAL;
- if (!a[ODP_VPORT_ATTR_NAME] || !a[ODP_VPORT_ATTR_TYPE])
+ if (!a[OVS_VPORT_ATTR_NAME] || !a[OVS_VPORT_ATTR_TYPE])
goto exit;
- err = odp_vport_cmd_validate(a);
+ err = ovs_vport_cmd_validate(a);
if (err)
goto exit;
rtnl_lock();
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
err = -ENODEV;
if (!dp)
goto exit_unlock;
- if (a[ODP_VPORT_ATTR_PORT_NO]) {
- port_no = nla_get_u32(a[ODP_VPORT_ATTR_PORT_NO]);
+ if (a[OVS_VPORT_ATTR_PORT_NO]) {
+ port_no = nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]);
err = -EFBIG;
if (port_no >= DP_MAX_PORTS)
}
}
- parms.name = nla_data(a[ODP_VPORT_ATTR_NAME]);
- parms.type = nla_get_u32(a[ODP_VPORT_ATTR_TYPE]);
- parms.options = a[ODP_VPORT_ATTR_OPTIONS];
+ parms.name = nla_data(a[OVS_VPORT_ATTR_NAME]);
+ parms.type = nla_get_u32(a[OVS_VPORT_ATTR_TYPE]);
+ parms.options = a[OVS_VPORT_ATTR_OPTIONS];
parms.dp = dp;
parms.port_no = port_no;
err = change_vport(vport, a);
if (!err) {
- reply = odp_vport_cmd_build_info(vport, info->snd_pid,
- info->snd_seq, ODP_VPORT_CMD_NEW);
+ reply = ovs_vport_cmd_build_info(vport, info->snd_pid,
+ info->snd_seq, OVS_VPORT_CMD_NEW);
if (IS_ERR(reply))
err = PTR_ERR(reply);
}
return err;
}
-static int odp_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
+static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
struct sk_buff *reply;
struct vport *vport;
int err;
- err = odp_vport_cmd_validate(a);
+ err = ovs_vport_cmd_validate(a);
if (err)
goto exit;
goto exit_unlock;
err = 0;
- if (a[ODP_VPORT_ATTR_OPTIONS])
- err = vport_set_options(vport, a[ODP_VPORT_ATTR_OPTIONS]);
+ if (a[OVS_VPORT_ATTR_OPTIONS])
+ err = vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]);
if (!err)
err = change_vport(vport, a);
- reply = odp_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
- ODP_VPORT_CMD_NEW);
+ reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
+ OVS_VPORT_CMD_NEW);
if (IS_ERR(reply)) {
err = PTR_ERR(reply);
netlink_set_err(INIT_NET_GENL_SOCK, 0,
return err;
}
-static int odp_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
+static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
struct sk_buff *reply;
struct vport *vport;
int err;
- err = odp_vport_cmd_validate(a);
+ err = ovs_vport_cmd_validate(a);
if (err)
goto exit;
if (IS_ERR(vport))
goto exit_unlock;
- if (vport->port_no == ODPP_LOCAL) {
+ if (vport->port_no == OVSP_LOCAL) {
err = -EINVAL;
goto exit_unlock;
}
- reply = odp_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
- ODP_VPORT_CMD_DEL);
+ reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
+ OVS_VPORT_CMD_DEL);
err = PTR_ERR(reply);
if (IS_ERR(reply))
goto exit_unlock;
return err;
}
-static int odp_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
+static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr **a = info->attrs;
- struct odp_header *odp_header = info->userhdr;
+ struct ovs_header *ovs_header = info->userhdr;
struct sk_buff *reply;
struct vport *vport;
int err;
- err = odp_vport_cmd_validate(a);
+ err = ovs_vport_cmd_validate(a);
if (err)
goto exit;
rcu_read_lock();
- vport = lookup_vport(odp_header, a);
+ vport = lookup_vport(ovs_header, a);
err = PTR_ERR(vport);
if (IS_ERR(vport))
goto exit_unlock;
- reply = odp_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
- ODP_VPORT_CMD_NEW);
+ reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
+ OVS_VPORT_CMD_NEW);
err = PTR_ERR(reply);
if (IS_ERR(reply))
goto exit_unlock;
return err;
}
-static int odp_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
+static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
- struct odp_header *odp_header = genlmsg_data(nlmsg_data(cb->nlh));
+ struct ovs_header *ovs_header = genlmsg_data(nlmsg_data(cb->nlh));
struct datapath *dp;
u32 port_no;
int retval;
- dp = get_dp(odp_header->dp_ifindex);
+ dp = get_dp(ovs_header->dp_ifindex);
if (!dp)
return -ENODEV;
if (!vport)
continue;
- if (odp_vport_cmd_fill_info(vport, skb, NETLINK_CB(cb->skb).pid,
+ if (ovs_vport_cmd_fill_info(vport, skb, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
- ODP_VPORT_CMD_NEW) < 0)
+ OVS_VPORT_CMD_NEW) < 0)
break;
}
rcu_read_unlock();
}
static struct genl_ops dp_vport_genl_ops[] = {
- { .cmd = ODP_VPORT_CMD_NEW,
+ { .cmd = OVS_VPORT_CMD_NEW,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = vport_policy,
- .doit = odp_vport_cmd_new
+ .doit = ovs_vport_cmd_new
},
- { .cmd = ODP_VPORT_CMD_DEL,
+ { .cmd = OVS_VPORT_CMD_DEL,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = vport_policy,
- .doit = odp_vport_cmd_del
+ .doit = ovs_vport_cmd_del
},
- { .cmd = ODP_VPORT_CMD_GET,
+ { .cmd = OVS_VPORT_CMD_GET,
.flags = 0, /* OK for unprivileged users. */
.policy = vport_policy,
- .doit = odp_vport_cmd_get,
- .dumpit = odp_vport_cmd_dump
+ .doit = ovs_vport_cmd_get,
+ .dumpit = ovs_vport_cmd_dump
},
- { .cmd = ODP_VPORT_CMD_SET,
+ { .cmd = OVS_VPORT_CMD_SET,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = vport_policy,
- .doit = odp_vport_cmd_set,
+ .doit = ovs_vport_cmd_set,
},
};
* @drop_frags: Drop all IP fragments if nonzero.
* @n_flows: Number of flows currently in flow table.
* @table: Current flow table. Protected by genl_lock and RCU.
- * @ports: Map from port number to &struct vport. %ODPP_LOCAL port
+ * @ports: Map from port number to &struct vport. %OVSP_LOCAL port
* always exists, other ports may be %NULL. Protected by RTNL and RCU.
* @port_list: List of all ports in @ports in arbitrary order. RTNL required
* to iterate or modify.
* @stats_percpu: Per-CPU datapath statistics.
* @sflow_probability: Number of packets out of UINT_MAX to sample to the
- * %ODP_PACKET_CMD_SAMPLE multicast group, e.g. (@sflow_probability/UINT_MAX)
+ * %OVS_PACKET_CMD_SAMPLE multicast group, e.g. (@sflow_probability/UINT_MAX)
* is the probability of sampling a given packet.
*
* Context: See the comment on locking at the top of datapath.c for additional
/**
* struct dp_upcall - metadata to include with a packet to send to userspace
- * @cmd: One of %ODP_PACKET_CMD_*.
- * @key: Becomes %ODP_PACKET_ATTR_KEY. Must be nonnull.
- * @userdata: Becomes %ODP_PACKET_ATTR_USERDATA if nonzero.
- * @sample_pool: Becomes %ODP_PACKET_ATTR_SAMPLE_POOL if nonzero.
- * @actions: Becomes %ODP_PACKET_ATTR_ACTIONS if nonnull.
+ * @cmd: One of %OVS_PACKET_CMD_*.
+ * @key: Becomes %OVS_PACKET_ATTR_KEY. Must be nonnull.
+ * @userdata: Becomes %OVS_PACKET_ATTR_USERDATA if nonzero.
+ * @sample_pool: Becomes %OVS_PACKET_ATTR_SAMPLE_POOL if nonzero.
+ * @actions: Becomes %OVS_PACKET_ATTR_ACTIONS if nonnull.
* @actions_len: Number of bytes in @actions.
*/
struct dp_upcall_info {
break;
case NETDEV_CHANGENAME:
- if (vport->port_no != ODPP_LOCAL) {
+ if (vport->port_no != OVSP_LOCAL) {
dp_sysfs_del_if(vport);
dp_sysfs_add_if(vport);
}
int dp_sysfs_add_dp(struct datapath *dp)
{
struct kobject *kobj =
- vport_get_kobj(rtnl_dereference(dp->ports[ODPP_LOCAL]));
+ vport_get_kobj(rtnl_dereference(dp->ports[OVSP_LOCAL]));
int err;
/* Create /sys/class/net/<devname>/bridge directory. */
int dp_sysfs_del_dp(struct datapath *dp)
{
struct kobject *kobj =
- vport_get_kobj(rtnl_dereference(dp->ports[ODPP_LOCAL]));
+ vport_get_kobj(rtnl_dereference(dp->ports[OVSP_LOCAL]));
kobject_del(&dp->ifobj);
sysfs_remove_group(kobj, &bridge_group);
/* Create symlink from /sys/class/net/<devname>/brport/bridge to
* /sys/class/net/<bridgename>. */
err = sysfs_create_link(&p->kobj,
- vport_get_kobj(rtnl_dereference(dp->ports[ODPP_LOCAL])),
+ vport_get_kobj(rtnl_dereference(dp->ports[OVSP_LOCAL])),
SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
if (err)
goto err_del;
return !memcmp(key1, key2, len);
}
-/* The size of the argument for each %ODP_KEY_ATTR_* Netlink attribute. */
-static const u32 key_lens[ODP_KEY_ATTR_MAX + 1] = {
- [ODP_KEY_ATTR_TUN_ID] = 8,
- [ODP_KEY_ATTR_IN_PORT] = 4,
- [ODP_KEY_ATTR_ETHERNET] = sizeof(struct odp_key_ethernet),
- [ODP_KEY_ATTR_8021Q] = sizeof(struct odp_key_8021q),
- [ODP_KEY_ATTR_ETHERTYPE] = 2,
- [ODP_KEY_ATTR_IPV4] = sizeof(struct odp_key_ipv4),
- [ODP_KEY_ATTR_IPV6] = sizeof(struct odp_key_ipv6),
- [ODP_KEY_ATTR_TCP] = sizeof(struct odp_key_tcp),
- [ODP_KEY_ATTR_UDP] = sizeof(struct odp_key_udp),
- [ODP_KEY_ATTR_ICMP] = sizeof(struct odp_key_icmp),
- [ODP_KEY_ATTR_ICMPV6] = sizeof(struct odp_key_icmpv6),
- [ODP_KEY_ATTR_ARP] = sizeof(struct odp_key_arp),
- [ODP_KEY_ATTR_ND] = sizeof(struct odp_key_nd),
+/* The size of the argument for each %OVS_KEY_ATTR_* Netlink attribute. */
+static const u32 key_lens[OVS_KEY_ATTR_MAX + 1] = {
+ [OVS_KEY_ATTR_TUN_ID] = 8,
+ [OVS_KEY_ATTR_IN_PORT] = 4,
+ [OVS_KEY_ATTR_ETHERNET] = sizeof(struct ovs_key_ethernet),
+ [OVS_KEY_ATTR_8021Q] = sizeof(struct ovs_key_8021q),
+ [OVS_KEY_ATTR_ETHERTYPE] = 2,
+ [OVS_KEY_ATTR_IPV4] = sizeof(struct ovs_key_ipv4),
+ [OVS_KEY_ATTR_IPV6] = sizeof(struct ovs_key_ipv6),
+ [OVS_KEY_ATTR_TCP] = sizeof(struct ovs_key_tcp),
+ [OVS_KEY_ATTR_UDP] = sizeof(struct ovs_key_udp),
+ [OVS_KEY_ATTR_ICMP] = sizeof(struct ovs_key_icmp),
+ [OVS_KEY_ATTR_ICMPV6] = sizeof(struct ovs_key_icmpv6),
+ [OVS_KEY_ATTR_ARP] = sizeof(struct ovs_key_arp),
+ [OVS_KEY_ATTR_ND] = sizeof(struct ovs_key_nd),
};
/**
* flow_from_nlattrs - parses Netlink attributes into a flow key.
* @swkey: receives the extracted flow key.
* @key_lenp: number of bytes used in @swkey.
- * @attr: Netlink attribute holding nested %ODP_KEY_ATTR_* Netlink attribute
+ * @attr: Netlink attribute holding nested %OVS_KEY_ATTR_* Netlink attribute
* sequence.
*
* This state machine accepts the following forms, with [] for optional
swkey->eth.type = htons(ETH_P_802_2);
key_len = SW_FLOW_KEY_OFFSET(eth);
- prev_type = ODP_KEY_ATTR_UNSPEC;
+ prev_type = OVS_KEY_ATTR_UNSPEC;
nla_for_each_nested(nla, attr, rem) {
- const struct odp_key_ethernet *eth_key;
- const struct odp_key_8021q *q_key;
- const struct odp_key_ipv4 *ipv4_key;
- const struct odp_key_ipv6 *ipv6_key;
- const struct odp_key_tcp *tcp_key;
- const struct odp_key_udp *udp_key;
- const struct odp_key_icmp *icmp_key;
- const struct odp_key_icmpv6 *icmpv6_key;
- const struct odp_key_arp *arp_key;
- const struct odp_key_nd *nd_key;
+ const struct ovs_key_ethernet *eth_key;
+ const struct ovs_key_8021q *q_key;
+ const struct ovs_key_ipv4 *ipv4_key;
+ const struct ovs_key_ipv6 *ipv6_key;
+ const struct ovs_key_tcp *tcp_key;
+ const struct ovs_key_udp *udp_key;
+ const struct ovs_key_icmp *icmp_key;
+ const struct ovs_key_icmpv6 *icmpv6_key;
+ const struct ovs_key_arp *arp_key;
+ const struct ovs_key_nd *nd_key;
int type = nla_type(nla);
- if (type > ODP_KEY_ATTR_MAX || nla_len(nla) != key_lens[type])
+ if (type > OVS_KEY_ATTR_MAX || nla_len(nla) != key_lens[type])
goto invalid;
#define TRANSITION(PREV_TYPE, TYPE) (((PREV_TYPE) << 16) | (TYPE))
switch (TRANSITION(prev_type, type)) {
- case TRANSITION(ODP_KEY_ATTR_UNSPEC, ODP_KEY_ATTR_TUN_ID):
+ case TRANSITION(OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_TUN_ID):
swkey->eth.tun_id = nla_get_be64(nla);
break;
- case TRANSITION(ODP_KEY_ATTR_UNSPEC, ODP_KEY_ATTR_IN_PORT):
- case TRANSITION(ODP_KEY_ATTR_TUN_ID, ODP_KEY_ATTR_IN_PORT):
+ case TRANSITION(OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_IN_PORT):
+ case TRANSITION(OVS_KEY_ATTR_TUN_ID, OVS_KEY_ATTR_IN_PORT):
if (nla_get_u32(nla) >= DP_MAX_PORTS)
goto invalid;
swkey->eth.in_port = nla_get_u32(nla);
break;
- case TRANSITION(ODP_KEY_ATTR_IN_PORT, ODP_KEY_ATTR_ETHERNET):
+ case TRANSITION(OVS_KEY_ATTR_IN_PORT, OVS_KEY_ATTR_ETHERNET):
eth_key = nla_data(nla);
memcpy(swkey->eth.src, eth_key->eth_src, ETH_ALEN);
memcpy(swkey->eth.dst, eth_key->eth_dst, ETH_ALEN);
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERNET, ODP_KEY_ATTR_8021Q):
+ case TRANSITION(OVS_KEY_ATTR_ETHERNET, OVS_KEY_ATTR_8021Q):
q_key = nla_data(nla);
/* Only standard 0x8100 VLANs currently supported. */
if (q_key->q_tpid != htons(ETH_P_8021Q))
swkey->eth.tci = q_key->q_tci | htons(VLAN_TAG_PRESENT);
break;
- case TRANSITION(ODP_KEY_ATTR_8021Q, ODP_KEY_ATTR_ETHERTYPE):
- case TRANSITION(ODP_KEY_ATTR_ETHERNET, ODP_KEY_ATTR_ETHERTYPE):
+ case TRANSITION(OVS_KEY_ATTR_8021Q, OVS_KEY_ATTR_ETHERTYPE):
+ case TRANSITION(OVS_KEY_ATTR_ETHERNET, OVS_KEY_ATTR_ETHERTYPE):
swkey->eth.type = nla_get_be16(nla);
if (ntohs(swkey->eth.type) < 1536)
goto invalid;
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERTYPE, ODP_KEY_ATTR_IPV4):
+ case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_IPV4):
key_len = SW_FLOW_KEY_OFFSET(ipv4.addr);
if (swkey->eth.type != htons(ETH_P_IP))
goto invalid;
goto invalid;
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERTYPE, ODP_KEY_ATTR_IPV6):
+ case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_IPV6):
key_len = SW_FLOW_KEY_OFFSET(ipv6.addr);
if (swkey->eth.type != htons(ETH_P_IPV6))
goto invalid;
goto invalid;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV4, ODP_KEY_ATTR_TCP):
+ case TRANSITION(OVS_KEY_ATTR_IPV4, OVS_KEY_ATTR_TCP):
key_len = SW_FLOW_KEY_OFFSET(ipv4.tp);
if (swkey->ip.proto != IPPROTO_TCP)
goto invalid;
swkey->ipv4.tp.dst = tcp_key->tcp_dst;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV6, ODP_KEY_ATTR_TCP):
+ case TRANSITION(OVS_KEY_ATTR_IPV6, OVS_KEY_ATTR_TCP):
key_len = SW_FLOW_KEY_OFFSET(ipv6.tp);
if (swkey->ip.proto != IPPROTO_TCP)
goto invalid;
swkey->ipv6.tp.dst = tcp_key->tcp_dst;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV4, ODP_KEY_ATTR_UDP):
+ case TRANSITION(OVS_KEY_ATTR_IPV4, OVS_KEY_ATTR_UDP):
key_len = SW_FLOW_KEY_OFFSET(ipv4.tp);
if (swkey->ip.proto != IPPROTO_UDP)
goto invalid;
swkey->ipv4.tp.dst = udp_key->udp_dst;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV6, ODP_KEY_ATTR_UDP):
+ case TRANSITION(OVS_KEY_ATTR_IPV6, OVS_KEY_ATTR_UDP):
key_len = SW_FLOW_KEY_OFFSET(ipv6.tp);
if (swkey->ip.proto != IPPROTO_UDP)
goto invalid;
swkey->ipv6.tp.dst = udp_key->udp_dst;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV4, ODP_KEY_ATTR_ICMP):
+ case TRANSITION(OVS_KEY_ATTR_IPV4, OVS_KEY_ATTR_ICMP):
key_len = SW_FLOW_KEY_OFFSET(ipv4.tp);
if (swkey->ip.proto != IPPROTO_ICMP)
goto invalid;
swkey->ipv4.tp.dst = htons(icmp_key->icmp_code);
break;
- case TRANSITION(ODP_KEY_ATTR_IPV6, ODP_KEY_ATTR_ICMPV6):
+ case TRANSITION(OVS_KEY_ATTR_IPV6, OVS_KEY_ATTR_ICMPV6):
key_len = SW_FLOW_KEY_OFFSET(ipv6.tp);
if (swkey->ip.proto != IPPROTO_ICMPV6)
goto invalid;
swkey->ipv6.tp.dst = htons(icmpv6_key->icmpv6_code);
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERTYPE, ODP_KEY_ATTR_ARP):
+ case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_ARP):
key_len = SW_FLOW_KEY_OFFSET(ipv4.arp);
if (swkey->eth.type != htons(ETH_P_ARP))
goto invalid;
memcpy(swkey->ipv4.arp.tha, arp_key->arp_tha, ETH_ALEN);
break;
- case TRANSITION(ODP_KEY_ATTR_ICMPV6, ODP_KEY_ATTR_ND):
+ case TRANSITION(OVS_KEY_ATTR_ICMPV6, OVS_KEY_ATTR_ND):
key_len = SW_FLOW_KEY_OFFSET(ipv6.nd);
if (swkey->ipv6.tp.src != htons(NDISC_NEIGHBOUR_SOLICITATION)
&& swkey->ipv6.tp.src != htons(NDISC_NEIGHBOUR_ADVERTISEMENT))
goto invalid;
switch (prev_type) {
- case ODP_KEY_ATTR_UNSPEC:
+ case OVS_KEY_ATTR_UNSPEC:
goto invalid;
- case ODP_KEY_ATTR_TUN_ID:
- case ODP_KEY_ATTR_IN_PORT:
+ case OVS_KEY_ATTR_TUN_ID:
+ case OVS_KEY_ATTR_IN_PORT:
goto invalid;
- case ODP_KEY_ATTR_ETHERNET:
- case ODP_KEY_ATTR_8021Q:
+ case OVS_KEY_ATTR_ETHERNET:
+ case OVS_KEY_ATTR_8021Q:
goto ok;
- case ODP_KEY_ATTR_ETHERTYPE:
+ case OVS_KEY_ATTR_ETHERTYPE:
if (swkey->eth.type == htons(ETH_P_IP) ||
swkey->eth.type == htons(ETH_P_ARP))
goto invalid;
goto ok;
- case ODP_KEY_ATTR_IPV4:
+ case OVS_KEY_ATTR_IPV4:
if (swkey->ip.proto == IPPROTO_TCP ||
swkey->ip.proto == IPPROTO_UDP ||
swkey->ip.proto == IPPROTO_ICMP)
goto invalid;
goto ok;
- case ODP_KEY_ATTR_IPV6:
+ case OVS_KEY_ATTR_IPV6:
if (swkey->ip.proto == IPPROTO_TCP ||
swkey->ip.proto == IPPROTO_UDP ||
swkey->ip.proto == IPPROTO_ICMPV6)
goto invalid;
goto ok;
- case ODP_KEY_ATTR_ICMPV6:
+ case OVS_KEY_ATTR_ICMPV6:
if (swkey->ipv6.tp.src == htons(NDISC_NEIGHBOUR_SOLICITATION) ||
swkey->ipv6.tp.src == htons(NDISC_NEIGHBOUR_ADVERTISEMENT))
goto invalid;
goto ok;
- case ODP_KEY_ATTR_TCP:
- case ODP_KEY_ATTR_UDP:
- case ODP_KEY_ATTR_ICMP:
- case ODP_KEY_ATTR_ARP:
- case ODP_KEY_ATTR_ND:
+ case OVS_KEY_ATTR_TCP:
+ case OVS_KEY_ATTR_UDP:
+ case OVS_KEY_ATTR_ICMP:
+ case OVS_KEY_ATTR_ARP:
+ case OVS_KEY_ATTR_ND:
goto ok;
default:
* flow_metadata_from_nlattrs - parses Netlink attributes into a flow key.
* @in_port: receives the extracted input port.
* @tun_id: receives the extracted tunnel ID.
- * @key: Netlink attribute holding nested %ODP_KEY_ATTR_* Netlink attribute
+ * @key: Netlink attribute holding nested %OVS_KEY_ATTR_* Netlink attribute
* sequence.
*
* This parses a series of Netlink attributes that form a flow key, which must
*tun_id = 0;
- prev_type = ODP_KEY_ATTR_UNSPEC;
+ prev_type = OVS_KEY_ATTR_UNSPEC;
nla_for_each_nested(nla, attr, rem) {
int type = nla_type(nla);
- if (type > ODP_KEY_ATTR_MAX || nla_len(nla) != key_lens[type])
+ if (type > OVS_KEY_ATTR_MAX || nla_len(nla) != key_lens[type])
return -EINVAL;
switch (TRANSITION(prev_type, type)) {
- case TRANSITION(ODP_KEY_ATTR_UNSPEC, ODP_KEY_ATTR_TUN_ID):
+ case TRANSITION(OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_TUN_ID):
*tun_id = nla_get_be64(nla);
break;
- case TRANSITION(ODP_KEY_ATTR_UNSPEC, ODP_KEY_ATTR_IN_PORT):
- case TRANSITION(ODP_KEY_ATTR_TUN_ID, ODP_KEY_ATTR_IN_PORT):
+ case TRANSITION(OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_IN_PORT):
+ case TRANSITION(OVS_KEY_ATTR_TUN_ID, OVS_KEY_ATTR_IN_PORT):
if (nla_get_u32(nla) >= DP_MAX_PORTS)
return -EINVAL;
*in_port = nla_get_u32(nla);
return -EINVAL;
done:
- if (prev_type == ODP_KEY_ATTR_UNSPEC ||
- prev_type == ODP_KEY_ATTR_TUN_ID)
+ if (prev_type == OVS_KEY_ATTR_UNSPEC ||
+ prev_type == OVS_KEY_ATTR_TUN_ID)
return -EINVAL;
return 0;
}
int flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
{
- struct odp_key_ethernet *eth_key;
+ struct ovs_key_ethernet *eth_key;
struct nlattr *nla;
/* This is an imperfect sanity-check that FLOW_BUFSIZE doesn't need
- * to be updated, but will at least raise awareness when new ODP key
- * types are added. */
- BUILD_BUG_ON(__ODP_KEY_ATTR_MAX != 14);
+ * to be updated, but will at least raise awareness when new
+ * datapath key types are added. */
+ BUILD_BUG_ON(__OVS_KEY_ATTR_MAX != 14);
if (swkey->eth.tun_id != cpu_to_be64(0))
- NLA_PUT_BE64(skb, ODP_KEY_ATTR_TUN_ID, swkey->eth.tun_id);
+ NLA_PUT_BE64(skb, OVS_KEY_ATTR_TUN_ID, swkey->eth.tun_id);
- NLA_PUT_U32(skb, ODP_KEY_ATTR_IN_PORT, swkey->eth.in_port);
+ NLA_PUT_U32(skb, OVS_KEY_ATTR_IN_PORT, swkey->eth.in_port);
- nla = nla_reserve(skb, ODP_KEY_ATTR_ETHERNET, sizeof(*eth_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_ETHERNET, sizeof(*eth_key));
if (!nla)
goto nla_put_failure;
eth_key = nla_data(nla);
memcpy(eth_key->eth_dst, swkey->eth.dst, ETH_ALEN);
if (swkey->eth.tci != htons(0)) {
- struct odp_key_8021q q_key;
+ struct ovs_key_8021q q_key;
q_key.q_tpid = htons(ETH_P_8021Q);
q_key.q_tci = swkey->eth.tci & ~htons(VLAN_TAG_PRESENT);
- NLA_PUT(skb, ODP_KEY_ATTR_8021Q, sizeof(q_key), &q_key);
+ NLA_PUT(skb, OVS_KEY_ATTR_8021Q, sizeof(q_key), &q_key);
}
if (swkey->eth.type == htons(ETH_P_802_2))
return 0;
- NLA_PUT_BE16(skb, ODP_KEY_ATTR_ETHERTYPE, swkey->eth.type);
+ NLA_PUT_BE16(skb, OVS_KEY_ATTR_ETHERTYPE, swkey->eth.type);
if (swkey->eth.type == htons(ETH_P_IP)) {
- struct odp_key_ipv4 *ipv4_key;
+ struct ovs_key_ipv4 *ipv4_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_IPV4, sizeof(*ipv4_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_IPV4, sizeof(*ipv4_key));
if (!nla)
goto nla_put_failure;
ipv4_key = nla_data(nla);
- memset(ipv4_key, 0, sizeof(struct odp_key_ipv4));
+ memset(ipv4_key, 0, sizeof(struct ovs_key_ipv4));
ipv4_key->ipv4_src = swkey->ipv4.addr.src;
ipv4_key->ipv4_dst = swkey->ipv4.addr.dst;
ipv4_key->ipv4_proto = swkey->ip.proto;
ipv4_key->ipv4_tos = swkey->ip.tos;
} else if (swkey->eth.type == htons(ETH_P_IPV6)) {
- struct odp_key_ipv6 *ipv6_key;
+ struct ovs_key_ipv6 *ipv6_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_IPV6, sizeof(*ipv6_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_IPV6, sizeof(*ipv6_key));
if (!nla)
goto nla_put_failure;
ipv6_key = nla_data(nla);
- memset(ipv6_key, 0, sizeof(struct odp_key_ipv6));
+ memset(ipv6_key, 0, sizeof(struct ovs_key_ipv6));
memcpy(ipv6_key->ipv6_src, &swkey->ipv6.addr.src,
sizeof(ipv6_key->ipv6_src));
memcpy(ipv6_key->ipv6_dst, &swkey->ipv6.addr.dst,
ipv6_key->ipv6_proto = swkey->ip.proto;
ipv6_key->ipv6_tos = swkey->ip.tos;
} else if (swkey->eth.type == htons(ETH_P_ARP)) {
- struct odp_key_arp *arp_key;
+ struct ovs_key_arp *arp_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_ARP, sizeof(*arp_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_ARP, sizeof(*arp_key));
if (!nla)
goto nla_put_failure;
arp_key = nla_data(nla);
- memset(arp_key, 0, sizeof(struct odp_key_arp));
+ memset(arp_key, 0, sizeof(struct ovs_key_arp));
arp_key->arp_sip = swkey->ipv4.addr.src;
arp_key->arp_tip = swkey->ipv4.addr.dst;
arp_key->arp_op = htons(swkey->ip.proto);
swkey->eth.type == htons(ETH_P_IPV6)) {
if (swkey->ip.proto == IPPROTO_TCP) {
- struct odp_key_tcp *tcp_key;
+ struct ovs_key_tcp *tcp_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_TCP, sizeof(*tcp_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_TCP, sizeof(*tcp_key));
if (!nla)
goto nla_put_failure;
tcp_key = nla_data(nla);
tcp_key->tcp_dst = swkey->ipv6.tp.dst;
}
} else if (swkey->ip.proto == IPPROTO_UDP) {
- struct odp_key_udp *udp_key;
+ struct ovs_key_udp *udp_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_UDP, sizeof(*udp_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_UDP, sizeof(*udp_key));
if (!nla)
goto nla_put_failure;
udp_key = nla_data(nla);
}
} else if (swkey->eth.type == htons(ETH_P_IP) &&
swkey->ip.proto == IPPROTO_ICMP) {
- struct odp_key_icmp *icmp_key;
+ struct ovs_key_icmp *icmp_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_ICMP, sizeof(*icmp_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_ICMP, sizeof(*icmp_key));
if (!nla)
goto nla_put_failure;
icmp_key = nla_data(nla);
icmp_key->icmp_code = ntohs(swkey->ipv4.tp.dst);
} else if (swkey->eth.type == htons(ETH_P_IPV6) &&
swkey->ip.proto == IPPROTO_ICMPV6) {
- struct odp_key_icmpv6 *icmpv6_key;
+ struct ovs_key_icmpv6 *icmpv6_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_ICMPV6,
+ nla = nla_reserve(skb, OVS_KEY_ATTR_ICMPV6,
sizeof(*icmpv6_key));
if (!nla)
goto nla_put_failure;
if (icmpv6_key->icmpv6_type == NDISC_NEIGHBOUR_SOLICITATION ||
icmpv6_key->icmpv6_type == NDISC_NEIGHBOUR_ADVERTISEMENT) {
- struct odp_key_nd *nd_key;
+ struct ovs_key_nd *nd_key;
- nla = nla_reserve(skb, ODP_KEY_ATTR_ND, sizeof(*nd_key));
+ nla = nla_reserve(skb, OVS_KEY_ATTR_ND, sizeof(*nd_key));
if (!nla)
goto nla_put_failure;
nd_key = nla_data(nla);
*
* struct pad nl hdr total
* ------ --- ------ -----
- * ODP_KEY_ATTR_TUN_ID 8 -- 4 12
- * ODP_KEY_ATTR_IN_PORT 4 -- 4 8
- * ODP_KEY_ATTR_ETHERNET 12 -- 4 16
- * ODP_KEY_ATTR_8021Q 4 -- 4 8
- * ODP_KEY_ATTR_ETHERTYPE 2 2 4 8
- * ODP_KEY_ATTR_IPV6 34 2 4 40
- * ODP_KEY_ATTR_ICMPV6 2 2 4 8
- * ODP_KEY_ATTR_ND 28 -- 4 32
+ * OVS_KEY_ATTR_TUN_ID 8 -- 4 12
+ * OVS_KEY_ATTR_IN_PORT 4 -- 4 8
+ * OVS_KEY_ATTR_ETHERNET 12 -- 4 16
+ * OVS_KEY_ATTR_8021Q 4 -- 4 8
+ * OVS_KEY_ATTR_ETHERTYPE 2 2 4 8
+ * OVS_KEY_ATTR_IPV6 34 2 4 40
+ * OVS_KEY_ATTR_ICMPV6 2 2 4 8
+ * OVS_KEY_ATTR_ND 28 -- 4 32
* -------------------------------------------------
* total 132
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
/* Before v2.6.29, a NLA_NESTED attribute, if it was present, was not allowed
* to be empty. However, OVS depends on the ability to accept empty
- * attributes. For example, a present but empty ODP_FLOW_ATTR_ACTIONS on
- * ODP_FLOW_CMD_SET replaces the existing set of actions by an empty "drop"
- * action, whereas a missing ODP_FLOW_ATTR_ACTIONS leaves the existing
+ * attributes. For example, a present but empty OVS_FLOW_ATTR_ACTIONS on
+ * OVS_FLOW_CMD_SET replaces the existing set of actions by an empty "drop"
+ * action, whereas a missing OVS_FLOW_ATTR_ACTIONS leaves the existing
* actions, if any, unchanged.
*
* NLA_NESTED is different from NLA_UNSPEC in only two ways:
return sent_len;
}
-static const struct nla_policy tnl_policy[ODP_TUNNEL_ATTR_MAX + 1] = {
- [ODP_TUNNEL_ATTR_FLAGS] = { .type = NLA_U32 },
- [ODP_TUNNEL_ATTR_DST_IPV4] = { .type = NLA_U32 },
- [ODP_TUNNEL_ATTR_SRC_IPV4] = { .type = NLA_U32 },
- [ODP_TUNNEL_ATTR_OUT_KEY] = { .type = NLA_U64 },
- [ODP_TUNNEL_ATTR_IN_KEY] = { .type = NLA_U64 },
- [ODP_TUNNEL_ATTR_TOS] = { .type = NLA_U8 },
- [ODP_TUNNEL_ATTR_TTL] = { .type = NLA_U8 },
+static const struct nla_policy tnl_policy[OVS_TUNNEL_ATTR_MAX + 1] = {
+ [OVS_TUNNEL_ATTR_FLAGS] = { .type = NLA_U32 },
+ [OVS_TUNNEL_ATTR_DST_IPV4] = { .type = NLA_U32 },
+ [OVS_TUNNEL_ATTR_SRC_IPV4] = { .type = NLA_U32 },
+ [OVS_TUNNEL_ATTR_OUT_KEY] = { .type = NLA_U64 },
+ [OVS_TUNNEL_ATTR_IN_KEY] = { .type = NLA_U64 },
+ [OVS_TUNNEL_ATTR_TOS] = { .type = NLA_U8 },
+ [OVS_TUNNEL_ATTR_TTL] = { .type = NLA_U8 },
};
-/* Sets ODP_TUNNEL_ATTR_* fields in 'mutable', which must initially be zeroed. */
+/* Sets OVS_TUNNEL_ATTR_* fields in 'mutable', which must initially be zeroed. */
static int tnl_set_config(struct nlattr *options, const struct tnl_ops *tnl_ops,
const struct vport *cur_vport,
struct tnl_mutable_config *mutable)
{
const struct vport *old_vport;
const struct tnl_mutable_config *old_mutable;
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1];
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
int err;
if (!options)
return -EINVAL;
- err = nla_parse_nested(a, ODP_TUNNEL_ATTR_MAX, options, tnl_policy);
+ err = nla_parse_nested(a, OVS_TUNNEL_ATTR_MAX, options, tnl_policy);
if (err)
return err;
- if (!a[ODP_TUNNEL_ATTR_FLAGS] || !a[ODP_TUNNEL_ATTR_DST_IPV4])
+ if (!a[OVS_TUNNEL_ATTR_FLAGS] || !a[OVS_TUNNEL_ATTR_DST_IPV4])
return -EINVAL;
- mutable->flags = nla_get_u32(a[ODP_TUNNEL_ATTR_FLAGS]) & TNL_F_PUBLIC;
+ mutable->flags = nla_get_u32(a[OVS_TUNNEL_ATTR_FLAGS]) & TNL_F_PUBLIC;
- if (a[ODP_TUNNEL_ATTR_SRC_IPV4])
- mutable->saddr = nla_get_be32(a[ODP_TUNNEL_ATTR_SRC_IPV4]);
- mutable->daddr = nla_get_be32(a[ODP_TUNNEL_ATTR_DST_IPV4]);
+ if (a[OVS_TUNNEL_ATTR_SRC_IPV4])
+ mutable->saddr = nla_get_be32(a[OVS_TUNNEL_ATTR_SRC_IPV4]);
+ mutable->daddr = nla_get_be32(a[OVS_TUNNEL_ATTR_DST_IPV4]);
- if (a[ODP_TUNNEL_ATTR_TOS]) {
- mutable->tos = nla_get_u8(a[ODP_TUNNEL_ATTR_TOS]);
+ if (a[OVS_TUNNEL_ATTR_TOS]) {
+ mutable->tos = nla_get_u8(a[OVS_TUNNEL_ATTR_TOS]);
if (mutable->tos != RT_TOS(mutable->tos))
return -EINVAL;
}
- if (a[ODP_TUNNEL_ATTR_TTL])
- mutable->ttl = nla_get_u8(a[ODP_TUNNEL_ATTR_TTL]);
+ if (a[OVS_TUNNEL_ATTR_TTL])
+ mutable->ttl = nla_get_u8(a[OVS_TUNNEL_ATTR_TTL]);
mutable->tunnel_type = tnl_ops->tunnel_type;
- if (!a[ODP_TUNNEL_ATTR_IN_KEY]) {
+ if (!a[OVS_TUNNEL_ATTR_IN_KEY]) {
mutable->tunnel_type |= TNL_T_KEY_MATCH;
mutable->flags |= TNL_F_IN_KEY_MATCH;
} else {
mutable->tunnel_type |= TNL_T_KEY_EXACT;
- mutable->in_key = nla_get_be64(a[ODP_TUNNEL_ATTR_IN_KEY]);
+ mutable->in_key = nla_get_be64(a[OVS_TUNNEL_ATTR_IN_KEY]);
}
- if (!a[ODP_TUNNEL_ATTR_OUT_KEY])
+ if (!a[OVS_TUNNEL_ATTR_OUT_KEY])
mutable->flags |= TNL_F_OUT_KEY_ACTION;
else
- mutable->out_key = nla_get_be64(a[ODP_TUNNEL_ATTR_OUT_KEY]);
+ mutable->out_key = nla_get_be64(a[OVS_TUNNEL_ATTR_OUT_KEY]);
mutable->tunnel_hlen = tnl_ops->hdr_len(mutable);
if (mutable->tunnel_hlen < 0)
const struct tnl_vport *tnl_vport = tnl_vport_priv(vport);
const struct tnl_mutable_config *mutable = rcu_dereference_rtnl(tnl_vport->mutable);
- NLA_PUT_U32(skb, ODP_TUNNEL_ATTR_FLAGS, mutable->flags & TNL_F_PUBLIC);
- NLA_PUT_BE32(skb, ODP_TUNNEL_ATTR_DST_IPV4, mutable->daddr);
+ NLA_PUT_U32(skb, OVS_TUNNEL_ATTR_FLAGS, mutable->flags & TNL_F_PUBLIC);
+ NLA_PUT_BE32(skb, OVS_TUNNEL_ATTR_DST_IPV4, mutable->daddr);
if (!(mutable->flags & TNL_F_IN_KEY_MATCH))
- NLA_PUT_BE64(skb, ODP_TUNNEL_ATTR_IN_KEY, mutable->in_key);
+ NLA_PUT_BE64(skb, OVS_TUNNEL_ATTR_IN_KEY, mutable->in_key);
if (!(mutable->flags & TNL_F_OUT_KEY_ACTION))
- NLA_PUT_BE64(skb, ODP_TUNNEL_ATTR_OUT_KEY, mutable->out_key);
+ NLA_PUT_BE64(skb, OVS_TUNNEL_ATTR_OUT_KEY, mutable->out_key);
if (mutable->saddr)
- NLA_PUT_BE32(skb, ODP_TUNNEL_ATTR_SRC_IPV4, mutable->saddr);
+ NLA_PUT_BE32(skb, OVS_TUNNEL_ATTR_SRC_IPV4, mutable->saddr);
if (mutable->tos)
- NLA_PUT_U8(skb, ODP_TUNNEL_ATTR_TOS, mutable->tos);
+ NLA_PUT_U8(skb, OVS_TUNNEL_ATTR_TOS, mutable->tos);
if (mutable->ttl)
- NLA_PUT_U8(skb, ODP_TUNNEL_ATTR_TTL, mutable->ttl);
+ NLA_PUT_U8(skb, OVS_TUNNEL_ATTR_TTL, mutable->ttl);
return 0;
unsigned char eth_addr[ETH_ALEN];
- /* Configured via ODP_TUNNEL_ATTR_* attributes. */
+ /* Configured via OVS_TUNNEL_ATTR_* attributes. */
__be64 in_key;
__be64 out_key;
u32 flags;
}
const struct vport_ops capwap_vport_ops = {
- .type = ODP_VPORT_TYPE_CAPWAP,
+ .type = OVS_VPORT_TYPE_CAPWAP,
.flags = VPORT_F_GEN_STATS,
.init = capwap_init,
.exit = capwap_exit,
}
const struct vport_ops gre_vport_ops = {
- .type = ODP_VPORT_TYPE_GRE,
+ .type = OVS_VPORT_TYPE_GRE,
.flags = VPORT_F_GEN_STATS | VPORT_F_TUN_ID,
.init = gre_init,
.exit = gre_exit,
}
const struct vport_ops internal_vport_ops = {
- .type = ODP_VPORT_TYPE_INTERNAL,
+ .type = OVS_VPORT_TYPE_INTERNAL,
.flags = VPORT_F_REQUIRED | VPORT_F_GEN_STATS | VPORT_F_FLOW,
.create = internal_dev_create,
.destroy = internal_dev_destroy,
}
const struct vport_ops netdev_vport_ops = {
- .type = ODP_VPORT_TYPE_NETDEV,
+ .type = OVS_VPORT_TYPE_NETDEV,
.flags = (VPORT_F_REQUIRED |
(USE_VPORT_STATS ? VPORT_F_GEN_STATS : 0)),
.init = netdev_init,
kfree(peer_table);
}
-static const struct nla_policy patch_policy[ODP_PATCH_ATTR_MAX + 1] = {
+static const struct nla_policy patch_policy[OVS_PATCH_ATTR_MAX + 1] = {
#ifdef HAVE_NLA_NUL_STRING
- [ODP_PATCH_ATTR_PEER] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
+ [OVS_PATCH_ATTR_PEER] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
#endif
};
struct patch_config *patchconf)
{
struct patch_vport *patch_vport = patch_vport_priv(vport);
- struct nlattr *a[ODP_PATCH_ATTR_MAX + 1];
+ struct nlattr *a[OVS_PATCH_ATTR_MAX + 1];
const char *peer_name;
int err;
if (!options)
return -EINVAL;
- err = nla_parse_nested(a, ODP_PATCH_ATTR_MAX, options, patch_policy);
+ err = nla_parse_nested(a, OVS_PATCH_ATTR_MAX, options, patch_policy);
if (err)
return err;
- if (!a[ODP_PATCH_ATTR_PEER] ||
- CHECK_NUL_STRING(a[ODP_PATCH_ATTR_PEER], IFNAMSIZ - 1))
+ if (!a[OVS_PATCH_ATTR_PEER] ||
+ CHECK_NUL_STRING(a[OVS_PATCH_ATTR_PEER], IFNAMSIZ - 1))
return -EINVAL;
- peer_name = nla_data(a[ODP_PATCH_ATTR_PEER]);
+ peer_name = nla_data(a[OVS_PATCH_ATTR_PEER]);
if (!strcmp(patch_vport->name, peer_name))
return -EINVAL;
struct patch_vport *patch_vport = patch_vport_priv(vport);
struct patch_config *patchconf = rcu_dereference_rtnl(patch_vport->patchconf);
- return nla_put_string(skb, ODP_PATCH_ATTR_PEER, patchconf->peer_name);
+ return nla_put_string(skb, OVS_PATCH_ATTR_PEER, patchconf->peer_name);
}
static int patch_send(struct vport *vport, struct sk_buff *skb)
}
const struct vport_ops patch_vport_ops = {
- .type = ODP_VPORT_TYPE_PATCH,
+ .type = OVS_VPORT_TYPE_PATCH,
.flags = VPORT_F_GEN_STATS,
.init = patch_init,
.exit = patch_exit,
*
* Retrieves the type of the given device.
*/
-enum odp_vport_type vport_get_type(const struct vport *vport)
+enum ovs_vport_type vport_get_type(const struct vport *vport)
{
return vport->ops->type;
}
* @skb: sk_buff where options should be appended.
*
* Retrieves the configuration of the given device, appending an
- * %ODP_VPORT_ATTR_OPTIONS attribute that in turn contains nested
+ * %OVS_VPORT_ATTR_OPTIONS attribute that in turn contains nested
* vport-specific attributes to @skb.
*
* Returns 0 if successful, -EMSGSIZE if @skb has insufficient room, or another
{
struct nlattr *nla;
- nla = nla_nest_start(skb, ODP_VPORT_ATTR_OPTIONS);
+ nla = nla_nest_start(skb, OVS_VPORT_ATTR_OPTIONS);
if (!nla)
return -EMSGSIZE;
int vport_set_stats(struct vport *, struct rtnl_link_stats64 *);
const char *vport_get_name(const struct vport *);
-enum odp_vport_type vport_get_type(const struct vport *);
+enum ovs_vport_type vport_get_type(const struct vport *);
const unsigned char *vport_get_addr(const struct vport *);
struct kobject *vport_get_kobj(const struct vport *);
*
* @name: New vport's name.
* @type: New vport's type.
- * @options: %ODP_VPORT_ATTR_OPTIONS attribute from Netlink message, %NULL if
+ * @options: %OVS_VPORT_ATTR_OPTIONS attribute from Netlink message, %NULL if
* none was supplied.
* @dp: New vport's datapath.
* @port_no: New vport's port number.
*/
struct vport_parms {
const char *name;
- enum odp_vport_type type;
+ enum ovs_vport_type type;
struct nlattr *options;
/* For vport_alloc(). */
/**
* struct vport_ops - definition of a type of virtual port
*
- * @type: %ODP_VPORT_TYPE_* value for this type of virtual port.
+ * @type: %OVS_VPORT_TYPE_* value for this type of virtual port.
* @flags: Flags of type VPORT_F_* that influence how the generic vport layer
* handles this vport.
* @init: Called at module initialization. If VPORT_F_REQUIRED is set then the
* @send: Send a packet on the device. Returns the length of the packet sent.
*/
struct vport_ops {
- enum odp_vport_type type;
+ enum ovs_vport_type type;
u32 flags;
/* Called at module init and exit respectively. */
\f
/* datapaths. */
-#define ODP_DATAPATH_FAMILY "odp_datapath"
-#define ODP_DATAPATH_MCGROUP "odp_datapath"
-
-enum odp_datapath_cmd {
- ODP_DP_CMD_UNSPEC,
- ODP_DP_CMD_NEW,
- ODP_DP_CMD_DEL,
- ODP_DP_CMD_GET,
- ODP_DP_CMD_SET
+#define OVS_DATAPATH_FAMILY "ovs_datapath"
+#define OVS_DATAPATH_MCGROUP "ovs_datapath"
+
+enum ovs_datapath_cmd {
+ OVS_DP_CMD_UNSPEC,
+ OVS_DP_CMD_NEW,
+ OVS_DP_CMD_DEL,
+ OVS_DP_CMD_GET,
+ OVS_DP_CMD_SET
};
/**
- * struct odp_header - header for ODP Generic Netlink messages.
+ * struct ovs_header - header for OVS Generic Netlink messages.
* @dp_ifindex: ifindex of local port for datapath (0 to make a request not
* specific to a datapath).
*
- * Attributes following the header are specific to a particular ODP Generic
- * Netlink family, but all of the ODP families use this header.
+ * Attributes following the header are specific to a particular OVS Generic
+ * Netlink family, but all of the OVS families use this header.
*/
-struct odp_header {
+struct ovs_header {
int dp_ifindex;
};
\f
/**
- * enum odp_datapath_attr - attributes for %ODP_DP_* commands.
- * @ODP_DP_ATTR_NAME: Name of the network device that serves as the "local
+ * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
+ * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
* port". This is the name of the network device whose dp_ifindex is given in
- * the &struct odp_header. Always present in notifications. Required in
- * %ODP_DP_NEW requests. May be used as an alternative to specifying
+ * the &struct ovs_header. Always present in notifications. Required in
+ * %OVS_DP_NEW requests. May be used as an alternative to specifying
* dp_ifindex in other requests (with a dp_ifindex of 0).
- * @ODP_DP_ATTR_STATS: Statistics about packets that have passed through the
+ * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
* datapath. Always present in notifications.
- * @ODP_DP_ATTR_IPV4_FRAGS: One of %ODP_DP_FRAG_*. Always present in
- * notifications. May be included in %ODP_DP_NEW or %ODP_DP_SET requests to
+ * @OVS_DP_ATTR_IPV4_FRAGS: One of %OVS_DP_FRAG_*. Always present in
+ * notifications. May be included in %OVS_DP_NEW or %OVS_DP_SET requests to
* change the fragment handling policy.
- * @ODP_DP_ATTR_SAMPLING: 32-bit fraction of packets to sample with
- * @ODP_PACKET_CMD_SAMPLE. A value of 0 samples no packets, a value of
+ * @OVS_DP_ATTR_SAMPLING: 32-bit fraction of packets to sample with
+ * @OVS_PACKET_CMD_SAMPLE. A value of 0 samples no packets, a value of
* %UINT32_MAX samples all packets, and intermediate values sample intermediate
* fractions of packets.
- * @ODP_DP_ATTR_MCGROUPS: Nested attributes with multicast groups. Each nested
- * attribute has a %ODP_PACKET_CMD_* type with a 32-bit value giving the
+ * @OVS_DP_ATTR_MCGROUPS: Nested attributes with multicast groups. Each nested
+ * attribute has a %OVS_PACKET_CMD_* type with a 32-bit value giving the
* Generic Netlink multicast group number used for sending this datapath's
* messages with that command type up to userspace.
*
- * These attributes follow the &struct odp_header within the Generic Netlink
- * payload for %ODP_DP_* commands.
+ * These attributes follow the &struct ovs_header within the Generic Netlink
+ * payload for %OVS_DP_* commands.
*/
-enum odp_datapath_attr {
- ODP_DP_ATTR_UNSPEC,
- ODP_DP_ATTR_NAME, /* name of dp_ifindex netdev */
- ODP_DP_ATTR_STATS, /* struct odp_stats */
- ODP_DP_ATTR_IPV4_FRAGS, /* 32-bit enum odp_frag_handling */
- ODP_DP_ATTR_SAMPLING, /* 32-bit fraction of packets to sample. */
- ODP_DP_ATTR_MCGROUPS, /* Nested attributes with multicast groups. */
- __ODP_DP_ATTR_MAX
+enum ovs_datapath_attr {
+ OVS_DP_ATTR_UNSPEC,
+ OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
+ OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
+ OVS_DP_ATTR_IPV4_FRAGS, /* 32-bit enum ovs_frag_handling */
+ OVS_DP_ATTR_SAMPLING, /* 32-bit fraction of packets to sample. */
+ OVS_DP_ATTR_MCGROUPS, /* Nested attributes with multicast groups. */
+ __OVS_DP_ATTR_MAX
};
-#define ODP_DP_ATTR_MAX (__ODP_DP_ATTR_MAX - 1)
+#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
/**
- * enum odp_frag_handling - policy for handling received IPv4 fragments.
- * @ODP_DP_FRAG_ZERO: Treat IP fragments as IP protocol 0 and transport ports
+ * enum ovs_frag_handling - policy for handling received IPv4 fragments.
+ * @OVS_DP_FRAG_ZERO: Treat IP fragments as IP protocol 0 and transport ports
* zero.
- * @ODP_DP_FRAG_DROP: Drop IP fragments. Do not pass them through the flow
+ * @OVS_DP_FRAG_DROP: Drop IP fragments. Do not pass them through the flow
* table or up to userspace.
*/
-enum odp_frag_handling {
- ODP_DP_FRAG_UNSPEC,
- ODP_DP_FRAG_ZERO, /* Treat IP fragments as transport port 0. */
- ODP_DP_FRAG_DROP /* Drop IP fragments. */
+enum ovs_frag_handling {
+ OVS_DP_FRAG_UNSPEC,
+ OVS_DP_FRAG_ZERO, /* Treat IP fragments as transport port 0. */
+ OVS_DP_FRAG_DROP /* Drop IP fragments. */
};
-struct odp_stats {
+struct ovs_dp_stats {
uint64_t n_frags; /* Number of dropped IP fragments. */
uint64_t n_hit; /* Number of flow table matches. */
uint64_t n_missed; /* Number of flow table misses. */
};
/* Logical ports. */
-#define ODPP_LOCAL ((uint16_t)0)
+#define OVSP_LOCAL ((uint16_t)0)
\f
-#define ODP_PACKET_FAMILY "odp_packet"
+#define OVS_PACKET_FAMILY "ovs_packet"
-enum odp_packet_cmd {
- ODP_PACKET_CMD_UNSPEC,
+enum ovs_packet_cmd {
+ OVS_PACKET_CMD_UNSPEC,
/* Kernel-to-user notifications. */
- ODP_PACKET_CMD_MISS, /* Flow table miss. */
- ODP_PACKET_CMD_ACTION, /* ODP_ACTION_ATTR_USERSPACE action. */
- ODP_PACKET_CMD_SAMPLE, /* Sampled packet. */
+ OVS_PACKET_CMD_MISS, /* Flow table miss. */
+ OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
+ OVS_PACKET_CMD_SAMPLE, /* Sampled packet. */
/* User commands. */
- ODP_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
+ OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
};
/**
- * enum odp_packet_attr - attributes for %ODP_PACKET_* commands.
- * @ODP_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
+ * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
+ * @OVS_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_USERSPACE, but %ODP_PACKET_ATTR_KEY is
+ * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
+ * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_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
+ * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
+ * extracted from the packet as nested %OVS_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_USERSPACE, action's argument was
+ * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
+ * notification if the %OVS_ACTION_ATTR_USERSPACE, action's argument was
* nonzero.
- * @ODP_PACKET_ATTR_SAMPLE_POOL: Present for %ODP_PACKET_CMD_SAMPLE. Contains
+ * @OVS_PACKET_ATTR_SAMPLE_POOL: Present for %OVS_PACKET_CMD_SAMPLE. Contains
* the number of packets processed so far that were candidates for sampling.
- * @ODP_PACKET_ATTR_ACTIONS: Present for %ODP_PACKET_CMD_SAMPLE. Contains a
- * copy of the actions applied to the packet, as nested %ODP_ACTION_ATTR_*
+ * @OVS_PACKET_ATTR_ACTIONS: Present for %OVS_PACKET_CMD_SAMPLE. Contains a
+ * copy of the actions applied to the packet, as nested %OVS_ACTION_ATTR_*
* attributes.
*
- * These attributes follow the &struct odp_header within the Generic Netlink
- * payload for %ODP_PACKET_* commands.
+ * These attributes follow the &struct ovs_header within the Generic Netlink
+ * payload for %OVS_PACKET_* commands.
*/
-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_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
+enum ovs_packet_attr {
+ OVS_PACKET_ATTR_UNSPEC,
+ OVS_PACKET_ATTR_PACKET, /* Packet data. */
+ OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
+ OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
+ OVS_PACKET_ATTR_SAMPLE_POOL, /* # sampling candidate packets so far. */
+ OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
+ __OVS_PACKET_ATTR_MAX
};
-#define ODP_PACKET_ATTR_MAX (__ODP_PACKET_ATTR_MAX - 1)
+#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
\f
-enum odp_vport_type {
- ODP_VPORT_TYPE_UNSPEC,
- ODP_VPORT_TYPE_NETDEV, /* network device */
- ODP_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
- ODP_VPORT_TYPE_PATCH, /* virtual tunnel connecting two vports */
- ODP_VPORT_TYPE_GRE, /* GRE tunnel */
- ODP_VPORT_TYPE_CAPWAP, /* CAPWAP tunnel */
- __ODP_VPORT_TYPE_MAX
+enum ovs_vport_type {
+ OVS_VPORT_TYPE_UNSPEC,
+ OVS_VPORT_TYPE_NETDEV, /* network device */
+ OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
+ OVS_VPORT_TYPE_PATCH, /* virtual tunnel connecting two vports */
+ OVS_VPORT_TYPE_GRE, /* GRE tunnel */
+ OVS_VPORT_TYPE_CAPWAP, /* CAPWAP tunnel */
+ __OVS_VPORT_TYPE_MAX
};
-#define ODP_VPORT_TYPE_MAX (__ODP_VPORT_TYPE_MAX - 1)
+#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
\f
-#define ODP_VPORT_FAMILY "odp_vport"
-#define ODP_VPORT_MCGROUP "odp_vport"
-
-enum odp_vport_cmd {
- ODP_VPORT_CMD_UNSPEC,
- ODP_VPORT_CMD_NEW,
- ODP_VPORT_CMD_DEL,
- ODP_VPORT_CMD_GET,
- ODP_VPORT_CMD_SET
+#define OVS_VPORT_FAMILY "ovs_vport"
+#define OVS_VPORT_MCGROUP "ovs_vport"
+
+enum ovs_vport_cmd {
+ OVS_VPORT_CMD_UNSPEC,
+ OVS_VPORT_CMD_NEW,
+ OVS_VPORT_CMD_DEL,
+ OVS_VPORT_CMD_GET,
+ OVS_VPORT_CMD_SET
};
/**
- * enum odp_vport_attr - attributes for %ODP_VPORT_* commands.
- * @ODP_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
- * @ODP_VPORT_ATTR_TYPE: 32-bit %ODP_VPORT_TYPE_* constant describing the type
+ * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
+ * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
+ * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
* of vport.
- * @ODP_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
+ * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
* this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
* plus a null terminator.
- * @ODP_VPORT_ATTR_STATS: A &struct rtnl_link_stats64 giving statistics for
+ * @OVS_VPORT_ATTR_STATS: A &struct rtnl_link_stats64 giving statistics for
* packets sent or received through the vport.
- * @ODP_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport.
- * @ODP_VPORT_ATTR_MTU: MTU for the vport. Omitted if the vport does not have
+ * @OVS_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport.
+ * @OVS_VPORT_ATTR_MTU: MTU for the vport. Omitted if the vport does not have
* an MTU as, e.g., some tunnels do not.
- * @ODP_VPORT_ATTR_IFINDEX: ifindex of the underlying network device, if any.
- * @ODP_VPORT_ATTR_IFLINK: ifindex of the device on which packets are sent (for
+ * @OVS_VPORT_ATTR_IFINDEX: ifindex of the underlying network device, if any.
+ * @OVS_VPORT_ATTR_IFLINK: ifindex of the device on which packets are sent (for
* tunnels), if any.
*
- * These attributes follow the &struct odp_header within the Generic Netlink
- * payload for %ODP_VPORT_* commands.
+ * These attributes follow the &struct ovs_header within the Generic Netlink
+ * payload for %OVS_VPORT_* commands.
*
* All attributes applicable to a given port are present in notifications.
* This means that, for example, a vport that has no corresponding network
- * device would omit %ODP_VPORT_ATTR_IFINDEX.
+ * device would omit %OVS_VPORT_ATTR_IFINDEX.
*
- * For %ODP_VPORT_CMD_NEW requests, the %ODP_VPORT_ATTR_TYPE and
- * %ODP_VPORT_ATTR_NAME attributes are required. %ODP_VPORT_ATTR_PORT_NO is
+ * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
+ * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
* optional; if not specified a free port number is automatically selected.
- * Whether %ODP_VPORT_ATTR_OPTIONS is required or optional depends on the type
- * of vport. %ODP_VPORT_ATTR_STATS, %ODP_VPORT_ATTR_ADDRESS, and
- * %ODP_VPORT_ATTR_MTU are optional, and other attributes are ignored.
+ * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
+ * of vport. %OVS_VPORT_ATTR_STATS, %OVS_VPORT_ATTR_ADDRESS, and
+ * %OVS_VPORT_ATTR_MTU are optional, and other attributes are ignored.
*
- * For other requests, if %ODP_VPORT_ATTR_NAME is specified then it is used to
+ * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
* look up the vport to operate on; otherwise dp_idx from the &struct
- * odp_header plus %ODP_VPORT_ATTR_PORT_NO determine the vport.
+ * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
*/
-enum odp_vport_attr {
- ODP_VPORT_ATTR_UNSPEC,
- ODP_VPORT_ATTR_PORT_NO, /* port number within datapath */
- ODP_VPORT_ATTR_TYPE, /* 32-bit ODP_VPORT_TYPE_* constant. */
- ODP_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
- ODP_VPORT_ATTR_STATS, /* struct rtnl_link_stats64 */
- ODP_VPORT_ATTR_ADDRESS, /* hardware address */
- ODP_VPORT_ATTR_MTU, /* 32-bit maximum transmission unit */
- ODP_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
- ODP_VPORT_ATTR_IFINDEX, /* 32-bit ifindex of backing netdev */
- ODP_VPORT_ATTR_IFLINK, /* 32-bit ifindex on which packets are sent */
- __ODP_VPORT_ATTR_MAX
+enum ovs_vport_attr {
+ OVS_VPORT_ATTR_UNSPEC,
+ OVS_VPORT_ATTR_PORT_NO, /* port number within datapath */
+ OVS_VPORT_ATTR_TYPE, /* 32-bit OVS_VPORT_TYPE_* constant. */
+ OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
+ OVS_VPORT_ATTR_STATS, /* struct rtnl_link_stats64 */
+ OVS_VPORT_ATTR_ADDRESS, /* hardware address */
+ OVS_VPORT_ATTR_MTU, /* 32-bit maximum transmission unit */
+ OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
+ OVS_VPORT_ATTR_IFINDEX, /* 32-bit ifindex of backing netdev */
+ OVS_VPORT_ATTR_IFLINK, /* 32-bit ifindex on which packets are sent */
+ __OVS_VPORT_ATTR_MAX
};
-#define ODP_VPORT_ATTR_MAX (__ODP_VPORT_ATTR_MAX - 1)
+#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
-/* ODP_VPORT_ATTR_OPTIONS attributes for patch vports. */
+/* OVS_VPORT_ATTR_OPTIONS attributes for patch vports. */
enum {
- ODP_PATCH_ATTR_UNSPEC,
- ODP_PATCH_ATTR_PEER, /* name of peer vport, as a string */
- __ODP_PATCH_ATTR_MAX
+ OVS_PATCH_ATTR_UNSPEC,
+ OVS_PATCH_ATTR_PEER, /* name of peer vport, as a string */
+ __OVS_PATCH_ATTR_MAX
};
-#define ODP_PATCH_ATTR_MAX (__ODP_PATCH_ATTR_MAX - 1)
+#define OVS_PATCH_ATTR_MAX (__OVS_PATCH_ATTR_MAX - 1)
\f
/* Flows. */
-#define ODP_FLOW_FAMILY "odp_flow"
-#define ODP_FLOW_MCGROUP "odp_flow"
+#define OVS_FLOW_FAMILY "ovs_flow"
+#define OVS_FLOW_MCGROUP "ovs_flow"
-enum odp_flow_cmd {
- ODP_FLOW_CMD_UNSPEC,
- ODP_FLOW_CMD_NEW,
- ODP_FLOW_CMD_DEL,
- ODP_FLOW_CMD_GET,
- ODP_FLOW_CMD_SET
+enum ovs_flow_cmd {
+ OVS_FLOW_CMD_UNSPEC,
+ OVS_FLOW_CMD_NEW,
+ OVS_FLOW_CMD_DEL,
+ OVS_FLOW_CMD_GET,
+ OVS_FLOW_CMD_SET
};
-struct odp_flow_stats {
+struct ovs_flow_stats {
uint64_t n_packets; /* Number of matched packets. */
uint64_t n_bytes; /* Number of matched bytes. */
};
-enum odp_key_type {
- ODP_KEY_ATTR_UNSPEC,
- ODP_KEY_ATTR_TUN_ID, /* 64-bit tunnel ID */
- ODP_KEY_ATTR_IN_PORT, /* 32-bit ODP port number */
- ODP_KEY_ATTR_ETHERNET, /* struct odp_key_ethernet */
- ODP_KEY_ATTR_8021Q, /* struct odp_key_8021q */
- ODP_KEY_ATTR_ETHERTYPE, /* 16-bit Ethernet type */
- ODP_KEY_ATTR_IPV4, /* struct odp_key_ipv4 */
- ODP_KEY_ATTR_IPV6, /* struct odp_key_ipv6 */
- ODP_KEY_ATTR_TCP, /* struct odp_key_tcp */
- ODP_KEY_ATTR_UDP, /* struct odp_key_udp */
- ODP_KEY_ATTR_ICMP, /* struct odp_key_icmp */
- ODP_KEY_ATTR_ICMPV6, /* struct odp_key_icmpv6 */
- ODP_KEY_ATTR_ARP, /* struct odp_key_arp */
- ODP_KEY_ATTR_ND, /* struct odp_key_nd */
- __ODP_KEY_ATTR_MAX
+enum ovs_key_type {
+ OVS_KEY_ATTR_UNSPEC,
+ OVS_KEY_ATTR_TUN_ID, /* 64-bit tunnel ID */
+ OVS_KEY_ATTR_IN_PORT, /* 32-bit OVS dp port number */
+ OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
+ OVS_KEY_ATTR_8021Q, /* struct ovs_key_8021q */
+ OVS_KEY_ATTR_ETHERTYPE, /* 16-bit Ethernet type */
+ OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
+ OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
+ OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
+ OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
+ OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
+ OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
+ OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
+ OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
+ __OVS_KEY_ATTR_MAX
};
-#define ODP_KEY_ATTR_MAX (__ODP_KEY_ATTR_MAX - 1)
+#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
-struct odp_key_ethernet {
+struct ovs_key_ethernet {
uint8_t eth_src[6];
uint8_t eth_dst[6];
};
-struct odp_key_8021q {
+struct ovs_key_8021q {
ovs_be16 q_tpid;
ovs_be16 q_tci;
};
-struct odp_key_ipv4 {
+struct ovs_key_ipv4 {
ovs_be32 ipv4_src;
ovs_be32 ipv4_dst;
uint8_t ipv4_proto;
uint8_t ipv4_tos;
};
-struct odp_key_ipv6 {
+struct ovs_key_ipv6 {
ovs_be32 ipv6_src[4];
ovs_be32 ipv6_dst[4];
uint8_t ipv6_proto;
uint8_t ipv6_tos;
};
-struct odp_key_tcp {
+struct ovs_key_tcp {
ovs_be16 tcp_src;
ovs_be16 tcp_dst;
};
-struct odp_key_udp {
+struct ovs_key_udp {
ovs_be16 udp_src;
ovs_be16 udp_dst;
};
-struct odp_key_icmp {
+struct ovs_key_icmp {
uint8_t icmp_type;
uint8_t icmp_code;
};
-struct odp_key_icmpv6 {
+struct ovs_key_icmpv6 {
uint8_t icmpv6_type;
uint8_t icmpv6_code;
};
-struct odp_key_arp {
+struct ovs_key_arp {
ovs_be32 arp_sip;
ovs_be32 arp_tip;
ovs_be16 arp_op;
uint8_t arp_tha[6];
};
-struct odp_key_nd {
+struct ovs_key_nd {
uint32_t nd_target[4];
uint8_t nd_sll[6];
uint8_t nd_tll[6];
};
/**
- * enum odp_flow_attr - attributes for %ODP_FLOW_* commands.
- * @ODP_FLOW_ATTR_KEY: Nested %ODP_KEY_ATTR_* attributes specifying the flow
+ * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
+ * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
* key. Always present in notifications. Required for all requests (except
* dumps).
- * @ODP_FLOW_ATTR_ACTIONS: Nested %ODP_ACTION_ATTR_* attributes specifying
+ * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
* the actions to take for packets that match the key. Always present in
- * notifications. Required for %ODP_FLOW_CMD_NEW requests, optional
- * on %ODP_FLOW_CMD_SET request to change the existing actions, ignored for
+ * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional
+ * on %OVS_FLOW_CMD_SET request to change the existing actions, ignored for
* other requests.
- * @ODP_FLOW_ATTR_STATS: &struct odp_flow_stats giving statistics for this
+ * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
* flow. Present in notifications if the stats would be nonzero. Ignored in
* requests.
- * @ODP_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
+ * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
* TCP flags seen on packets in this flow. Only present in notifications for
* TCP flows, and only if it would be nonzero. Ignored in requests.
- * @ODP_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
+ * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
* the system monotonic clock, at which a packet was last processed for this
* flow. Only present in notifications if a packet has been processed for this
* flow. Ignored in requests.
- * @ODP_FLOW_ATTR_CLEAR: If present in a %ODP_FLOW_CMD_SET request, clears the
+ * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
* last-used time, accumulated TCP flags, and statistics for this flow.
* Otherwise ignored in requests. Never present in notifications.
*
- * These attributes follow the &struct odp_header within the Generic Netlink
- * payload for %ODP_FLOW_* commands.
+ * These attributes follow the &struct ovs_header within the Generic Netlink
+ * payload for %OVS_FLOW_* commands.
*/
-enum odp_flow_attr {
- ODP_FLOW_ATTR_UNSPEC,
- ODP_FLOW_ATTR_KEY, /* Sequence of ODP_KEY_ATTR_* attributes. */
- ODP_FLOW_ATTR_ACTIONS, /* Nested ODP_ACTION_ATTR_* attributes. */
- ODP_FLOW_ATTR_STATS, /* struct odp_flow_stats. */
- ODP_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
- ODP_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
- ODP_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
- __ODP_FLOW_ATTR_MAX
+enum ovs_flow_attr {
+ OVS_FLOW_ATTR_UNSPEC,
+ OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
+ OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
+ OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
+ OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
+ OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
+ OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
+ __OVS_FLOW_ATTR_MAX
};
-#define ODP_FLOW_ATTR_MAX (__ODP_FLOW_ATTR_MAX - 1)
+#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
/* Action types. */
-enum odp_action_type {
- ODP_ACTION_ATTR_UNSPEC,
- ODP_ACTION_ATTR_OUTPUT, /* Output to switch port. */
- ODP_ACTION_ATTR_USERSPACE, /* Send copy to userspace. */
- 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. */
- ODP_ACTION_ATTR_SET_DL_DST, /* Ethernet destination address. */
- ODP_ACTION_ATTR_SET_NW_SRC, /* IPv4 source address. */
- ODP_ACTION_ATTR_SET_NW_DST, /* IPv4 destination address. */
- ODP_ACTION_ATTR_SET_NW_TOS, /* IP ToS/DSCP field (6 bits). */
- ODP_ACTION_ATTR_SET_TP_SRC, /* TCP/UDP source port. */
- ODP_ACTION_ATTR_SET_TP_DST, /* TCP/UDP destination port. */
- ODP_ACTION_ATTR_SET_TUNNEL, /* Set the encapsulating tunnel ID. */
- ODP_ACTION_ATTR_SET_PRIORITY, /* Set skb->priority. */
- ODP_ACTION_ATTR_POP_PRIORITY, /* Restore original skb->priority. */
- __ODP_ACTION_ATTR_MAX
+enum ovs_action_type {
+ OVS_ACTION_ATTR_UNSPEC,
+ OVS_ACTION_ATTR_OUTPUT, /* Output to switch port. */
+ OVS_ACTION_ATTR_USERSPACE, /* Send copy to userspace. */
+ OVS_ACTION_ATTR_SET_DL_TCI, /* Set the 802.1q TCI value. */
+ OVS_ACTION_ATTR_STRIP_VLAN, /* Strip the 802.1q header. */
+ OVS_ACTION_ATTR_SET_DL_SRC, /* Ethernet source address. */
+ OVS_ACTION_ATTR_SET_DL_DST, /* Ethernet destination address. */
+ OVS_ACTION_ATTR_SET_NW_SRC, /* IPv4 source address. */
+ OVS_ACTION_ATTR_SET_NW_DST, /* IPv4 destination address. */
+ OVS_ACTION_ATTR_SET_NW_TOS, /* IP ToS/DSCP field (6 bits). */
+ OVS_ACTION_ATTR_SET_TP_SRC, /* TCP/UDP source port. */
+ OVS_ACTION_ATTR_SET_TP_DST, /* TCP/UDP destination port. */
+ OVS_ACTION_ATTR_SET_TUNNEL, /* Set the encapsulating tunnel ID. */
+ OVS_ACTION_ATTR_SET_PRIORITY, /* Set skb->priority. */
+ OVS_ACTION_ATTR_POP_PRIORITY, /* Restore original skb->priority. */
+ __OVS_ACTION_ATTR_MAX
};
-#define ODP_ACTION_ATTR_MAX (__ODP_ACTION_ATTR_MAX - 1)
+#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
#endif /* openvswitch/datapath-protocol.h */
#include <linux/types.h>
#include "openvswitch/datapath-protocol.h"
-/* ODP_VPORT_ATTR_OPTIONS attributes for tunnels.
+/* OVS_VPORT_ATTR_OPTIONS attributes for tunnels.
*
- * ODP_TUNNEL_ATTR_FLAGS and ODP_TUNNEL_ATTR_DST_IPV4 are required. All other
+ * OVS_TUNNEL_ATTR_FLAGS and OVS_TUNNEL_ATTR_DST_IPV4 are required. All other
* attributes are optional.
*/
enum {
- ODP_TUNNEL_ATTR_UNSPEC,
- ODP_TUNNEL_ATTR_FLAGS, /* 32-bit TNL_F_*. */
- ODP_TUNNEL_ATTR_DST_IPV4, /* IPv4 destination address. */
- ODP_TUNNEL_ATTR_SRC_IPV4, /* IPv4 source address. */
- ODP_TUNNEL_ATTR_OUT_KEY, /* __be64 key to use on output. */
- ODP_TUNNEL_ATTR_IN_KEY, /* __be64 key to match on input. */
- ODP_TUNNEL_ATTR_TOS, /* 8-bit TOS value. */
- ODP_TUNNEL_ATTR_TTL, /* 8-bit TTL value. */
- __ODP_TUNNEL_ATTR_MAX
+ OVS_TUNNEL_ATTR_UNSPEC,
+ OVS_TUNNEL_ATTR_FLAGS, /* 32-bit TNL_F_*. */
+ OVS_TUNNEL_ATTR_DST_IPV4, /* IPv4 destination address. */
+ OVS_TUNNEL_ATTR_SRC_IPV4, /* IPv4 source address. */
+ OVS_TUNNEL_ATTR_OUT_KEY, /* __be64 key to use on output. */
+ OVS_TUNNEL_ATTR_IN_KEY, /* __be64 key to match on input. */
+ OVS_TUNNEL_ATTR_TOS, /* 8-bit TOS value. */
+ OVS_TUNNEL_ATTR_TTL, /* 8-bit TTL value. */
+ __OVS_TUNNEL_ATTR_MAX
};
-#define ODP_TUNNEL_ATTR_MAX (__ODP_TUNNEL_ATTR_MAX - 1)
+#define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1)
#define TNL_F_CSUM (1 << 0) /* Checksum packets. */
#define TNL_F_TOS_INHERIT (1 << 1) /* Inherit the ToS from the inner packet. */
/* Generic Netlink header. */
uint8_t cmd;
- /* struct odp_header. */
+ /* struct ovs_header. */
int dp_ifindex;
/* Attributes. */
- const char *name; /* ODP_DP_ATTR_NAME. */
- struct odp_stats stats; /* ODP_DP_ATTR_STATS. */
- enum odp_frag_handling ipv4_frags; /* ODP_DP_ATTR_IPV4_FRAGS. */
- const uint32_t *sampling; /* ODP_DP_ATTR_SAMPLING. */
- uint32_t mcgroups[DPIF_N_UC_TYPES]; /* ODP_DP_ATTR_MCGROUPS. */
+ const char *name; /* OVS_DP_ATTR_NAME. */
+ struct ovs_dp_stats stats; /* OVS_DP_ATTR_STATS. */
+ enum ovs_frag_handling ipv4_frags; /* OVS_DP_ATTR_IPV4_FRAGS. */
+ const uint32_t *sampling; /* OVS_DP_ATTR_SAMPLING. */
+ uint32_t mcgroups[DPIF_N_UC_TYPES]; /* OVS_DP_ATTR_MCGROUPS. */
};
static void dpif_linux_dp_init(struct dpif_linux_dp *);
/* Generic Netlink header. */
uint8_t cmd;
- /* struct odp_header. */
+ /* struct ovs_header. */
unsigned int nlmsg_flags;
int dp_ifindex;
* aligned on 32-bit boundaries, so get_unaligned_u64() should be used to
* access their values.
*
- * If 'actions' is nonnull then ODP_FLOW_ATTR_ACTIONS will be included in
+ * If 'actions' is nonnull then OVS_FLOW_ATTR_ACTIONS will be included in
* the Netlink version of the command, even if actions_len is zero. */
- const struct nlattr *key; /* ODP_FLOW_ATTR_KEY. */
+ const struct nlattr *key; /* OVS_FLOW_ATTR_KEY. */
size_t key_len;
- const struct nlattr *actions; /* ODP_FLOW_ATTR_ACTIONS. */
+ const struct nlattr *actions; /* OVS_FLOW_ATTR_ACTIONS. */
size_t actions_len;
- const struct odp_flow_stats *stats; /* ODP_FLOW_ATTR_STATS. */
- const uint8_t *tcp_flags; /* ODP_FLOW_ATTR_TCP_FLAGS. */
- const uint64_t *used; /* ODP_FLOW_ATTR_USED. */
- bool clear; /* ODP_FLOW_ATTR_CLEAR. */
+ const struct ovs_flow_stats *stats; /* OVS_FLOW_ATTR_STATS. */
+ const uint8_t *tcp_flags; /* OVS_FLOW_ATTR_TCP_FLAGS. */
+ const uint64_t *used; /* OVS_FLOW_ATTR_USED. */
+ bool clear; /* OVS_FLOW_ATTR_CLEAR. */
};
static void dpif_linux_flow_init(struct dpif_linux_flow *);
static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5);
-/* Generic Netlink family numbers for ODP. */
-static int odp_datapath_family;
-static int odp_vport_family;
-static int odp_flow_family;
-static int odp_packet_family;
+/* Generic Netlink family numbers for OVS. */
+static int ovs_datapath_family;
+static int ovs_vport_family;
+static int ovs_flow_family;
+static int ovs_packet_family;
/* Generic Netlink socket. */
static struct nl_sock *genl_sock;
/* Create or look up datapath. */
dpif_linux_dp_init(&dp_request);
- dp_request.cmd = create ? ODP_DP_CMD_NEW : ODP_DP_CMD_GET;
+ dp_request.cmd = create ? OVS_DP_CMD_NEW : OVS_DP_CMD_GET;
dp_request.name = name;
error = dpif_linux_dp_transact(&dp_request, &dp, &buf);
if (error) {
dpif->lru_head = dpif->lru_tail = 0;
dpif->lru_bitmap = bitmap_allocate(LRU_MAX_PORTS);
- bitmap_set1(dpif->lru_bitmap, ODPP_LOCAL);
+ bitmap_set1(dpif->lru_bitmap, OVSP_LOCAL);
for (i = 1; i < LRU_MAX_PORTS; i++) {
dpif_linux_push_port(dpif, i);
}
struct dpif_linux_dp dp;
dpif_linux_dp_init(&dp);
- dp.cmd = ODP_DP_CMD_DEL;
+ dp.cmd = OVS_DP_CMD_DEL;
dp.dp_ifindex = dpif->dp_ifindex;
return dpif_linux_dp_transact(&dp, NULL, NULL);
}
static int
-dpif_linux_get_stats(const struct dpif *dpif_, struct odp_stats *stats)
+dpif_linux_get_stats(const struct dpif *dpif_, struct ovs_dp_stats *stats)
{
struct dpif_linux_dp dp;
struct ofpbuf *buf;
error = dpif_linux_dp_get(dpif_, &dp, &buf);
if (!error) {
- *drop_fragsp = dp.ipv4_frags == ODP_DP_FRAG_DROP;
+ *drop_fragsp = dp.ipv4_frags == OVS_DP_FRAG_DROP;
ofpbuf_delete(buf);
}
return error;
struct dpif_linux_dp dp;
dpif_linux_dp_init(&dp);
- dp.cmd = ODP_DP_CMD_SET;
+ dp.cmd = OVS_DP_CMD_SET;
dp.dp_ifindex = dpif->dp_ifindex;
- dp.ipv4_frags = drop_frags ? ODP_DP_FRAG_DROP : ODP_DP_FRAG_ZERO;
+ dp.ipv4_frags = drop_frags ? OVS_DP_FRAG_DROP : OVS_DP_FRAG_ZERO;
return dpif_linux_dp_transact(&dp, NULL, NULL);
}
int error;
dpif_linux_vport_init(&request);
- request.cmd = ODP_VPORT_CMD_NEW;
+ request.cmd = OVS_VPORT_CMD_NEW;
request.dp_ifindex = dpif->dp_ifindex;
request.type = netdev_vport_get_vport_type(netdev);
- if (request.type == ODP_VPORT_TYPE_UNSPEC) {
+ if (request.type == OVS_VPORT_TYPE_UNSPEC) {
VLOG_WARN_RL(&error_rl, "%s: cannot create port `%s' because it has "
"unsupported type `%s'",
dpif_name(dpif_), name, type);
int error;
dpif_linux_vport_init(&vport);
- vport.cmd = ODP_VPORT_CMD_DEL;
+ vport.cmd = OVS_VPORT_CMD_DEL;
vport.dp_ifindex = dpif->dp_ifindex;
vport.port_no = port_no;
error = dpif_linux_vport_transact(&vport, NULL, NULL);
int error;
dpif_linux_vport_init(&request);
- request.cmd = ODP_VPORT_CMD_GET;
+ request.cmd = OVS_VPORT_CMD_GET;
request.dp_ifindex = dpif_linux_cast(dpif)->dp_ifindex;
request.port_no = port_no;
request.name = port_name;
struct dpif_linux_flow flow;
dpif_linux_flow_init(&flow);
- flow.cmd = ODP_FLOW_CMD_DEL;
+ flow.cmd = OVS_FLOW_CMD_DEL;
flow.dp_ifindex = dpif->dp_ifindex;
return dpif_linux_flow_transact(&flow, NULL, NULL);
}
state->complete = false;
dpif_linux_vport_init(&request);
- request.cmd = ODP_DP_CMD_GET;
+ request.cmd = OVS_DP_CMD_GET;
request.dp_ifindex = dpif->dp_ifindex;
buf = ofpbuf_new(1024);
struct dpif_linux_flow request;
dpif_linux_flow_init(&request);
- request.cmd = ODP_FLOW_CMD_GET;
+ request.cmd = OVS_FLOW_CMD_GET;
request.dp_ifindex = dpif->dp_ifindex;
request.key = key;
request.key_len = key_len;
int error;
dpif_linux_flow_init(&request);
- request.cmd = flags & DPIF_FP_CREATE ? ODP_FLOW_CMD_NEW : ODP_FLOW_CMD_SET;
+ request.cmd = flags & DPIF_FP_CREATE ? OVS_FLOW_CMD_NEW : OVS_FLOW_CMD_SET;
request.dp_ifindex = dpif->dp_ifindex;
request.key = key;
request.key_len = key_len;
- /* Ensure that ODP_FLOW_ATTR_ACTIONS will always be included. */
+ /* Ensure that OVS_FLOW_ATTR_ACTIONS will always be included. */
request.actions = actions ? actions : &dummy_action;
request.actions_len = actions_len;
if (flags & DPIF_FP_ZERO_STATS) {
int error;
dpif_linux_flow_init(&request);
- request.cmd = ODP_FLOW_CMD_DEL;
+ request.cmd = OVS_FLOW_CMD_DEL;
request.dp_ifindex = dpif->dp_ifindex;
request.key = key;
request.key_len = key_len;
*statep = state = xmalloc(sizeof *state);
dpif_linux_flow_init(&request);
- request.cmd = ODP_DP_CMD_GET;
+ request.cmd = OVS_DP_CMD_GET;
request.dp_ifindex = dpif->dp_ifindex;
buf = ofpbuf_new(1024);
const struct nlattr *actions, size_t actions_len,
const struct ofpbuf *packet)
{
- struct odp_header *execute;
+ struct ovs_header *execute;
struct ofpbuf *buf;
int error;
buf = ofpbuf_new(128 + actions_len + packet->size);
- nl_msg_put_genlmsghdr(buf, 0, odp_packet_family, NLM_F_REQUEST,
- ODP_PACKET_CMD_EXECUTE, 1);
+ nl_msg_put_genlmsghdr(buf, 0, ovs_packet_family, NLM_F_REQUEST,
+ OVS_PACKET_CMD_EXECUTE, 1);
execute = ofpbuf_put_uninit(buf, sizeof *execute);
execute->dp_ifindex = dp_ifindex;
- nl_msg_put_unspec(buf, ODP_PACKET_ATTR_PACKET, packet->data, packet->size);
- nl_msg_put_unspec(buf, ODP_PACKET_ATTR_KEY, key, key_len);
- nl_msg_put_unspec(buf, ODP_PACKET_ATTR_ACTIONS, actions, actions_len);
+ nl_msg_put_unspec(buf, OVS_PACKET_ATTR_PACKET, packet->data, packet->size);
+ nl_msg_put_unspec(buf, OVS_PACKET_ATTR_KEY, key, key_len);
+ nl_msg_put_unspec(buf, OVS_PACKET_ATTR_ACTIONS, actions, actions_len);
error = nl_sock_transact(genl_sock, buf, NULL);
ofpbuf_delete(buf);
struct dpif_linux_dp dp;
dpif_linux_dp_init(&dp);
- dp.cmd = ODP_DP_CMD_SET;
+ dp.cmd = OVS_DP_CMD_SET;
dp.dp_ifindex = dpif->dp_ifindex;
dp.sampling = &probability;
return dpif_linux_dp_transact(&dp, NULL, NULL);
parse_odp_packet(struct ofpbuf *buf, struct dpif_upcall *upcall,
int *dp_ifindex)
{
- static const struct nl_policy odp_packet_policy[] = {
+ static const struct nl_policy ovs_packet_policy[] = {
/* Always present. */
- [ODP_PACKET_ATTR_PACKET] = { .type = NL_A_UNSPEC,
+ [OVS_PACKET_ATTR_PACKET] = { .type = NL_A_UNSPEC,
.min_len = ETH_HEADER_LEN },
- [ODP_PACKET_ATTR_KEY] = { .type = NL_A_NESTED },
+ [OVS_PACKET_ATTR_KEY] = { .type = NL_A_NESTED },
- /* ODP_PACKET_CMD_ACTION only. */
- [ODP_PACKET_ATTR_USERDATA] = { .type = NL_A_U64, .optional = true },
+ /* OVS_PACKET_CMD_ACTION only. */
+ [OVS_PACKET_ATTR_USERDATA] = { .type = NL_A_U64, .optional = true },
- /* ODP_PACKET_CMD_SAMPLE only. */
- [ODP_PACKET_ATTR_SAMPLE_POOL] = { .type = NL_A_U32, .optional = true },
- [ODP_PACKET_ATTR_ACTIONS] = { .type = NL_A_NESTED, .optional = true },
+ /* OVS_PACKET_CMD_SAMPLE only. */
+ [OVS_PACKET_ATTR_SAMPLE_POOL] = { .type = NL_A_U32, .optional = true },
+ [OVS_PACKET_ATTR_ACTIONS] = { .type = NL_A_NESTED, .optional = true },
};
- struct odp_header *odp_header;
- struct nlattr *a[ARRAY_SIZE(odp_packet_policy)];
+ struct ovs_header *ovs_header;
+ struct nlattr *a[ARRAY_SIZE(ovs_packet_policy)];
struct nlmsghdr *nlmsg;
struct genlmsghdr *genl;
struct ofpbuf b;
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
- odp_header = ofpbuf_try_pull(&b, sizeof *odp_header);
- if (!nlmsg || !genl || !odp_header
- || nlmsg->nlmsg_type != odp_packet_family
- || !nl_policy_parse(&b, 0, odp_packet_policy, a,
- ARRAY_SIZE(odp_packet_policy))) {
+ ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
+ if (!nlmsg || !genl || !ovs_header
+ || nlmsg->nlmsg_type != ovs_packet_family
+ || !nl_policy_parse(&b, 0, ovs_packet_policy, a,
+ ARRAY_SIZE(ovs_packet_policy))) {
return EINVAL;
}
- type = (genl->cmd == ODP_PACKET_CMD_MISS ? DPIF_UC_MISS
- : genl->cmd == ODP_PACKET_CMD_ACTION ? DPIF_UC_ACTION
- : genl->cmd == ODP_PACKET_CMD_SAMPLE ? DPIF_UC_SAMPLE
+ type = (genl->cmd == OVS_PACKET_CMD_MISS ? DPIF_UC_MISS
+ : genl->cmd == OVS_PACKET_CMD_ACTION ? DPIF_UC_ACTION
+ : genl->cmd == OVS_PACKET_CMD_SAMPLE ? DPIF_UC_SAMPLE
: -1);
if (type < 0) {
return EINVAL;
memset(upcall, 0, sizeof *upcall);
upcall->type = type;
upcall->packet = buf;
- upcall->packet->data = (void *) nl_attr_get(a[ODP_PACKET_ATTR_PACKET]);
- upcall->packet->size = nl_attr_get_size(a[ODP_PACKET_ATTR_PACKET]);
- upcall->key = (void *) nl_attr_get(a[ODP_PACKET_ATTR_KEY]);
- upcall->key_len = nl_attr_get_size(a[ODP_PACKET_ATTR_KEY]);
- upcall->userdata = (a[ODP_PACKET_ATTR_USERDATA]
- ? nl_attr_get_u64(a[ODP_PACKET_ATTR_USERDATA])
+ upcall->packet->data = (void *) nl_attr_get(a[OVS_PACKET_ATTR_PACKET]);
+ upcall->packet->size = nl_attr_get_size(a[OVS_PACKET_ATTR_PACKET]);
+ upcall->key = (void *) nl_attr_get(a[OVS_PACKET_ATTR_KEY]);
+ upcall->key_len = nl_attr_get_size(a[OVS_PACKET_ATTR_KEY]);
+ upcall->userdata = (a[OVS_PACKET_ATTR_USERDATA]
+ ? nl_attr_get_u64(a[OVS_PACKET_ATTR_USERDATA])
: 0);
- upcall->sample_pool = (a[ODP_PACKET_ATTR_SAMPLE_POOL]
- ? nl_attr_get_u32(a[ODP_PACKET_ATTR_SAMPLE_POOL])
+ upcall->sample_pool = (a[OVS_PACKET_ATTR_SAMPLE_POOL]
+ ? nl_attr_get_u32(a[OVS_PACKET_ATTR_SAMPLE_POOL])
: 0);
- if (a[ODP_PACKET_ATTR_ACTIONS]) {
- upcall->actions = (void *) nl_attr_get(a[ODP_PACKET_ATTR_ACTIONS]);
- upcall->actions_len = nl_attr_get_size(a[ODP_PACKET_ATTR_ACTIONS]);
+ if (a[OVS_PACKET_ATTR_ACTIONS]) {
+ upcall->actions = (void *) nl_attr_get(a[OVS_PACKET_ATTR_ACTIONS]);
+ upcall->actions_len = nl_attr_get_size(a[OVS_PACKET_ATTR_ACTIONS]);
}
- *dp_ifindex = odp_header->dp_ifindex;
+ *dp_ifindex = ovs_header->dp_ifindex;
return 0;
}
static int error = -1;
if (error < 0) {
- error = nl_lookup_genl_family(ODP_DATAPATH_FAMILY,
- &odp_datapath_family);
+ error = nl_lookup_genl_family(OVS_DATAPATH_FAMILY,
+ &ovs_datapath_family);
if (error) {
VLOG_ERR("Generic Netlink family '%s' does not exist. "
"The Open vSwitch kernel module is probably not loaded.",
- ODP_DATAPATH_FAMILY);
+ OVS_DATAPATH_FAMILY);
}
if (!error) {
- error = nl_lookup_genl_family(ODP_VPORT_FAMILY, &odp_vport_family);
+ error = nl_lookup_genl_family(OVS_VPORT_FAMILY, &ovs_vport_family);
}
if (!error) {
- error = nl_lookup_genl_family(ODP_FLOW_FAMILY, &odp_flow_family);
+ error = nl_lookup_genl_family(OVS_FLOW_FAMILY, &ovs_flow_family);
}
if (!error) {
- error = nl_lookup_genl_family(ODP_PACKET_FAMILY,
- &odp_packet_family);
+ error = nl_lookup_genl_family(OVS_PACKET_FAMILY,
+ &ovs_packet_family);
}
if (!error) {
error = nl_sock_create(NETLINK_GENERIC, &genl_sock);
name, strerror(error));
}
- return reply.type == ODP_VPORT_TYPE_INTERNAL;
+ return reply.type == OVS_VPORT_TYPE_INTERNAL;
}
int
odp_flow_key_from_flow(&key, &flow);
ofpbuf_use_stack(&actions, &action, sizeof action);
- nl_msg_put_u32(&actions, ODP_ACTION_ATTR_OUTPUT, port_no);
+ nl_msg_put_u32(&actions, OVS_ACTION_ATTR_OUTPUT, port_no);
return dpif_linux_execute__(dp_ifindex, key.data, key.size,
actions.data, actions.size, &packet);
}
}
\f
-/* Parses the contents of 'buf', which contains a "struct odp_header" followed
+/* Parses the contents of 'buf', which contains a "struct ovs_header" followed
* by Netlink attributes, into 'vport'. Returns 0 if successful, otherwise a
* positive errno value.
*
dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport,
const struct ofpbuf *buf)
{
- static const struct nl_policy odp_vport_policy[] = {
- [ODP_VPORT_ATTR_PORT_NO] = { .type = NL_A_U32 },
- [ODP_VPORT_ATTR_TYPE] = { .type = NL_A_U32 },
- [ODP_VPORT_ATTR_NAME] = { .type = NL_A_STRING, .max_len = IFNAMSIZ },
- [ODP_VPORT_ATTR_STATS] = { .type = NL_A_UNSPEC,
+ static const struct nl_policy ovs_vport_policy[] = {
+ [OVS_VPORT_ATTR_PORT_NO] = { .type = NL_A_U32 },
+ [OVS_VPORT_ATTR_TYPE] = { .type = NL_A_U32 },
+ [OVS_VPORT_ATTR_NAME] = { .type = NL_A_STRING, .max_len = IFNAMSIZ },
+ [OVS_VPORT_ATTR_STATS] = { .type = NL_A_UNSPEC,
.min_len = sizeof(struct rtnl_link_stats64),
.max_len = sizeof(struct rtnl_link_stats64),
.optional = true },
- [ODP_VPORT_ATTR_ADDRESS] = { .type = NL_A_UNSPEC,
+ [OVS_VPORT_ATTR_ADDRESS] = { .type = NL_A_UNSPEC,
.min_len = ETH_ADDR_LEN,
.max_len = ETH_ADDR_LEN,
.optional = true },
- [ODP_VPORT_ATTR_MTU] = { .type = NL_A_U32, .optional = true },
- [ODP_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true },
- [ODP_VPORT_ATTR_IFINDEX] = { .type = NL_A_U32, .optional = true },
- [ODP_VPORT_ATTR_IFLINK] = { .type = NL_A_U32, .optional = true },
+ [OVS_VPORT_ATTR_MTU] = { .type = NL_A_U32, .optional = true },
+ [OVS_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true },
+ [OVS_VPORT_ATTR_IFINDEX] = { .type = NL_A_U32, .optional = true },
+ [OVS_VPORT_ATTR_IFLINK] = { .type = NL_A_U32, .optional = true },
};
- struct nlattr *a[ARRAY_SIZE(odp_vport_policy)];
- struct odp_header *odp_header;
+ struct nlattr *a[ARRAY_SIZE(ovs_vport_policy)];
+ struct ovs_header *ovs_header;
struct nlmsghdr *nlmsg;
struct genlmsghdr *genl;
struct ofpbuf b;
ofpbuf_use_const(&b, buf->data, buf->size);
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
- odp_header = ofpbuf_try_pull(&b, sizeof *odp_header);
- if (!nlmsg || !genl || !odp_header
- || nlmsg->nlmsg_type != odp_vport_family
- || !nl_policy_parse(&b, 0, odp_vport_policy, a,
- ARRAY_SIZE(odp_vport_policy))) {
+ ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
+ if (!nlmsg || !genl || !ovs_header
+ || nlmsg->nlmsg_type != ovs_vport_family
+ || !nl_policy_parse(&b, 0, ovs_vport_policy, a,
+ ARRAY_SIZE(ovs_vport_policy))) {
return EINVAL;
}
vport->cmd = genl->cmd;
- vport->dp_ifindex = odp_header->dp_ifindex;
- vport->port_no = nl_attr_get_u32(a[ODP_VPORT_ATTR_PORT_NO]);
- vport->type = nl_attr_get_u32(a[ODP_VPORT_ATTR_TYPE]);
- vport->name = nl_attr_get_string(a[ODP_VPORT_ATTR_NAME]);
- if (a[ODP_VPORT_ATTR_STATS]) {
- vport->stats = nl_attr_get(a[ODP_VPORT_ATTR_STATS]);
- }
- if (a[ODP_VPORT_ATTR_ADDRESS]) {
- vport->address = nl_attr_get(a[ODP_VPORT_ATTR_ADDRESS]);
- }
- if (a[ODP_VPORT_ATTR_MTU]) {
- vport->mtu = nl_attr_get_u32(a[ODP_VPORT_ATTR_MTU]);
+ vport->dp_ifindex = ovs_header->dp_ifindex;
+ vport->port_no = nl_attr_get_u32(a[OVS_VPORT_ATTR_PORT_NO]);
+ vport->type = nl_attr_get_u32(a[OVS_VPORT_ATTR_TYPE]);
+ vport->name = nl_attr_get_string(a[OVS_VPORT_ATTR_NAME]);
+ if (a[OVS_VPORT_ATTR_STATS]) {
+ vport->stats = nl_attr_get(a[OVS_VPORT_ATTR_STATS]);
+ }
+ if (a[OVS_VPORT_ATTR_ADDRESS]) {
+ vport->address = nl_attr_get(a[OVS_VPORT_ATTR_ADDRESS]);
+ }
+ if (a[OVS_VPORT_ATTR_MTU]) {
+ vport->mtu = nl_attr_get_u32(a[OVS_VPORT_ATTR_MTU]);
} else {
vport->mtu = INT_MAX;
}
- if (a[ODP_VPORT_ATTR_OPTIONS]) {
- vport->options = nl_attr_get(a[ODP_VPORT_ATTR_OPTIONS]);
- vport->options_len = nl_attr_get_size(a[ODP_VPORT_ATTR_OPTIONS]);
+ if (a[OVS_VPORT_ATTR_OPTIONS]) {
+ vport->options = nl_attr_get(a[OVS_VPORT_ATTR_OPTIONS]);
+ vport->options_len = nl_attr_get_size(a[OVS_VPORT_ATTR_OPTIONS]);
}
- if (a[ODP_VPORT_ATTR_IFINDEX]) {
- vport->ifindex = nl_attr_get_u32(a[ODP_VPORT_ATTR_IFINDEX]);
+ if (a[OVS_VPORT_ATTR_IFINDEX]) {
+ vport->ifindex = nl_attr_get_u32(a[OVS_VPORT_ATTR_IFINDEX]);
}
- if (a[ODP_VPORT_ATTR_IFLINK]) {
- vport->iflink = nl_attr_get_u32(a[ODP_VPORT_ATTR_IFLINK]);
+ if (a[OVS_VPORT_ATTR_IFLINK]) {
+ vport->iflink = nl_attr_get_u32(a[OVS_VPORT_ATTR_IFLINK]);
}
return 0;
}
-/* Appends to 'buf' (which must initially be empty) a "struct odp_header"
+/* Appends to 'buf' (which must initially be empty) a "struct ovs_header"
* followed by Netlink attributes corresponding to 'vport'. */
static void
dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *vport,
struct ofpbuf *buf)
{
- struct odp_header *odp_header;
+ struct ovs_header *ovs_header;
- nl_msg_put_genlmsghdr(buf, 0, odp_vport_family, NLM_F_REQUEST | NLM_F_ECHO,
+ nl_msg_put_genlmsghdr(buf, 0, ovs_vport_family, NLM_F_REQUEST | NLM_F_ECHO,
vport->cmd, 1);
- odp_header = ofpbuf_put_uninit(buf, sizeof *odp_header);
- odp_header->dp_ifindex = vport->dp_ifindex;
+ ovs_header = ofpbuf_put_uninit(buf, sizeof *ovs_header);
+ ovs_header->dp_ifindex = vport->dp_ifindex;
if (vport->port_no != UINT32_MAX) {
- nl_msg_put_u32(buf, ODP_VPORT_ATTR_PORT_NO, vport->port_no);
+ nl_msg_put_u32(buf, OVS_VPORT_ATTR_PORT_NO, vport->port_no);
}
- if (vport->type != ODP_VPORT_TYPE_UNSPEC) {
- nl_msg_put_u32(buf, ODP_VPORT_ATTR_TYPE, vport->type);
+ if (vport->type != OVS_VPORT_TYPE_UNSPEC) {
+ nl_msg_put_u32(buf, OVS_VPORT_ATTR_TYPE, vport->type);
}
if (vport->name) {
- nl_msg_put_string(buf, ODP_VPORT_ATTR_NAME, vport->name);
+ nl_msg_put_string(buf, OVS_VPORT_ATTR_NAME, vport->name);
}
if (vport->stats) {
- nl_msg_put_unspec(buf, ODP_VPORT_ATTR_STATS,
+ nl_msg_put_unspec(buf, OVS_VPORT_ATTR_STATS,
vport->stats, sizeof *vport->stats);
}
if (vport->address) {
- nl_msg_put_unspec(buf, ODP_VPORT_ATTR_ADDRESS,
+ nl_msg_put_unspec(buf, OVS_VPORT_ATTR_ADDRESS,
vport->address, ETH_ADDR_LEN);
}
if (vport->mtu && vport->mtu != INT_MAX) {
- nl_msg_put_u32(buf, ODP_VPORT_ATTR_MTU, vport->mtu);
+ nl_msg_put_u32(buf, OVS_VPORT_ATTR_MTU, vport->mtu);
}
if (vport->options) {
- nl_msg_put_nested(buf, ODP_VPORT_ATTR_OPTIONS,
+ nl_msg_put_nested(buf, OVS_VPORT_ATTR_OPTIONS,
vport->options, vport->options_len);
}
if (vport->ifindex) {
- nl_msg_put_u32(buf, ODP_VPORT_ATTR_IFINDEX, vport->ifindex);
+ nl_msg_put_u32(buf, OVS_VPORT_ATTR_IFINDEX, vport->ifindex);
}
if (vport->iflink) {
- nl_msg_put_u32(buf, ODP_VPORT_ATTR_IFLINK, vport->iflink);
+ nl_msg_put_u32(buf, OVS_VPORT_ATTR_IFLINK, vport->iflink);
}
}
/* Executes 'request' in the kernel datapath. If the command fails, returns a
* positive errno value. Otherwise, if 'reply' and 'bufp' are null, returns 0
* without doing anything else. If 'reply' and 'bufp' are nonnull, then the
- * result of the command is expected to be an odp_vport also, which is decoded
+ * result of the command is expected to be an ovs_vport also, which is decoded
* and stored in '*reply' and '*bufp'. The caller must free '*bufp' when the
* reply is no longer needed ('reply' will contain pointers into '*bufp'). */
int
struct dpif_linux_vport request;
dpif_linux_vport_init(&request);
- request.cmd = ODP_VPORT_CMD_GET;
+ request.cmd = OVS_VPORT_CMD_GET;
request.name = name;
return dpif_linux_vport_transact(&request, reply, bufp);
}
\f
-/* Parses the contents of 'buf', which contains a "struct odp_header" followed
+/* Parses the contents of 'buf', which contains a "struct ovs_header" followed
* by Netlink attributes, into 'dp'. Returns 0 if successful, otherwise a
* positive errno value.
*
static int
dpif_linux_dp_from_ofpbuf(struct dpif_linux_dp *dp, const struct ofpbuf *buf)
{
- static const struct nl_policy odp_datapath_policy[] = {
- [ODP_DP_ATTR_NAME] = { .type = NL_A_STRING, .max_len = IFNAMSIZ },
- [ODP_DP_ATTR_STATS] = { .type = NL_A_UNSPEC,
- .min_len = sizeof(struct odp_stats),
- .max_len = sizeof(struct odp_stats),
+ static const struct nl_policy ovs_datapath_policy[] = {
+ [OVS_DP_ATTR_NAME] = { .type = NL_A_STRING, .max_len = IFNAMSIZ },
+ [OVS_DP_ATTR_STATS] = { .type = NL_A_UNSPEC,
+ .min_len = sizeof(struct ovs_dp_stats),
+ .max_len = sizeof(struct ovs_dp_stats),
.optional = true },
- [ODP_DP_ATTR_IPV4_FRAGS] = { .type = NL_A_U32, .optional = true },
- [ODP_DP_ATTR_SAMPLING] = { .type = NL_A_U32, .optional = true },
- [ODP_DP_ATTR_MCGROUPS] = { .type = NL_A_NESTED, .optional = true },
+ [OVS_DP_ATTR_IPV4_FRAGS] = { .type = NL_A_U32, .optional = true },
+ [OVS_DP_ATTR_SAMPLING] = { .type = NL_A_U32, .optional = true },
+ [OVS_DP_ATTR_MCGROUPS] = { .type = NL_A_NESTED, .optional = true },
};
- struct nlattr *a[ARRAY_SIZE(odp_datapath_policy)];
- struct odp_header *odp_header;
+ struct nlattr *a[ARRAY_SIZE(ovs_datapath_policy)];
+ struct ovs_header *ovs_header;
struct nlmsghdr *nlmsg;
struct genlmsghdr *genl;
struct ofpbuf b;
ofpbuf_use_const(&b, buf->data, buf->size);
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
- odp_header = ofpbuf_try_pull(&b, sizeof *odp_header);
- if (!nlmsg || !genl || !odp_header
- || nlmsg->nlmsg_type != odp_datapath_family
- || !nl_policy_parse(&b, 0, odp_datapath_policy, a,
- ARRAY_SIZE(odp_datapath_policy))) {
+ ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
+ if (!nlmsg || !genl || !ovs_header
+ || nlmsg->nlmsg_type != ovs_datapath_family
+ || !nl_policy_parse(&b, 0, ovs_datapath_policy, a,
+ ARRAY_SIZE(ovs_datapath_policy))) {
return EINVAL;
}
dp->cmd = genl->cmd;
- dp->dp_ifindex = odp_header->dp_ifindex;
- dp->name = nl_attr_get_string(a[ODP_DP_ATTR_NAME]);
- if (a[ODP_DP_ATTR_STATS]) {
+ dp->dp_ifindex = ovs_header->dp_ifindex;
+ dp->name = nl_attr_get_string(a[OVS_DP_ATTR_NAME]);
+ if (a[OVS_DP_ATTR_STATS]) {
/* Can't use structure assignment because Netlink doesn't ensure
* sufficient alignment for 64-bit members. */
- memcpy(&dp->stats, nl_attr_get(a[ODP_DP_ATTR_STATS]),
+ memcpy(&dp->stats, nl_attr_get(a[OVS_DP_ATTR_STATS]),
sizeof dp->stats);
}
- if (a[ODP_DP_ATTR_IPV4_FRAGS]) {
- dp->ipv4_frags = nl_attr_get_u32(a[ODP_DP_ATTR_IPV4_FRAGS]);
+ if (a[OVS_DP_ATTR_IPV4_FRAGS]) {
+ dp->ipv4_frags = nl_attr_get_u32(a[OVS_DP_ATTR_IPV4_FRAGS]);
}
- if (a[ODP_DP_ATTR_SAMPLING]) {
- dp->sampling = nl_attr_get(a[ODP_DP_ATTR_SAMPLING]);
+ if (a[OVS_DP_ATTR_SAMPLING]) {
+ dp->sampling = nl_attr_get(a[OVS_DP_ATTR_SAMPLING]);
}
- if (a[ODP_DP_ATTR_MCGROUPS]) {
- static const struct nl_policy odp_mcgroup_policy[] = {
- [ODP_PACKET_CMD_MISS] = { .type = NL_A_U32, .optional = true },
- [ODP_PACKET_CMD_ACTION] = { .type = NL_A_U32, .optional = true },
- [ODP_PACKET_CMD_SAMPLE] = { .type = NL_A_U32, .optional = true },
+ if (a[OVS_DP_ATTR_MCGROUPS]) {
+ static const struct nl_policy ovs_mcgroup_policy[] = {
+ [OVS_PACKET_CMD_MISS] = { .type = NL_A_U32, .optional = true },
+ [OVS_PACKET_CMD_ACTION] = { .type = NL_A_U32, .optional = true },
+ [OVS_PACKET_CMD_SAMPLE] = { .type = NL_A_U32, .optional = true },
};
- struct nlattr *mcgroups[ARRAY_SIZE(odp_mcgroup_policy)];
+ struct nlattr *mcgroups[ARRAY_SIZE(ovs_mcgroup_policy)];
- if (!nl_parse_nested(a[ODP_DP_ATTR_MCGROUPS], odp_mcgroup_policy,
- mcgroups, ARRAY_SIZE(odp_mcgroup_policy))) {
+ if (!nl_parse_nested(a[OVS_DP_ATTR_MCGROUPS], ovs_mcgroup_policy,
+ mcgroups, ARRAY_SIZE(ovs_mcgroup_policy))) {
return EINVAL;
}
- if (mcgroups[ODP_PACKET_CMD_MISS]) {
+ if (mcgroups[OVS_PACKET_CMD_MISS]) {
dp->mcgroups[DPIF_UC_MISS]
- = nl_attr_get_u32(mcgroups[ODP_PACKET_CMD_MISS]);
+ = nl_attr_get_u32(mcgroups[OVS_PACKET_CMD_MISS]);
}
- if (mcgroups[ODP_PACKET_CMD_ACTION]) {
+ if (mcgroups[OVS_PACKET_CMD_ACTION]) {
dp->mcgroups[DPIF_UC_ACTION]
- = nl_attr_get_u32(mcgroups[ODP_PACKET_CMD_ACTION]);
+ = nl_attr_get_u32(mcgroups[OVS_PACKET_CMD_ACTION]);
}
- if (mcgroups[ODP_PACKET_CMD_SAMPLE]) {
+ if (mcgroups[OVS_PACKET_CMD_SAMPLE]) {
dp->mcgroups[DPIF_UC_SAMPLE]
- = nl_attr_get_u32(mcgroups[ODP_PACKET_CMD_SAMPLE]);
+ = nl_attr_get_u32(mcgroups[OVS_PACKET_CMD_SAMPLE]);
}
}
static void
dpif_linux_dp_to_ofpbuf(const struct dpif_linux_dp *dp, struct ofpbuf *buf)
{
- struct odp_header *odp_header;
+ struct ovs_header *ovs_header;
- nl_msg_put_genlmsghdr(buf, 0, odp_datapath_family,
+ nl_msg_put_genlmsghdr(buf, 0, ovs_datapath_family,
NLM_F_REQUEST | NLM_F_ECHO, dp->cmd, 1);
- odp_header = ofpbuf_put_uninit(buf, sizeof *odp_header);
- odp_header->dp_ifindex = dp->dp_ifindex;
+ ovs_header = ofpbuf_put_uninit(buf, sizeof *ovs_header);
+ ovs_header->dp_ifindex = dp->dp_ifindex;
if (dp->name) {
- nl_msg_put_string(buf, ODP_DP_ATTR_NAME, dp->name);
+ nl_msg_put_string(buf, OVS_DP_ATTR_NAME, dp->name);
}
- /* Skip ODP_DP_ATTR_STATS since we never have a reason to serialize it. */
+ /* Skip OVS_DP_ATTR_STATS since we never have a reason to serialize it. */
if (dp->ipv4_frags) {
- nl_msg_put_u32(buf, ODP_DP_ATTR_IPV4_FRAGS, dp->ipv4_frags);
+ nl_msg_put_u32(buf, OVS_DP_ATTR_IPV4_FRAGS, dp->ipv4_frags);
}
if (dp->sampling) {
- nl_msg_put_u32(buf, ODP_DP_ATTR_SAMPLING, *dp->sampling);
+ nl_msg_put_u32(buf, OVS_DP_ATTR_SAMPLING, *dp->sampling);
}
}
struct ofpbuf *buf;
dpif_linux_dp_init(&request);
- request.cmd = ODP_DP_CMD_GET;
+ request.cmd = OVS_DP_CMD_GET;
buf = ofpbuf_new(1024);
dpif_linux_dp_to_ofpbuf(&request, buf);
struct dpif_linux_dp request;
dpif_linux_dp_init(&request);
- request.cmd = ODP_DP_CMD_GET;
+ request.cmd = OVS_DP_CMD_GET;
request.dp_ifindex = dpif->dp_ifindex;
return dpif_linux_dp_transact(&request, reply, bufp);
}
\f
-/* Parses the contents of 'buf', which contains a "struct odp_header" followed
+/* Parses the contents of 'buf', which contains a "struct ovs_header" followed
* by Netlink attributes, into 'flow'. Returns 0 if successful, otherwise a
* positive errno value.
*
dpif_linux_flow_from_ofpbuf(struct dpif_linux_flow *flow,
const struct ofpbuf *buf)
{
- static const struct nl_policy odp_flow_policy[] = {
- [ODP_FLOW_ATTR_KEY] = { .type = NL_A_NESTED },
- [ODP_FLOW_ATTR_ACTIONS] = { .type = NL_A_NESTED, .optional = true },
- [ODP_FLOW_ATTR_STATS] = { .type = NL_A_UNSPEC,
- .min_len = sizeof(struct odp_flow_stats),
- .max_len = sizeof(struct odp_flow_stats),
+ static const struct nl_policy ovs_flow_policy[] = {
+ [OVS_FLOW_ATTR_KEY] = { .type = NL_A_NESTED },
+ [OVS_FLOW_ATTR_ACTIONS] = { .type = NL_A_NESTED, .optional = true },
+ [OVS_FLOW_ATTR_STATS] = { .type = NL_A_UNSPEC,
+ .min_len = sizeof(struct ovs_flow_stats),
+ .max_len = sizeof(struct ovs_flow_stats),
.optional = true },
- [ODP_FLOW_ATTR_TCP_FLAGS] = { .type = NL_A_U8, .optional = true },
- [ODP_FLOW_ATTR_USED] = { .type = NL_A_U64, .optional = true },
- /* The kernel never uses ODP_FLOW_ATTR_CLEAR. */
+ [OVS_FLOW_ATTR_TCP_FLAGS] = { .type = NL_A_U8, .optional = true },
+ [OVS_FLOW_ATTR_USED] = { .type = NL_A_U64, .optional = true },
+ /* The kernel never uses OVS_FLOW_ATTR_CLEAR. */
};
- struct nlattr *a[ARRAY_SIZE(odp_flow_policy)];
- struct odp_header *odp_header;
+ struct nlattr *a[ARRAY_SIZE(ovs_flow_policy)];
+ struct ovs_header *ovs_header;
struct nlmsghdr *nlmsg;
struct genlmsghdr *genl;
struct ofpbuf b;
ofpbuf_use_const(&b, buf->data, buf->size);
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
- odp_header = ofpbuf_try_pull(&b, sizeof *odp_header);
- if (!nlmsg || !genl || !odp_header
- || nlmsg->nlmsg_type != odp_flow_family
- || !nl_policy_parse(&b, 0, odp_flow_policy, a,
- ARRAY_SIZE(odp_flow_policy))) {
+ ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
+ if (!nlmsg || !genl || !ovs_header
+ || nlmsg->nlmsg_type != ovs_flow_family
+ || !nl_policy_parse(&b, 0, ovs_flow_policy, a,
+ ARRAY_SIZE(ovs_flow_policy))) {
return EINVAL;
}
flow->nlmsg_flags = nlmsg->nlmsg_flags;
- flow->dp_ifindex = odp_header->dp_ifindex;
- flow->key = nl_attr_get(a[ODP_FLOW_ATTR_KEY]);
- flow->key_len = nl_attr_get_size(a[ODP_FLOW_ATTR_KEY]);
- if (a[ODP_FLOW_ATTR_ACTIONS]) {
- flow->actions = nl_attr_get(a[ODP_FLOW_ATTR_ACTIONS]);
- flow->actions_len = nl_attr_get_size(a[ODP_FLOW_ATTR_ACTIONS]);
+ flow->dp_ifindex = ovs_header->dp_ifindex;
+ flow->key = nl_attr_get(a[OVS_FLOW_ATTR_KEY]);
+ flow->key_len = nl_attr_get_size(a[OVS_FLOW_ATTR_KEY]);
+ if (a[OVS_FLOW_ATTR_ACTIONS]) {
+ flow->actions = nl_attr_get(a[OVS_FLOW_ATTR_ACTIONS]);
+ flow->actions_len = nl_attr_get_size(a[OVS_FLOW_ATTR_ACTIONS]);
}
- if (a[ODP_FLOW_ATTR_STATS]) {
- flow->stats = nl_attr_get(a[ODP_FLOW_ATTR_STATS]);
+ if (a[OVS_FLOW_ATTR_STATS]) {
+ flow->stats = nl_attr_get(a[OVS_FLOW_ATTR_STATS]);
}
- if (a[ODP_FLOW_ATTR_TCP_FLAGS]) {
- flow->tcp_flags = nl_attr_get(a[ODP_FLOW_ATTR_TCP_FLAGS]);
+ if (a[OVS_FLOW_ATTR_TCP_FLAGS]) {
+ flow->tcp_flags = nl_attr_get(a[OVS_FLOW_ATTR_TCP_FLAGS]);
}
- if (a[ODP_FLOW_ATTR_USED]) {
- flow->used = nl_attr_get(a[ODP_FLOW_ATTR_USED]);
+ if (a[OVS_FLOW_ATTR_USED]) {
+ flow->used = nl_attr_get(a[OVS_FLOW_ATTR_USED]);
}
return 0;
}
-/* Appends to 'buf' (which must initially be empty) a "struct odp_header"
+/* Appends to 'buf' (which must initially be empty) a "struct ovs_header"
* followed by Netlink attributes corresponding to 'flow'. */
static void
dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow *flow,
struct ofpbuf *buf)
{
- struct odp_header *odp_header;
+ struct ovs_header *ovs_header;
- nl_msg_put_genlmsghdr(buf, 0, odp_flow_family,
+ nl_msg_put_genlmsghdr(buf, 0, ovs_flow_family,
NLM_F_REQUEST | NLM_F_ECHO | flow->nlmsg_flags,
flow->cmd, 1);
- odp_header = ofpbuf_put_uninit(buf, sizeof *odp_header);
- odp_header->dp_ifindex = flow->dp_ifindex;
+ ovs_header = ofpbuf_put_uninit(buf, sizeof *ovs_header);
+ ovs_header->dp_ifindex = flow->dp_ifindex;
if (flow->key_len) {
- nl_msg_put_unspec(buf, ODP_FLOW_ATTR_KEY, flow->key, flow->key_len);
+ nl_msg_put_unspec(buf, OVS_FLOW_ATTR_KEY, flow->key, flow->key_len);
}
if (flow->actions || flow->actions_len) {
- nl_msg_put_unspec(buf, ODP_FLOW_ATTR_ACTIONS,
+ nl_msg_put_unspec(buf, OVS_FLOW_ATTR_ACTIONS,
flow->actions, flow->actions_len);
}
assert(!flow->used);
if (flow->clear) {
- nl_msg_put_flag(buf, ODP_FLOW_ATTR_CLEAR);
+ nl_msg_put_flag(buf, OVS_FLOW_ATTR_CLEAR);
}
}
/* Generic Netlink header. */
uint8_t cmd;
- /* odp_vport header. */
+ /* ovs_vport header. */
int dp_ifindex;
uint32_t port_no; /* UINT32_MAX if unknown. */
- enum odp_vport_type type;
+ enum ovs_vport_type type;
/* Attributes. */
- const char *name; /* ODP_VPORT_ATTR_NAME. */
- const struct rtnl_link_stats64 *stats; /* ODP_VPORT_ATTR_STATS. */
- const uint8_t *address; /* ODP_VPORT_ATTR_ADDRESS. */
- int mtu; /* ODP_VPORT_ATTR_MTU. */
- const struct nlattr *options; /* ODP_VPORT_ATTR_OPTIONS. */
+ const char *name; /* OVS_VPORT_ATTR_NAME. */
+ const struct rtnl_link_stats64 *stats; /* OVS_VPORT_ATTR_STATS. */
+ const uint8_t *address; /* OVS_VPORT_ATTR_ADDRESS. */
+ int mtu; /* OVS_VPORT_ATTR_MTU. */
+ const struct nlattr *options; /* OVS_VPORT_ATTR_OPTIONS. */
size_t options_len;
- int ifindex; /* ODP_VPORT_ATTR_IFINDEX. */
- int iflink; /* ODP_VPORT_ATTR_IFLINK. */
+ int ifindex; /* OVS_VPORT_ATTR_IFINDEX. */
+ int iflink; /* OVS_VPORT_ATTR_IFLINK. */
};
void dpif_linux_vport_init(struct dpif_linux_vport *);
}
hmap_init(&dp->flow_table);
list_init(&dp->port_list);
- error = do_add_port(dp, name, "internal", ODPP_LOCAL);
+ error = do_add_port(dp, name, "internal", OVSP_LOCAL);
if (error) {
dp_netdev_free(dp);
return error;
}
static int
-dpif_netdev_get_stats(const struct dpif *dpif, struct odp_stats *stats)
+dpif_netdev_get_stats(const struct dpif *dpif, struct ovs_dp_stats *stats)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
memset(stats, 0, sizeof *stats);
dpif_netdev_port_del(struct dpif *dpif, uint16_t port_no)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
- return port_no == ODPP_LOCAL ? EINVAL : do_del_port(dp, port_no);
+ return port_no == OVSP_LOCAL ? EINVAL : do_del_port(dp, port_no);
}
static bool
}
switch (type) {
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
if (nl_attr_get_u32(a) >= MAX_PORTS) {
return EINVAL;
}
break;
- case ODP_ACTION_ATTR_USERSPACE:
+ case OVS_ACTION_ATTR_USERSPACE:
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
*mutates = true;
if (nl_attr_get_be16(a) & htons(VLAN_CFI)) {
return EINVAL;
}
break;
- case ODP_ACTION_ATTR_SET_NW_TOS:
+ case OVS_ACTION_ATTR_SET_NW_TOS:
*mutates = true;
if (nl_attr_get_u8(a) & IP_ECN_MASK) {
return EINVAL;
}
break;
- case ODP_ACTION_ATTR_STRIP_VLAN:
- case ODP_ACTION_ATTR_SET_DL_SRC:
- case ODP_ACTION_ATTR_SET_DL_DST:
- case ODP_ACTION_ATTR_SET_NW_SRC:
- case ODP_ACTION_ATTR_SET_NW_DST:
- case ODP_ACTION_ATTR_SET_TP_SRC:
- case ODP_ACTION_ATTR_SET_TP_DST:
+ case OVS_ACTION_ATTR_STRIP_VLAN:
+ case OVS_ACTION_ATTR_SET_DL_SRC:
+ case OVS_ACTION_ATTR_SET_DL_DST:
+ case OVS_ACTION_ATTR_SET_NW_SRC:
+ case OVS_ACTION_ATTR_SET_NW_DST:
+ case OVS_ACTION_ATTR_SET_TP_SRC:
+ case OVS_ACTION_ATTR_SET_TP_DST:
*mutates = true;
break;
- case ODP_ACTION_ATTR_SET_TUNNEL:
- case ODP_ACTION_ATTR_SET_PRIORITY:
- case ODP_ACTION_ATTR_POP_PRIORITY:
+ case OVS_ACTION_ATTR_SET_TUNNEL:
+ case OVS_ACTION_ATTR_SET_PRIORITY:
+ case OVS_ACTION_ATTR_POP_PRIORITY:
default:
return EOPNOTSUPP;
}
uint16_t type = nl_attr_type(a);
ovs_be32 *field;
- field = type == ODP_ACTION_ATTR_SET_NW_SRC ? &nh->ip_src : &nh->ip_dst;
+ field = type == OVS_ACTION_ATTR_SET_NW_SRC ? &nh->ip_src : &nh->ip_dst;
if (key->nw_proto == IPPROTO_TCP && packet->l7) {
struct tcp_header *th = packet->l4;
th->tcp_csum = recalc_csum32(th->tcp_csum, *field, ip);
if (key->nw_proto == IPPROTO_TCP && packet->l7) {
struct tcp_header *th = packet->l4;
- field = (type == ODP_ACTION_ATTR_SET_TP_SRC
+ field = (type == OVS_ACTION_ATTR_SET_TP_SRC
? &th->tcp_src : &th->tcp_dst);
th->tcp_csum = recalc_csum16(th->tcp_csum, *field, port);
*field = port;
} else if (key->nw_proto == IPPROTO_UDP && packet->l7) {
struct udp_header *uh = packet->l4;
- field = (type == ODP_ACTION_ATTR_SET_TP_SRC
+ field = (type == OVS_ACTION_ATTR_SET_TP_SRC
? &uh->udp_src : &uh->udp_dst);
uh->udp_csum = recalc_csum16(uh->udp_csum, *field, port);
*field = port;
NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
switch (nl_attr_type(a)) {
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
dp_netdev_output_port(dp, packet, nl_attr_get_u32(a));
break;
- case ODP_ACTION_ATTR_USERSPACE:
+ case OVS_ACTION_ATTR_USERSPACE:
dp_netdev_output_userspace(dp, packet, DPIF_UC_ACTION,
key, nl_attr_get_u64(a));
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
eth_set_vlan_tci(packet, nl_attr_get_be16(a));
break;
- case ODP_ACTION_ATTR_STRIP_VLAN:
+ case OVS_ACTION_ATTR_STRIP_VLAN:
dp_netdev_strip_vlan(packet);
break;
- case ODP_ACTION_ATTR_SET_DL_SRC:
+ case OVS_ACTION_ATTR_SET_DL_SRC:
dp_netdev_set_dl_src(packet, nl_attr_get_unspec(a, ETH_ADDR_LEN));
break;
- case ODP_ACTION_ATTR_SET_DL_DST:
+ case OVS_ACTION_ATTR_SET_DL_DST:
dp_netdev_set_dl_dst(packet, nl_attr_get_unspec(a, ETH_ADDR_LEN));
break;
- case ODP_ACTION_ATTR_SET_NW_SRC:
- case ODP_ACTION_ATTR_SET_NW_DST:
+ case OVS_ACTION_ATTR_SET_NW_SRC:
+ case OVS_ACTION_ATTR_SET_NW_DST:
dp_netdev_set_nw_addr(packet, key, a);
break;
- case ODP_ACTION_ATTR_SET_NW_TOS:
+ case OVS_ACTION_ATTR_SET_NW_TOS:
dp_netdev_set_nw_tos(packet, key, nl_attr_get_u8(a));
break;
- case ODP_ACTION_ATTR_SET_TP_SRC:
- case ODP_ACTION_ATTR_SET_TP_DST:
+ case OVS_ACTION_ATTR_SET_TP_SRC:
+ case OVS_ACTION_ATTR_SET_TP_DST:
dp_netdev_set_tp_port(packet, key, a);
break;
}
void (*wait)(struct dpif *dpif);
/* Retrieves statistics for 'dpif' into 'stats'. */
- int (*get_stats)(const struct dpif *dpif, struct odp_stats *stats);
+ int (*get_stats)(const struct dpif *dpif, struct ovs_dp_stats *stats);
/* Retrieves 'dpif''s current treatment of IP fragments into '*drop_frags':
* true indicates that fragments are dropped, false indicates that
void (*port_poll_wait)(const struct dpif *dpif);
/* Queries 'dpif' for a flow entry. The flow is specified by the Netlink
- * attributes with types ODP_KEY_ATTR_* in the 'key_len' bytes starting at
+ * attributes with types OVS_KEY_ATTR_* in the 'key_len' bytes starting at
* 'key'.
*
* Returns 0 if successful. If no flow matches, returns ENOENT. On other
struct ofpbuf **actionsp, struct dpif_flow_stats *stats);
/* Adds or modifies a flow in 'dpif'. The flow is specified by the Netlink
- * attributes with types ODP_KEY_ATTR_* in the 'key_len' bytes starting at
+ * attributes with types OVS_KEY_ATTR_* in the 'key_len' bytes starting at
* 'key'. The associated actions are specified by the Netlink attributes
- * with types ODP_ACTION_ATTR_* in the 'actions_len' bytes starting at
+ * with types OVS_ACTION_ATTR_* in the 'actions_len' bytes starting at
* 'actions'.
*
* - If the flow's key does not exist in 'dpif', then the flow will be
/* Deletes a flow from 'dpif' and returns 0, or returns ENOENT if 'dpif'
* does not contain such a flow. The flow is specified by the Netlink
- * attributes with types ODP_KEY_ATTR_* in the 'key_len' bytes starting at
+ * attributes with types OVS_KEY_ATTR_* in the 'key_len' bytes starting at
* 'key'.
*
* If the operation succeeds, then 'stats', if nonnull, must be set to the
* 'flow_dump_done' function will be called afterward).
*
* On success, if 'key' and 'key_len' are nonnull then '*key' and
- * '*key_len' must be set to Netlink attributes with types ODP_KEY_ATTR_*
+ * '*key_len' must be set to Netlink attributes with types OVS_KEY_ATTR_*
* representing the dumped flow's key. If 'actions' and 'actions_len' are
* nonnull then they should be set to Netlink attributes with types
- * ODP_ACTION_ATTR_* representing the dumped flow's actions. If 'stats'
+ * OVS_ACTION_ATTR_* representing the dumped flow's actions. If 'stats'
* is nonnull then it should be set to the dumped flow's statistics.
*
* All of the returned data is owned by 'dpif', not by the caller, and the
int (*set_sflow_probability)(struct dpif *dpif, uint32_t probability);
/* Translates OpenFlow queue ID 'queue_id' (in host byte order) into a
- * priority value for use in the ODP_ACTION_ATTR_SET_PRIORITY action in
+ * priority value for use in the OVS_ACTION_ATTR_SET_PRIORITY action in
* '*priority'. */
int (*queue_to_priority)(const struct dpif *dpif, uint32_t queue_id,
uint32_t *priority);
/* Retrieves statistics for 'dpif' into 'stats'. Returns 0 if successful,
* otherwise a positive errno value. */
int
-dpif_get_dp_stats(const struct dpif *dpif, struct odp_stats *stats)
+dpif_get_dp_stats(const struct dpif *dpif, struct ovs_dp_stats *stats)
{
int error = dpif->dpif_class->get_stats(dpif, stats);
if (error) {
}
/* Queries 'dpif' for a flow entry. The flow is specified by the Netlink
- * attributes with types ODP_KEY_ATTR_* in the 'key_len' bytes starting at
+ * attributes with types OVS_KEY_ATTR_* in the 'key_len' bytes starting at
* 'key'.
*
* Returns 0 if successful. If no flow matches, returns ENOENT. On other
}
/* Adds or modifies a flow in 'dpif'. The flow is specified by the Netlink
- * attributes with types ODP_KEY_ATTR_* in the 'key_len' bytes starting at
+ * attributes with types OVS_KEY_ATTR_* in the 'key_len' bytes starting at
* 'key'. The associated actions are specified by the Netlink attributes with
- * types ODP_ACTION_ATTR_* in the 'actions_len' bytes starting at 'actions'.
+ * types OVS_ACTION_ATTR_* in the 'actions_len' bytes starting at 'actions'.
*
* - If the flow's key does not exist in 'dpif', then the flow will be added if
* 'flags' includes DPIF_FP_CREATE. Otherwise the operation will fail with
/* Deletes a flow from 'dpif' and returns 0, or returns ENOENT if 'dpif' does
* not contain such a flow. The flow is specified by the Netlink attributes
- * with types ODP_KEY_ATTR_* in the 'key_len' bytes starting at 'key'.
+ * with types OVS_KEY_ATTR_* in the 'key_len' bytes starting at 'key'.
*
* If the operation succeeds, then 'stats', if nonnull, will be set to the
* flow's statistics before its deletion. */
* completed by calling dpif_flow_dump_done().
*
* On success, if 'key' and 'key_len' are nonnull then '*key' and '*key_len'
- * will be set to Netlink attributes with types ODP_KEY_ATTR_* representing the
+ * will be set to Netlink attributes with types OVS_KEY_ATTR_* representing the
* dumped flow's key. If 'actions' and 'actions_len' are nonnull then they are
- * set to Netlink attributes with types ODP_ACTION_ATTR_* representing the
+ * set to Netlink attributes with types OVS_ACTION_ATTR_* representing the
* dumped flow's actions. If 'stats' is nonnull then it will be set to the
* dumped flow's statistics.
*
}
/* Translates OpenFlow queue ID 'queue_id' (in host byte order) into a priority
- * value for use in the ODP_ACTION_ATTR_SET_PRIORITY action. On success,
+ * value for use in the OVS_ACTION_ATTR_SET_PRIORITY action. On success,
* returns 0 and stores the priority into '*priority'. On failure, returns a
* positive errno value and stores 0 into '*priority'. */
int
int dpif_delete(struct dpif *);
-int dpif_get_dp_stats(const struct dpif *, struct odp_stats *);
+int dpif_get_dp_stats(const struct dpif *, struct ovs_dp_stats *);
int dpif_get_drop_frags(const struct dpif *, bool *drop_frags);
int dpif_set_drop_frags(struct dpif *, bool drop_frags);
enum dpif_upcall_type {
DPIF_UC_MISS, /* Miss in flow table. */
- DPIF_UC_ACTION, /* ODP_ACTION_ATTR_USERSPACE action. */
+ DPIF_UC_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
DPIF_UC_SAMPLE, /* Packet sampling. */
DPIF_N_UC_TYPES
};
size_t key_len; /* Length of 'key' in bytes. */
/* DPIF_UC_ACTION only. */
- uint64_t userdata; /* Argument to ODP_ACTION_ATTR_USERSPACE. */
+ uint64_t userdata; /* Argument to OVS_ACTION_ATTR_USERSPACE. */
/* DPIF_UC_SAMPLE only. */
uint32_t sample_pool; /* # of sampling candidate packets so far. */
};
struct vport_class {
- enum odp_vport_type type;
+ enum ovs_vport_type type;
struct netdev_class netdev_class;
int (*parse_config)(const char *name, const char *type,
const struct shash *args, struct ofpbuf *options);
static void netdev_vport_poll_notify(const struct netdev *);
static int tnl_port_config_from_nlattr(const struct nlattr *options,
size_t options_len,
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1]);
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1]);
static const char *netdev_vport_get_tnl_iface(const struct netdev *netdev);
}
/* If 'netdev' is a vport netdev, returns an ofpbuf that contains Netlink
- * options to include in ODP_VPORT_ATTR_OPTIONS for configuring that vport.
+ * options to include in OVS_VPORT_ATTR_OPTIONS for configuring that vport.
* Otherwise returns NULL. */
const struct ofpbuf *
netdev_vport_get_options(const struct netdev *netdev)
: NULL);
}
-enum odp_vport_type
+enum ovs_vport_type
netdev_vport_get_vport_type(const struct netdev *netdev)
{
const struct netdev_dev *dev = netdev_get_dev(netdev);
const struct netdev_class *class = netdev_dev_get_class(dev);
return (is_vport_class(class) ? vport_class_cast(class)->type
- : class == &netdev_internal_class ? ODP_VPORT_TYPE_INTERNAL
- : class == &netdev_linux_class ? ODP_VPORT_TYPE_NETDEV
- : ODP_VPORT_TYPE_UNSPEC);
+ : class == &netdev_internal_class ? OVS_VPORT_TYPE_INTERNAL
+ : class == &netdev_linux_class ? OVS_VPORT_TYPE_NETDEV
+ : OVS_VPORT_TYPE_UNSPEC);
}
const char *
netdev_vport_get_netdev_type(const struct dpif_linux_vport *vport)
{
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1];
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
switch (vport->type) {
- case ODP_VPORT_TYPE_UNSPEC:
+ case OVS_VPORT_TYPE_UNSPEC:
break;
- case ODP_VPORT_TYPE_NETDEV:
+ case OVS_VPORT_TYPE_NETDEV:
return "system";
- case ODP_VPORT_TYPE_INTERNAL:
+ case OVS_VPORT_TYPE_INTERNAL:
return "internal";
- case ODP_VPORT_TYPE_PATCH:
+ case OVS_VPORT_TYPE_PATCH:
return "patch";
- case ODP_VPORT_TYPE_GRE:
+ case OVS_VPORT_TYPE_GRE:
if (tnl_port_config_from_nlattr(vport->options, vport->options_len,
a)) {
break;
}
- return (nl_attr_get_u32(a[ODP_TUNNEL_ATTR_FLAGS]) & TNL_F_IPSEC
+ return (nl_attr_get_u32(a[OVS_TUNNEL_ATTR_FLAGS]) & TNL_F_IPSEC
? "ipsec_gre" : "gre");
- case ODP_VPORT_TYPE_CAPWAP:
+ case OVS_VPORT_TYPE_CAPWAP:
return "capwap";
- case __ODP_VPORT_TYPE_MAX:
+ case __OVS_VPORT_TYPE_MAX:
break;
}
struct dpif_linux_vport vport;
dpif_linux_vport_init(&vport);
- vport.cmd = ODP_VPORT_CMD_SET;
+ vport.cmd = OVS_VPORT_CMD_SET;
vport.name = name;
vport.options = options->data;
vport.options_len = options->size;
int error;
dpif_linux_vport_init(&vport);
- vport.cmd = ODP_VPORT_CMD_SET;
+ vport.cmd = OVS_VPORT_CMD_SET;
vport.name = netdev_get_name(netdev);
vport.address = mac;
netdev_stats_to_rtnl_link_stats64(&rtnl_stats, stats);
dpif_linux_vport_init(&vport);
- vport.cmd = ODP_VPORT_CMD_SET;
+ vport.cmd = OVS_VPORT_CMD_SET;
vport.name = netdev_get_name(netdev);
vport.stats = &rtnl_stats;
static const char *
netdev_vport_get_tnl_iface(const struct netdev *netdev)
{
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1];
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
ovs_be32 route;
struct netdev_dev_vport *ndv;
static char name[IFNAMSIZ];
a)) {
return NULL;
}
- route = nl_attr_get_be32(a[ODP_TUNNEL_ATTR_DST_IPV4]);
+ route = nl_attr_get_be32(a[OVS_TUNNEL_ATTR_DST_IPV4]);
if (route_table_get_name(route, name)) {
return name;
if (lookup_ip(node->data, &in_addr)) {
VLOG_WARN("%s: bad %s 'local_ip'", name, type);
} else {
- nl_msg_put_be32(options, ODP_TUNNEL_ATTR_SRC_IPV4,
+ nl_msg_put_be32(options, OVS_TUNNEL_ATTR_SRC_IPV4,
in_addr.s_addr);
}
} else if (!strcmp(node->name, "tos")) {
if (!strcmp(node->data, "inherit")) {
flags |= TNL_F_TOS_INHERIT;
} else {
- nl_msg_put_u8(options, ODP_TUNNEL_ATTR_TOS, atoi(node->data));
+ nl_msg_put_u8(options, OVS_TUNNEL_ATTR_TOS, atoi(node->data));
}
} else if (!strcmp(node->name, "ttl")) {
if (!strcmp(node->data, "inherit")) {
flags |= TNL_F_TTL_INHERIT;
} else {
- nl_msg_put_u8(options, ODP_TUNNEL_ATTR_TTL, atoi(node->data));
+ nl_msg_put_u8(options, OVS_TUNNEL_ATTR_TTL, atoi(node->data));
}
} else if (!strcmp(node->name, "csum") && is_gre) {
if (!strcmp(node->data, "true")) {
}
if (is_gre) {
- set_key(args, "in_key", ODP_TUNNEL_ATTR_IN_KEY, options);
- set_key(args, "out_key", ODP_TUNNEL_ATTR_OUT_KEY, options);
+ set_key(args, "in_key", OVS_TUNNEL_ATTR_IN_KEY, options);
+ set_key(args, "out_key", OVS_TUNNEL_ATTR_OUT_KEY, options);
}
if (!daddr) {
name, type);
return EINVAL;
}
- nl_msg_put_be32(options, ODP_TUNNEL_ATTR_DST_IPV4, daddr);
+ nl_msg_put_be32(options, OVS_TUNNEL_ATTR_DST_IPV4, daddr);
- nl_msg_put_u32(options, ODP_TUNNEL_ATTR_FLAGS, flags);
+ nl_msg_put_u32(options, OVS_TUNNEL_ATTR_FLAGS, flags);
return 0;
}
static int
tnl_port_config_from_nlattr(const struct nlattr *options, size_t options_len,
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1])
-{
- static const struct nl_policy odp_tunnel_policy[] = {
- [ODP_TUNNEL_ATTR_FLAGS] = { .type = NL_A_U32 },
- [ODP_TUNNEL_ATTR_DST_IPV4] = { .type = NL_A_BE32 },
- [ODP_TUNNEL_ATTR_SRC_IPV4] = { .type = NL_A_BE32, .optional = true },
- [ODP_TUNNEL_ATTR_IN_KEY] = { .type = NL_A_BE64, .optional = true },
- [ODP_TUNNEL_ATTR_OUT_KEY] = { .type = NL_A_BE64, .optional = true },
- [ODP_TUNNEL_ATTR_TOS] = { .type = NL_A_U8, .optional = true },
- [ODP_TUNNEL_ATTR_TTL] = { .type = NL_A_U8, .optional = true },
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1])
+{
+ static const struct nl_policy ovs_tunnel_policy[] = {
+ [OVS_TUNNEL_ATTR_FLAGS] = { .type = NL_A_U32 },
+ [OVS_TUNNEL_ATTR_DST_IPV4] = { .type = NL_A_BE32 },
+ [OVS_TUNNEL_ATTR_SRC_IPV4] = { .type = NL_A_BE32, .optional = true },
+ [OVS_TUNNEL_ATTR_IN_KEY] = { .type = NL_A_BE64, .optional = true },
+ [OVS_TUNNEL_ATTR_OUT_KEY] = { .type = NL_A_BE64, .optional = true },
+ [OVS_TUNNEL_ATTR_TOS] = { .type = NL_A_U8, .optional = true },
+ [OVS_TUNNEL_ATTR_TTL] = { .type = NL_A_U8, .optional = true },
};
struct ofpbuf buf;
ofpbuf_use_const(&buf, options, options_len);
- if (!nl_policy_parse(&buf, 0, odp_tunnel_policy,
- a, ARRAY_SIZE(odp_tunnel_policy))) {
+ if (!nl_policy_parse(&buf, 0, ovs_tunnel_policy,
+ a, ARRAY_SIZE(ovs_tunnel_policy))) {
return EINVAL;
}
return 0;
const struct nlattr *options, size_t options_len,
struct shash *args)
{
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1];
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
ovs_be32 daddr;
uint32_t flags;
int error;
return error;
}
- flags = nl_attr_get_u32(a[ODP_TUNNEL_ATTR_FLAGS]);
+ flags = nl_attr_get_u32(a[OVS_TUNNEL_ATTR_FLAGS]);
if (!(flags & TNL_F_HDR_CACHE) == !(flags & TNL_F_IPSEC)) {
smap_add(args, "header_cache",
flags & TNL_F_HDR_CACHE ? "true" : "false");
}
- daddr = nl_attr_get_be32(a[ODP_TUNNEL_ATTR_DST_IPV4]);
+ daddr = nl_attr_get_be32(a[OVS_TUNNEL_ATTR_DST_IPV4]);
shash_add(args, "remote_ip", xasprintf(IP_FMT, IP_ARGS(&daddr)));
- if (a[ODP_TUNNEL_ATTR_SRC_IPV4]) {
- ovs_be32 saddr = nl_attr_get_be32(a[ODP_TUNNEL_ATTR_SRC_IPV4]);
+ if (a[OVS_TUNNEL_ATTR_SRC_IPV4]) {
+ ovs_be32 saddr = nl_attr_get_be32(a[OVS_TUNNEL_ATTR_SRC_IPV4]);
shash_add(args, "local_ip", xasprintf(IP_FMT, IP_ARGS(&saddr)));
}
- if (!a[ODP_TUNNEL_ATTR_IN_KEY] && !a[ODP_TUNNEL_ATTR_OUT_KEY]) {
+ if (!a[OVS_TUNNEL_ATTR_IN_KEY] && !a[OVS_TUNNEL_ATTR_OUT_KEY]) {
smap_add(args, "key", "flow");
} else {
- uint64_t in_key = get_be64_or_zero(a[ODP_TUNNEL_ATTR_IN_KEY]);
- uint64_t out_key = get_be64_or_zero(a[ODP_TUNNEL_ATTR_OUT_KEY]);
+ uint64_t in_key = get_be64_or_zero(a[OVS_TUNNEL_ATTR_IN_KEY]);
+ uint64_t out_key = get_be64_or_zero(a[OVS_TUNNEL_ATTR_OUT_KEY]);
if (in_key && in_key == out_key) {
shash_add(args, "key", xasprintf("%"PRIu64, in_key));
} else {
- if (!a[ODP_TUNNEL_ATTR_IN_KEY]) {
+ if (!a[OVS_TUNNEL_ATTR_IN_KEY]) {
smap_add(args, "in_key", "flow");
} else if (in_key) {
shash_add(args, "in_key", xasprintf("%"PRIu64, in_key));
}
- if (!a[ODP_TUNNEL_ATTR_OUT_KEY]) {
+ if (!a[OVS_TUNNEL_ATTR_OUT_KEY]) {
smap_add(args, "out_key", "flow");
} else if (out_key) {
shash_add(args, "out_key", xasprintf("%"PRIu64, out_key));
if (flags & TNL_F_TTL_INHERIT) {
smap_add(args, "tos", "inherit");
- } else if (a[ODP_TUNNEL_ATTR_TTL]) {
- int ttl = nl_attr_get_u8(a[ODP_TUNNEL_ATTR_TTL]);
+ } else if (a[OVS_TUNNEL_ATTR_TTL]) {
+ int ttl = nl_attr_get_u8(a[OVS_TUNNEL_ATTR_TTL]);
shash_add(args, "tos", xasprintf("%d", ttl));
}
if (flags & TNL_F_TOS_INHERIT) {
smap_add(args, "tos", "inherit");
- } else if (a[ODP_TUNNEL_ATTR_TOS]) {
- int tos = nl_attr_get_u8(a[ODP_TUNNEL_ATTR_TOS]);
+ } else if (a[OVS_TUNNEL_ATTR_TOS]) {
+ int tos = nl_attr_get_u8(a[OVS_TUNNEL_ATTR_TOS]);
shash_add(args, "tos", xasprintf("%d", tos));
}
return EINVAL;
}
- nl_msg_put_string(options, ODP_PATCH_ATTR_PEER, peer);
+ nl_msg_put_string(options, OVS_PATCH_ATTR_PEER, peer);
return 0;
}
const struct nlattr *options, size_t options_len,
struct shash *args)
{
- static const struct nl_policy odp_patch_policy[] = {
- [ODP_PATCH_ATTR_PEER] = { .type = NL_A_STRING,
+ static const struct nl_policy ovs_patch_policy[] = {
+ [OVS_PATCH_ATTR_PEER] = { .type = NL_A_STRING,
.max_len = IFNAMSIZ,
.optional = false }
};
- struct nlattr *a[ARRAY_SIZE(odp_patch_policy)];
+ struct nlattr *a[ARRAY_SIZE(ovs_patch_policy)];
struct ofpbuf buf;
ofpbuf_use_const(&buf, options, options_len);
- if (!nl_policy_parse(&buf, 0, odp_patch_policy,
- a, ARRAY_SIZE(odp_patch_policy))) {
+ if (!nl_policy_parse(&buf, 0, ovs_patch_policy,
+ a, ARRAY_SIZE(ovs_patch_policy))) {
return EINVAL;
}
- smap_add(args, "peer", nl_attr_get_string(a[ODP_PATCH_ATTR_PEER]));
+ smap_add(args, "peer", nl_attr_get_string(a[OVS_PATCH_ATTR_PEER]));
return 0;
}
\f
netdev_vport_register(void)
{
static const struct vport_class vport_classes[] = {
- { ODP_VPORT_TYPE_GRE,
+ { OVS_VPORT_TYPE_GRE,
{ "gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
- { ODP_VPORT_TYPE_GRE,
+ { OVS_VPORT_TYPE_GRE,
{ "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
- { ODP_VPORT_TYPE_CAPWAP,
+ { OVS_VPORT_TYPE_CAPWAP,
{ "capwap", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
- { ODP_VPORT_TYPE_PATCH,
+ { OVS_VPORT_TYPE_PATCH,
{ "patch", VPORT_FUNCTIONS(NULL) },
parse_patch_config, unparse_patch_config }
};
const struct ofpbuf *netdev_vport_get_options(const struct netdev *);
-enum odp_vport_type netdev_vport_get_vport_type(const struct netdev *);
+enum ovs_vport_type netdev_vport_get_vport_type(const struct netdev *);
const char *netdev_vport_get_netdev_type(const struct dpif_linux_vport *);
int netdev_vport_get_stats(const struct netdev *, struct netdev_stats *);
#include "timeval.h"
#include "util.h"
+/* The interface between userspace and kernel uses an "OVS_*" prefix.
+ * Since this is fairly non-specific for the OVS userspace components,
+ * "ODP_*" (Open vSwitch Datapath) is used as the prefix for
+ * interactions with the datapath.
+ */
+
int
odp_action_len(uint16_t type)
{
- if (type > ODP_ACTION_ATTR_MAX) {
+ if (type > OVS_ACTION_ATTR_MAX) {
return -1;
}
- switch ((enum odp_action_type) type) {
- case ODP_ACTION_ATTR_OUTPUT: return 4;
- 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;
- case ODP_ACTION_ATTR_SET_DL_DST: return ETH_ADDR_LEN;
- case ODP_ACTION_ATTR_SET_NW_SRC: return 4;
- case ODP_ACTION_ATTR_SET_NW_DST: return 4;
- case ODP_ACTION_ATTR_SET_NW_TOS: return 1;
- case ODP_ACTION_ATTR_SET_TP_SRC: return 2;
- case ODP_ACTION_ATTR_SET_TP_DST: return 2;
- case ODP_ACTION_ATTR_SET_TUNNEL: return 8;
- case ODP_ACTION_ATTR_SET_PRIORITY: return 4;
- case ODP_ACTION_ATTR_POP_PRIORITY: return 0;
-
- case ODP_ACTION_ATTR_UNSPEC:
- case __ODP_ACTION_ATTR_MAX:
+ switch ((enum ovs_action_type) type) {
+ case OVS_ACTION_ATTR_OUTPUT: return 4;
+ case OVS_ACTION_ATTR_USERSPACE: return 8;
+ case OVS_ACTION_ATTR_SET_DL_TCI: return 2;
+ case OVS_ACTION_ATTR_STRIP_VLAN: return 0;
+ case OVS_ACTION_ATTR_SET_DL_SRC: return ETH_ADDR_LEN;
+ case OVS_ACTION_ATTR_SET_DL_DST: return ETH_ADDR_LEN;
+ case OVS_ACTION_ATTR_SET_NW_SRC: return 4;
+ case OVS_ACTION_ATTR_SET_NW_DST: return 4;
+ case OVS_ACTION_ATTR_SET_NW_TOS: return 1;
+ case OVS_ACTION_ATTR_SET_TP_SRC: return 2;
+ case OVS_ACTION_ATTR_SET_TP_DST: return 2;
+ case OVS_ACTION_ATTR_SET_TUNNEL: return 8;
+ case OVS_ACTION_ATTR_SET_PRIORITY: return 4;
+ case OVS_ACTION_ATTR_POP_PRIORITY: return 0;
+
+ case OVS_ACTION_ATTR_UNSPEC:
+ case __OVS_ACTION_ATTR_MAX:
return -1;
}
}
switch (nl_attr_type(a)) {
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
ds_put_format(ds, "%"PRIu16, nl_attr_get_u32(a));
break;
- case ODP_ACTION_ATTR_USERSPACE:
+ case OVS_ACTION_ATTR_USERSPACE:
ds_put_format(ds, "userspace(%"PRIu64")", nl_attr_get_u64(a));
break;
- case ODP_ACTION_ATTR_SET_TUNNEL:
+ case OVS_ACTION_ATTR_SET_TUNNEL:
ds_put_format(ds, "set_tunnel(%#"PRIx64")",
ntohll(nl_attr_get_be64(a)));
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
ds_put_format(ds, "set_tci(vid=%"PRIu16",pcp=%d)",
vlan_tci_to_vid(nl_attr_get_be16(a)),
vlan_tci_to_pcp(nl_attr_get_be16(a)));
break;
- case ODP_ACTION_ATTR_STRIP_VLAN:
+ case OVS_ACTION_ATTR_STRIP_VLAN:
ds_put_format(ds, "strip_vlan");
break;
- case ODP_ACTION_ATTR_SET_DL_SRC:
+ case OVS_ACTION_ATTR_SET_DL_SRC:
eth = nl_attr_get_unspec(a, ETH_ADDR_LEN);
ds_put_format(ds, "set_dl_src("ETH_ADDR_FMT")", ETH_ADDR_ARGS(eth));
break;
- case ODP_ACTION_ATTR_SET_DL_DST:
+ case OVS_ACTION_ATTR_SET_DL_DST:
eth = nl_attr_get_unspec(a, ETH_ADDR_LEN);
ds_put_format(ds, "set_dl_dst("ETH_ADDR_FMT")", ETH_ADDR_ARGS(eth));
break;
- case ODP_ACTION_ATTR_SET_NW_SRC:
+ case OVS_ACTION_ATTR_SET_NW_SRC:
ip = nl_attr_get_be32(a);
ds_put_format(ds, "set_nw_src("IP_FMT")", IP_ARGS(&ip));
break;
- case ODP_ACTION_ATTR_SET_NW_DST:
+ case OVS_ACTION_ATTR_SET_NW_DST:
ip = nl_attr_get_be32(a);
ds_put_format(ds, "set_nw_dst("IP_FMT")", IP_ARGS(&ip));
break;
- case ODP_ACTION_ATTR_SET_NW_TOS:
+ case OVS_ACTION_ATTR_SET_NW_TOS:
ds_put_format(ds, "set_nw_tos(%"PRIu8")", nl_attr_get_u8(a));
break;
- case ODP_ACTION_ATTR_SET_TP_SRC:
+ case OVS_ACTION_ATTR_SET_TP_SRC:
ds_put_format(ds, "set_tp_src(%"PRIu16")", ntohs(nl_attr_get_be16(a)));
break;
- case ODP_ACTION_ATTR_SET_TP_DST:
+ case OVS_ACTION_ATTR_SET_TP_DST:
ds_put_format(ds, "set_tp_dst(%"PRIu16")", ntohs(nl_attr_get_be16(a)));
break;
- case ODP_ACTION_ATTR_SET_PRIORITY:
+ case OVS_ACTION_ATTR_SET_PRIORITY:
ds_put_format(ds, "set_priority(%#"PRIx32")", nl_attr_get_u32(a));
break;
- case ODP_ACTION_ATTR_POP_PRIORITY:
+ case OVS_ACTION_ATTR_POP_PRIORITY:
ds_put_cstr(ds, "pop_priority");
break;
default:
static int
odp_flow_key_attr_len(uint16_t type)
{
- if (type > ODP_KEY_ATTR_MAX) {
+ if (type > OVS_KEY_ATTR_MAX) {
return -1;
}
- switch ((enum odp_key_type) type) {
- case ODP_KEY_ATTR_TUN_ID: return 8;
- case ODP_KEY_ATTR_IN_PORT: return 4;
- case ODP_KEY_ATTR_ETHERNET: return sizeof(struct odp_key_ethernet);
- case ODP_KEY_ATTR_8021Q: return sizeof(struct odp_key_8021q);
- case ODP_KEY_ATTR_ETHERTYPE: return 2;
- case ODP_KEY_ATTR_IPV4: return sizeof(struct odp_key_ipv4);
- case ODP_KEY_ATTR_IPV6: return sizeof(struct odp_key_ipv6);
- case ODP_KEY_ATTR_TCP: return sizeof(struct odp_key_tcp);
- case ODP_KEY_ATTR_UDP: return sizeof(struct odp_key_udp);
- case ODP_KEY_ATTR_ICMP: return sizeof(struct odp_key_icmp);
- case ODP_KEY_ATTR_ICMPV6: return sizeof(struct odp_key_icmpv6);
- case ODP_KEY_ATTR_ARP: return sizeof(struct odp_key_arp);
- case ODP_KEY_ATTR_ND: return sizeof(struct odp_key_nd);
-
- case ODP_KEY_ATTR_UNSPEC:
- case __ODP_KEY_ATTR_MAX:
+ switch ((enum ovs_key_type) type) {
+ case OVS_KEY_ATTR_TUN_ID: return 8;
+ case OVS_KEY_ATTR_IN_PORT: return 4;
+ case OVS_KEY_ATTR_ETHERNET: return sizeof(struct ovs_key_ethernet);
+ case OVS_KEY_ATTR_8021Q: return sizeof(struct ovs_key_8021q);
+ case OVS_KEY_ATTR_ETHERTYPE: return 2;
+ case OVS_KEY_ATTR_IPV4: return sizeof(struct ovs_key_ipv4);
+ case OVS_KEY_ATTR_IPV6: return sizeof(struct ovs_key_ipv6);
+ case OVS_KEY_ATTR_TCP: return sizeof(struct ovs_key_tcp);
+ case OVS_KEY_ATTR_UDP: return sizeof(struct ovs_key_udp);
+ case OVS_KEY_ATTR_ICMP: return sizeof(struct ovs_key_icmp);
+ case OVS_KEY_ATTR_ICMPV6: return sizeof(struct ovs_key_icmpv6);
+ case OVS_KEY_ATTR_ARP: return sizeof(struct ovs_key_arp);
+ case OVS_KEY_ATTR_ND: return sizeof(struct ovs_key_nd);
+
+ case OVS_KEY_ATTR_UNSPEC:
+ case __OVS_KEY_ATTR_MAX:
return -1;
}
static void
format_odp_key_attr(const struct nlattr *a, struct ds *ds)
{
- const struct odp_key_ethernet *eth_key;
- const struct odp_key_8021q *q_key;
- const struct odp_key_ipv4 *ipv4_key;
- const struct odp_key_ipv6 *ipv6_key;
- const struct odp_key_tcp *tcp_key;
- const struct odp_key_udp *udp_key;
- const struct odp_key_icmp *icmp_key;
- const struct odp_key_icmpv6 *icmpv6_key;
- const struct odp_key_arp *arp_key;
- const struct odp_key_nd *nd_key;
+ const struct ovs_key_ethernet *eth_key;
+ const struct ovs_key_8021q *q_key;
+ const struct ovs_key_ipv4 *ipv4_key;
+ const struct ovs_key_ipv6 *ipv6_key;
+ const struct ovs_key_tcp *tcp_key;
+ const struct ovs_key_udp *udp_key;
+ const struct ovs_key_icmp *icmp_key;
+ const struct ovs_key_icmpv6 *icmpv6_key;
+ const struct ovs_key_arp *arp_key;
+ const struct ovs_key_nd *nd_key;
if (nl_attr_get_size(a) != odp_flow_key_attr_len(nl_attr_type(a))) {
ds_put_format(ds, "bad length %zu, expected %d for: ",
}
switch (nl_attr_type(a)) {
- case ODP_KEY_ATTR_TUN_ID:
+ case OVS_KEY_ATTR_TUN_ID:
ds_put_format(ds, "tun_id(%#"PRIx64")", ntohll(nl_attr_get_be64(a)));
break;
- case ODP_KEY_ATTR_IN_PORT:
+ case OVS_KEY_ATTR_IN_PORT:
ds_put_format(ds, "in_port(%"PRIu32")", nl_attr_get_u32(a));
break;
- case ODP_KEY_ATTR_ETHERNET:
+ case OVS_KEY_ATTR_ETHERNET:
eth_key = nl_attr_get(a);
ds_put_format(ds, "eth(src="ETH_ADDR_FMT",dst="ETH_ADDR_FMT")",
ETH_ADDR_ARGS(eth_key->eth_src),
ETH_ADDR_ARGS(eth_key->eth_dst));
break;
- case ODP_KEY_ATTR_8021Q:
+ case OVS_KEY_ATTR_8021Q:
q_key = nl_attr_get(a);
ds_put_cstr(ds, "vlan(");
if (q_key->q_tpid != htons(ETH_TYPE_VLAN)) {
vlan_tci_to_pcp(q_key->q_tci));
break;
- case ODP_KEY_ATTR_ETHERTYPE:
+ case OVS_KEY_ATTR_ETHERTYPE:
ds_put_format(ds, "eth_type(0x%04"PRIx16")",
ntohs(nl_attr_get_be16(a)));
break;
- case ODP_KEY_ATTR_IPV4:
+ case OVS_KEY_ATTR_IPV4:
ipv4_key = nl_attr_get(a);
ds_put_format(ds, "ipv4(src="IP_FMT",dst="IP_FMT","
"proto=%"PRId8",tos=%"PRIu8")",
ipv4_key->ipv4_proto, ipv4_key->ipv4_tos);
break;
- case ODP_KEY_ATTR_IPV6: {
+ case OVS_KEY_ATTR_IPV6: {
char src_str[INET6_ADDRSTRLEN];
char dst_str[INET6_ADDRSTRLEN];
break;
}
- case ODP_KEY_ATTR_TCP:
+ case OVS_KEY_ATTR_TCP:
tcp_key = nl_attr_get(a);
ds_put_format(ds, "tcp(src=%"PRIu16",dst=%"PRIu16")",
ntohs(tcp_key->tcp_src), ntohs(tcp_key->tcp_dst));
break;
- case ODP_KEY_ATTR_UDP:
+ case OVS_KEY_ATTR_UDP:
udp_key = nl_attr_get(a);
ds_put_format(ds, "udp(src=%"PRIu16",dst=%"PRIu16")",
ntohs(udp_key->udp_src), ntohs(udp_key->udp_dst));
break;
- case ODP_KEY_ATTR_ICMP:
+ case OVS_KEY_ATTR_ICMP:
icmp_key = nl_attr_get(a);
ds_put_format(ds, "icmp(type=%"PRIu8",code=%"PRIu8")",
icmp_key->icmp_type, icmp_key->icmp_code);
break;
- case ODP_KEY_ATTR_ICMPV6:
+ case OVS_KEY_ATTR_ICMPV6:
icmpv6_key = nl_attr_get(a);
ds_put_format(ds, "icmpv6(type=%"PRIu8",code=%"PRIu8")",
icmpv6_key->icmpv6_type, icmpv6_key->icmpv6_code);
break;
- case ODP_KEY_ATTR_ARP:
+ case OVS_KEY_ATTR_ARP:
arp_key = nl_attr_get(a);
ds_put_format(ds, "arp(sip="IP_FMT",tip="IP_FMT",op=%"PRIu16","
"sha="ETH_ADDR_FMT",tha="ETH_ADDR_FMT")",
ETH_ADDR_ARGS(arp_key->arp_tha));
break;
- case ODP_KEY_ATTR_ND: {
+ case OVS_KEY_ATTR_ND: {
char target[INET6_ADDRSTRLEN];
nd_key = nl_attr_get(a);
}
/* Appends to 'ds' a string representation of the 'key_len' bytes of
- * ODP_KEY_ATTR_* attributes in 'key'. */
+ * OVS_KEY_ATTR_* attributes in 'key'. */
void
odp_flow_key_format(const struct nlattr *key, size_t key_len, struct ds *ds)
{
put_nd_key(int n, const char *nd_target_s,
const uint8_t *nd_sll, const uint8_t *nd_tll, struct ofpbuf *key)
{
- struct odp_key_nd nd_key;
+ struct ovs_key_nd nd_key;
memset(&nd_key, 0, sizeof nd_key);
if (inet_pton(AF_INET6, nd_target_s, nd_key.nd_target) != 1) {
if (nd_tll) {
memcpy(nd_key.nd_tll, nd_tll, ETH_ADDR_LEN);
}
- nl_msg_put_unspec(key, ODP_KEY_ATTR_ND, &nd_key, sizeof nd_key);
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_ND, &nd_key, sizeof nd_key);
return n;
}
if (sscanf(s, "tun_id(%31[x0123456789abcdefABCDEF])%n",
tun_id_s, &n) > 0 && n > 0) {
uint64_t tun_id = strtoull(tun_id_s, NULL, 0);
- nl_msg_put_be64(key, ODP_KEY_ATTR_TUN_ID, htonll(tun_id));
+ nl_msg_put_be64(key, OVS_KEY_ATTR_TUN_ID, htonll(tun_id));
return n;
}
}
int n = -1;
if (sscanf(s, "in_port(%lli)%n", &in_port, &n) > 0 && n > 0) {
- nl_msg_put_u32(key, ODP_KEY_ATTR_IN_PORT, in_port);
+ nl_msg_put_u32(key, OVS_KEY_ATTR_IN_PORT, in_port);
return n;
}
}
{
- struct odp_key_ethernet eth_key;
+ struct ovs_key_ethernet eth_key;
int n = -1;
if (sscanf(s,
"eth(src="ETH_ADDR_SCAN_FMT",dst="ETH_ADDR_SCAN_FMT")%n",
ETH_ADDR_SCAN_ARGS(eth_key.eth_src),
ETH_ADDR_SCAN_ARGS(eth_key.eth_dst), &n) > 0 && n > 0) {
- nl_msg_put_unspec(key, ODP_KEY_ATTR_ETHERNET,
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_ETHERNET,
ð_key, sizeof eth_key);
return n;
}
&vid, &pcp, &n) > 0 && n > 0) ||
(sscanf(s, "vlan(tpid=%"SCNi16",vid=%"SCNi16",pcp=%i)%n",
&tpid, &vid, &pcp, &n) > 0 && n > 0)) {
- struct odp_key_8021q q_key;
+ struct ovs_key_8021q q_key;
q_key.q_tpid = htons(tpid);
q_key.q_tci = htons((vid << VLAN_VID_SHIFT) |
(pcp << VLAN_PCP_SHIFT));
- nl_msg_put_unspec(key, ODP_KEY_ATTR_8021Q, &q_key, sizeof q_key);
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_8021Q, &q_key, sizeof q_key);
return n;
}
}
int n = -1;
if (sscanf(s, "eth_type(%i)%n", ð_type, &n) > 0 && n > 0) {
- nl_msg_put_be16(key, ODP_KEY_ATTR_ETHERTYPE, htons(eth_type));
+ nl_msg_put_be16(key, OVS_KEY_ATTR_ETHERTYPE, htons(eth_type));
return n;
}
}
IP_SCAN_ARGS(&ipv4_src),
IP_SCAN_ARGS(&ipv4_dst), &ipv4_proto, &ipv4_tos, &n) > 0
&& n > 0) {
- struct odp_key_ipv4 ipv4_key;
+ struct ovs_key_ipv4 ipv4_key;
memset(&ipv4_key, 0, sizeof ipv4_key);
ipv4_key.ipv4_src = ipv4_src;
ipv4_key.ipv4_dst = ipv4_dst;
ipv4_key.ipv4_proto = ipv4_proto;
ipv4_key.ipv4_tos = ipv4_tos;
- nl_msg_put_unspec(key, ODP_KEY_ATTR_IPV4,
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_IPV4,
&ipv4_key, sizeof ipv4_key);
return n;
}
"proto=%i,tos=%i)%n",
ipv6_src_s, ipv6_dst_s,
&ipv6_proto, &ipv6_tos, &n) > 0 && n > 0) {
- struct odp_key_ipv6 ipv6_key;
+ struct ovs_key_ipv6 ipv6_key;
memset(&ipv6_key, 0, sizeof ipv6_key);
if (inet_pton(AF_INET6, ipv6_src_s, &ipv6_key.ipv6_src) != 1 ||
}
ipv6_key.ipv6_proto = ipv6_proto;
ipv6_key.ipv6_tos = ipv6_tos;
- nl_msg_put_unspec(key, ODP_KEY_ATTR_IPV6,
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_IPV6,
&ipv6_key, sizeof ipv6_key);
return n;
}
if (sscanf(s, "tcp(src=%i,dst=%i)%n",&tcp_src, &tcp_dst, &n) > 0
&& n > 0) {
- struct odp_key_tcp tcp_key;
+ struct ovs_key_tcp tcp_key;
tcp_key.tcp_src = htons(tcp_src);
tcp_key.tcp_dst = htons(tcp_dst);
- nl_msg_put_unspec(key, ODP_KEY_ATTR_TCP, &tcp_key, sizeof tcp_key);
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_TCP, &tcp_key, sizeof tcp_key);
return n;
}
}
if (sscanf(s, "udp(src=%i,dst=%i)%n", &udp_src, &udp_dst, &n) > 0
&& n > 0) {
- struct odp_key_udp udp_key;
+ struct ovs_key_udp udp_key;
udp_key.udp_src = htons(udp_src);
udp_key.udp_dst = htons(udp_dst);
- nl_msg_put_unspec(key, ODP_KEY_ATTR_UDP, &udp_key, sizeof udp_key);
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_UDP, &udp_key, sizeof udp_key);
return n;
}
}
if (sscanf(s, "icmp(type=%i,code=%i)%n",
&icmp_type, &icmp_code, &n) > 0
&& n > 0) {
- struct odp_key_icmp icmp_key;
+ struct ovs_key_icmp icmp_key;
icmp_key.icmp_type = icmp_type;
icmp_key.icmp_code = icmp_code;
- nl_msg_put_unspec(key, ODP_KEY_ATTR_ICMP,
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_ICMP,
&icmp_key, sizeof icmp_key);
return n;
}
}
{
- struct odp_key_icmpv6 icmpv6_key;
+ struct ovs_key_icmpv6 icmpv6_key;
int n = -1;
if (sscanf(s, "icmpv6(type=%"SCNi8",code=%"SCNi8")%n",
&icmpv6_key.icmpv6_type, &icmpv6_key.icmpv6_code,&n) > 0
&& n > 0) {
- nl_msg_put_unspec(key, ODP_KEY_ATTR_ICMPV6,
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_ICMPV6,
&icmpv6_key, sizeof icmpv6_key);
return n;
}
&arp_op,
ETH_ADDR_SCAN_ARGS(arp_sha),
ETH_ADDR_SCAN_ARGS(arp_tha), &n) > 0 && n > 0) {
- struct odp_key_arp arp_key;
+ struct ovs_key_arp arp_key;
memset(&arp_key, 0, sizeof arp_key);
arp_key.arp_sip = arp_sip;
arp_key.arp_op = htons(arp_op);
memcpy(arp_key.arp_sha, arp_sha, ETH_ADDR_LEN);
memcpy(arp_key.arp_tha, arp_tha, ETH_ADDR_LEN);
- nl_msg_put_unspec(key, ODP_KEY_ATTR_ARP, &arp_key, sizeof arp_key);
+ nl_msg_put_unspec(key, OVS_KEY_ATTR_ARP, &arp_key, sizeof arp_key);
return n;
}
}
return -EINVAL;
}
-/* Parses the string representation of an ODP flow key, in the format output by
- * odp_flow_key_format(). Returns 0 if successful, otherwise a positive errno
- * value. On success, the flow key is appended to 'key' as a series of Netlink
- * attributes. On failure, no data is appended to 'key'. Either way, 'key''s
- * data might be reallocated.
+/* Parses the string representation of a datapath flow key, in the
+ * format output by odp_flow_key_format(). Returns 0 if successful,
+ * otherwise a positive errno value. On success, the flow key is
+ * appended to 'key' as a series of Netlink attributes. On failure, no
+ * data is appended to 'key'. Either way, 'key''s data might be
+ * reallocated.
*
* On success, the attributes appended to 'key' are individually syntactically
* valid, but they may not be valid as a sequence. 'key' might, for example,
return 0;
}
-/* Appends a representation of 'flow' as ODP_KEY_ATTR_* attributes to 'buf'. */
+/* Appends a representation of 'flow' as OVS_KEY_ATTR_* attributes to 'buf'. */
void
odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow)
{
- struct odp_key_ethernet *eth_key;
+ struct ovs_key_ethernet *eth_key;
if (flow->tun_id != htonll(0)) {
- nl_msg_put_be64(buf, ODP_KEY_ATTR_TUN_ID, flow->tun_id);
+ nl_msg_put_be64(buf, OVS_KEY_ATTR_TUN_ID, flow->tun_id);
}
- nl_msg_put_u32(buf, ODP_KEY_ATTR_IN_PORT,
+ nl_msg_put_u32(buf, OVS_KEY_ATTR_IN_PORT,
ofp_port_to_odp_port(flow->in_port));
- eth_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_ETHERNET,
+ eth_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ETHERNET,
sizeof *eth_key);
memcpy(eth_key->eth_src, flow->dl_src, ETH_ADDR_LEN);
memcpy(eth_key->eth_dst, flow->dl_dst, ETH_ADDR_LEN);
if (flow->vlan_tci != htons(0)) {
- struct odp_key_8021q *q_key;
+ struct ovs_key_8021q *q_key;
- q_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_8021Q,
+ q_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_8021Q,
sizeof *q_key);
q_key->q_tpid = htons(ETH_TYPE_VLAN);
q_key->q_tci = flow->vlan_tci & ~htons(VLAN_CFI);
return;
}
- nl_msg_put_be16(buf, ODP_KEY_ATTR_ETHERTYPE, flow->dl_type);
+ nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, flow->dl_type);
if (flow->dl_type == htons(ETH_TYPE_IP)) {
- struct odp_key_ipv4 *ipv4_key;
+ struct ovs_key_ipv4 *ipv4_key;
- ipv4_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_IPV4,
+ ipv4_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_IPV4,
sizeof *ipv4_key);
memset(ipv4_key, 0, sizeof *ipv4_key);
ipv4_key->ipv4_src = flow->nw_src;
ipv4_key->ipv4_proto = flow->nw_proto;
ipv4_key->ipv4_tos = flow->nw_tos;
} else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
- struct odp_key_ipv6 *ipv6_key;
+ struct ovs_key_ipv6 *ipv6_key;
- ipv6_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_IPV6,
+ ipv6_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_IPV6,
sizeof *ipv6_key);
memset(ipv6_key, 0, sizeof *ipv6_key);
memcpy(ipv6_key->ipv6_src, &flow->ipv6_src, sizeof ipv6_key->ipv6_src);
ipv6_key->ipv6_proto = flow->nw_proto;
ipv6_key->ipv6_tos = flow->nw_tos;
} else if (flow->dl_type == htons(ETH_TYPE_ARP)) {
- struct odp_key_arp *arp_key;
+ struct ovs_key_arp *arp_key;
- arp_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_ARP,
+ arp_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ARP,
sizeof *arp_key);
memset(arp_key, 0, sizeof *arp_key);
arp_key->arp_sip = flow->nw_src;
|| flow->dl_type == htons(ETH_TYPE_IPV6)) {
if (flow->nw_proto == IPPROTO_TCP) {
- struct odp_key_tcp *tcp_key;
+ struct ovs_key_tcp *tcp_key;
- tcp_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_TCP,
+ tcp_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_TCP,
sizeof *tcp_key);
tcp_key->tcp_src = flow->tp_src;
tcp_key->tcp_dst = flow->tp_dst;
} else if (flow->nw_proto == IPPROTO_UDP) {
- struct odp_key_udp *udp_key;
+ struct ovs_key_udp *udp_key;
- udp_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_UDP,
+ udp_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_UDP,
sizeof *udp_key);
udp_key->udp_src = flow->tp_src;
udp_key->udp_dst = flow->tp_dst;
} else if (flow->dl_type == htons(ETH_TYPE_IP)
&& flow->nw_proto == IPPROTO_ICMP) {
- struct odp_key_icmp *icmp_key;
+ struct ovs_key_icmp *icmp_key;
- icmp_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_ICMP,
+ icmp_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ICMP,
sizeof *icmp_key);
icmp_key->icmp_type = ntohs(flow->tp_src);
icmp_key->icmp_code = ntohs(flow->tp_dst);
} else if (flow->dl_type == htons(ETH_TYPE_IPV6)
&& flow->nw_proto == IPPROTO_ICMPV6) {
- struct odp_key_icmpv6 *icmpv6_key;
+ struct ovs_key_icmpv6 *icmpv6_key;
- icmpv6_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_ICMPV6,
+ icmpv6_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ICMPV6,
sizeof *icmpv6_key);
icmpv6_key->icmpv6_type = ntohs(flow->tp_src);
icmpv6_key->icmpv6_code = ntohs(flow->tp_dst);
if (icmpv6_key->icmpv6_type == ND_NEIGHBOR_SOLICIT
|| icmpv6_key->icmpv6_type == ND_NEIGHBOR_ADVERT) {
- struct odp_key_nd *nd_key;
+ struct ovs_key_nd *nd_key;
- nd_key = nl_msg_put_unspec_uninit(buf, ODP_KEY_ATTR_ND,
+ nd_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ND,
sizeof *nd_key);
memcpy(nd_key->nd_target, &flow->nd_target,
sizeof nd_key->nd_target);
}
}
-/* Converts the 'key_len' bytes of ODP_KEY_ATTR_* attributes in 'key' to a flow
+/* Converts the 'key_len' bytes of OVS_KEY_ATTR_* attributes in 'key' to a flow
* structure in 'flow'. Returns 0 if successful, otherwise EINVAL. */
int
odp_flow_key_to_flow(const struct nlattr *key, size_t key_len,
struct flow *flow)
{
const struct nlattr *nla;
- enum odp_key_type prev_type;
+ enum ovs_key_type prev_type;
size_t left;
memset(flow, 0, sizeof *flow);
flow->dl_type = htons(FLOW_DL_TYPE_NONE);
- prev_type = ODP_KEY_ATTR_UNSPEC;
+ prev_type = OVS_KEY_ATTR_UNSPEC;
NL_ATTR_FOR_EACH (nla, left, key, key_len) {
- const struct odp_key_ethernet *eth_key;
- const struct odp_key_8021q *q_key;
- const struct odp_key_ipv4 *ipv4_key;
- const struct odp_key_ipv6 *ipv6_key;
- const struct odp_key_tcp *tcp_key;
- const struct odp_key_udp *udp_key;
- const struct odp_key_icmp *icmp_key;
- const struct odp_key_icmpv6 *icmpv6_key;
- const struct odp_key_arp *arp_key;
- const struct odp_key_nd *nd_key;
+ const struct ovs_key_ethernet *eth_key;
+ const struct ovs_key_8021q *q_key;
+ const struct ovs_key_ipv4 *ipv4_key;
+ const struct ovs_key_ipv6 *ipv6_key;
+ const struct ovs_key_tcp *tcp_key;
+ const struct ovs_key_udp *udp_key;
+ const struct ovs_key_icmp *icmp_key;
+ const struct ovs_key_icmpv6 *icmpv6_key;
+ const struct ovs_key_arp *arp_key;
+ const struct ovs_key_nd *nd_key;
uint16_t type = nl_attr_type(nla);
int len = odp_flow_key_attr_len(type);
#define TRANSITION(PREV_TYPE, TYPE) (((PREV_TYPE) << 16) | (TYPE))
switch (TRANSITION(prev_type, type)) {
- case TRANSITION(ODP_KEY_ATTR_UNSPEC, ODP_KEY_ATTR_TUN_ID):
+ case TRANSITION(OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_TUN_ID):
flow->tun_id = nl_attr_get_be64(nla);
break;
- case TRANSITION(ODP_KEY_ATTR_UNSPEC, ODP_KEY_ATTR_IN_PORT):
- case TRANSITION(ODP_KEY_ATTR_TUN_ID, ODP_KEY_ATTR_IN_PORT):
+ case TRANSITION(OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_IN_PORT):
+ case TRANSITION(OVS_KEY_ATTR_TUN_ID, OVS_KEY_ATTR_IN_PORT):
if (nl_attr_get_u32(nla) >= UINT16_MAX) {
return EINVAL;
}
flow->in_port = odp_port_to_ofp_port(nl_attr_get_u32(nla));
break;
- case TRANSITION(ODP_KEY_ATTR_IN_PORT, ODP_KEY_ATTR_ETHERNET):
+ case TRANSITION(OVS_KEY_ATTR_IN_PORT, OVS_KEY_ATTR_ETHERNET):
eth_key = nl_attr_get(nla);
memcpy(flow->dl_src, eth_key->eth_src, ETH_ADDR_LEN);
memcpy(flow->dl_dst, eth_key->eth_dst, ETH_ADDR_LEN);
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERNET, ODP_KEY_ATTR_8021Q):
+ case TRANSITION(OVS_KEY_ATTR_ETHERNET, OVS_KEY_ATTR_8021Q):
q_key = nl_attr_get(nla);
if (q_key->q_tpid != htons(ETH_TYPE_VLAN)) {
/* Only standard 0x8100 VLANs currently supported. */
flow->vlan_tci = q_key->q_tci | htons(VLAN_CFI);
break;
- case TRANSITION(ODP_KEY_ATTR_8021Q, ODP_KEY_ATTR_ETHERTYPE):
- case TRANSITION(ODP_KEY_ATTR_ETHERNET, ODP_KEY_ATTR_ETHERTYPE):
+ case TRANSITION(OVS_KEY_ATTR_8021Q, OVS_KEY_ATTR_ETHERTYPE):
+ case TRANSITION(OVS_KEY_ATTR_ETHERNET, OVS_KEY_ATTR_ETHERTYPE):
flow->dl_type = nl_attr_get_be16(nla);
if (ntohs(flow->dl_type) < 1536) {
return EINVAL;
}
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERTYPE, ODP_KEY_ATTR_IPV4):
+ case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_IPV4):
if (flow->dl_type != htons(ETH_TYPE_IP)) {
return EINVAL;
}
}
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERTYPE, ODP_KEY_ATTR_IPV6):
+ case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_IPV6):
if (flow->dl_type != htons(ETH_TYPE_IPV6)) {
return EINVAL;
}
}
break;
- case TRANSITION(ODP_KEY_ATTR_IPV4, ODP_KEY_ATTR_TCP):
- case TRANSITION(ODP_KEY_ATTR_IPV6, ODP_KEY_ATTR_TCP):
+ case TRANSITION(OVS_KEY_ATTR_IPV4, OVS_KEY_ATTR_TCP):
+ case TRANSITION(OVS_KEY_ATTR_IPV6, OVS_KEY_ATTR_TCP):
if (flow->nw_proto != IPPROTO_TCP) {
return EINVAL;
}
flow->tp_dst = tcp_key->tcp_dst;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV4, ODP_KEY_ATTR_UDP):
- case TRANSITION(ODP_KEY_ATTR_IPV6, ODP_KEY_ATTR_UDP):
+ case TRANSITION(OVS_KEY_ATTR_IPV4, OVS_KEY_ATTR_UDP):
+ case TRANSITION(OVS_KEY_ATTR_IPV6, OVS_KEY_ATTR_UDP):
if (flow->nw_proto != IPPROTO_UDP) {
return EINVAL;
}
flow->tp_dst = udp_key->udp_dst;
break;
- case TRANSITION(ODP_KEY_ATTR_IPV4, ODP_KEY_ATTR_ICMP):
+ case TRANSITION(OVS_KEY_ATTR_IPV4, OVS_KEY_ATTR_ICMP):
if (flow->nw_proto != IPPROTO_ICMP) {
return EINVAL;
}
flow->tp_dst = htons(icmp_key->icmp_code);
break;
- case TRANSITION(ODP_KEY_ATTR_IPV6, ODP_KEY_ATTR_ICMPV6):
+ case TRANSITION(OVS_KEY_ATTR_IPV6, OVS_KEY_ATTR_ICMPV6):
if (flow->nw_proto != IPPROTO_ICMPV6) {
return EINVAL;
}
flow->tp_dst = htons(icmpv6_key->icmpv6_code);
break;
- case TRANSITION(ODP_KEY_ATTR_ETHERTYPE, ODP_KEY_ATTR_ARP):
+ case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_ARP):
if (flow->dl_type != htons(ETH_TYPE_ARP)) {
return EINVAL;
}
memcpy(flow->arp_tha, arp_key->arp_tha, ETH_ADDR_LEN);
break;
- case TRANSITION(ODP_KEY_ATTR_ICMPV6, ODP_KEY_ATTR_ND):
+ case TRANSITION(OVS_KEY_ATTR_ICMPV6, OVS_KEY_ATTR_ND):
if (flow->tp_src != htons(ND_NEIGHBOR_SOLICIT)
&& flow->tp_src != htons(ND_NEIGHBOR_ADVERT)) {
return EINVAL;
break;
default:
- if (type == ODP_KEY_ATTR_UNSPEC
- || prev_type == ODP_KEY_ATTR_UNSPEC) {
+ if (type == OVS_KEY_ATTR_UNSPEC
+ || prev_type == OVS_KEY_ATTR_UNSPEC) {
return EINVAL;
}
return EINVAL;
}
switch (prev_type) {
- case ODP_KEY_ATTR_UNSPEC:
+ case OVS_KEY_ATTR_UNSPEC:
return EINVAL;
- case ODP_KEY_ATTR_TUN_ID:
- case ODP_KEY_ATTR_IN_PORT:
+ case OVS_KEY_ATTR_TUN_ID:
+ case OVS_KEY_ATTR_IN_PORT:
return EINVAL;
- case ODP_KEY_ATTR_ETHERNET:
- case ODP_KEY_ATTR_8021Q:
+ case OVS_KEY_ATTR_ETHERNET:
+ case OVS_KEY_ATTR_8021Q:
return 0;
- case ODP_KEY_ATTR_ETHERTYPE:
+ case OVS_KEY_ATTR_ETHERTYPE:
if (flow->dl_type == htons(ETH_TYPE_IP)
|| flow->dl_type == htons(ETH_TYPE_IPV6)
|| flow->dl_type == htons(ETH_TYPE_ARP)) {
}
return 0;
- case ODP_KEY_ATTR_IPV4:
+ case OVS_KEY_ATTR_IPV4:
if (flow->nw_proto == IPPROTO_TCP
|| flow->nw_proto == IPPROTO_UDP
|| flow->nw_proto == IPPROTO_ICMP) {
}
return 0;
- case ODP_KEY_ATTR_IPV6:
+ case OVS_KEY_ATTR_IPV6:
if (flow->nw_proto == IPPROTO_TCP
|| flow->nw_proto == IPPROTO_UDP
|| flow->nw_proto == IPPROTO_ICMPV6) {
}
return 0;
- case ODP_KEY_ATTR_ICMPV6:
+ case OVS_KEY_ATTR_ICMPV6:
if (flow->icmp_type == htons(ND_NEIGHBOR_SOLICIT)
|| flow->icmp_type == htons(ND_NEIGHBOR_ADVERT)) {
return EINVAL;
}
return 0;
- case ODP_KEY_ATTR_TCP:
- case ODP_KEY_ATTR_UDP:
- case ODP_KEY_ATTR_ICMP:
- case ODP_KEY_ATTR_ARP:
- case ODP_KEY_ATTR_ND:
+ case OVS_KEY_ATTR_TCP:
+ case OVS_KEY_ATTR_UDP:
+ case OVS_KEY_ATTR_ICMP:
+ case OVS_KEY_ATTR_ARP:
+ case OVS_KEY_ATTR_ND:
return 0;
- case __ODP_KEY_ATTR_MAX:
+ case __OVS_KEY_ATTR_MAX:
default:
NOT_REACHED();
}
struct flow;
struct ofpbuf;
-#define ODPP_NONE ((uint16_t) -1)
+#define OVSP_NONE ((uint16_t) -1)
static inline uint16_t
ofp_port_to_odp_port(uint16_t ofp_port)
{
switch (ofp_port) {
case OFPP_LOCAL:
- return ODPP_LOCAL;
+ return OVSP_LOCAL;
case OFPP_NONE:
- return ODPP_NONE;
+ return OVSP_NONE;
default:
return ofp_port;
}
odp_port_to_ofp_port(uint16_t odp_port)
{
switch (odp_port) {
- case ODPP_LOCAL:
+ case OVSP_LOCAL:
return OFPP_LOCAL;
- case ODPP_NONE:
+ case OVSP_NONE:
return OFPP_NONE;
default:
return odp_port;
*
* struct pad nl hdr total
* ------ --- ------ -----
- * ODP_KEY_ATTR_TUN_ID 8 -- 4 12
- * ODP_KEY_ATTR_IN_PORT 4 -- 4 8
- * ODP_KEY_ATTR_ETHERNET 12 -- 4 16
- * ODP_KEY_ATTR_8021Q 4 -- 4 8
- * ODP_KEY_ATTR_ETHERTYPE 2 2 4 8
- * ODP_KEY_ATTR_IPV6 34 2 4 40
- * ODP_KEY_ATTR_ICMPV6 2 2 4 8
- * ODP_KEY_ATTR_ND 28 -- 4 32
+ * OVS_KEY_ATTR_TUN_ID 8 -- 4 12
+ * OVS_KEY_ATTR_IN_PORT 4 -- 4 8
+ * OVS_KEY_ATTR_ETHERNET 12 -- 4 16
+ * OVS_KEY_ATTR_8021Q 4 -- 4 8
+ * OVS_KEY_ATTR_ETHERTYPE 2 2 4 8
+ * OVS_KEY_ATTR_IPV6 34 2 4 40
+ * OVS_KEY_ATTR_ICMPV6 2 2 4 8
+ * OVS_KEY_ATTR_ND 28 -- 4 32
* -------------------------------------------------
* total 132
*/
#define ODPUTIL_FLOW_KEY_BYTES 132
/* This is an imperfect sanity-check that ODPUTIL_FLOW_KEY_BYTES doesn't
- * need to be updated, but will at least raise awareness when new ODP
- * key types are added. */
-BUILD_ASSERT_DECL(__ODP_KEY_ATTR_MAX == 14);
+ * need to be updated, but will at least raise awareness when new OVS
+ * datapath key types are added. */
+BUILD_ASSERT_DECL(__OVS_KEY_ATTR_MAX == 14);
/* A buffer with sufficient size and alignment to hold an nlattr-formatted flow
* key. An array of "struct nlattr" might not, in theory, be sufficiently
opo->header.length = htons(size);
opo->header.xid = htonl(0);
opo->buffer_id = htonl(buffer_id);
- opo->in_port = htons(in_port == ODPP_LOCAL ? OFPP_LOCAL : in_port);
+ opo->in_port = htons(in_port == OVSP_LOCAL ? OFPP_LOCAL : in_port);
opo->actions_len = htons(actions_len);
ofpbuf_put(out, actions, actions_len);
if (packet) {
unsigned int left;
NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
- if (nl_attr_type(a) == ODP_ACTION_ATTR_OUTPUT
- && nl_attr_get_u32(a) == ODPP_LOCAL) {
+ if (nl_attr_type(a) == OVS_ACTION_ATTR_OUTPUT
+ && nl_attr_get_u32(a) == OVSP_LOCAL) {
return true;
}
}
if (ib->n_remotes && !eth_addr_is_zero(ib->local_mac)) {
/* (a) Allow DHCP requests sent from the local port. */
cls_rule_init_catchall(&rule, IBR_FROM_LOCAL_DHCP);
- cls_rule_set_in_port(&rule, ODPP_LOCAL);
+ cls_rule_set_in_port(&rule, OVSP_LOCAL);
cls_rule_set_dl_type(&rule, htons(ETH_TYPE_IP));
cls_rule_set_dl_src(&rule, ib->local_mac);
cls_rule_set_nw_proto(&rule, IPPROTO_UDP);
struct hmap_node hmap_node; /* In struct dpif_sflow's "ports" hmap. */
struct netdev *netdev; /* Underlying network device, for stats. */
SFLDataSource_instance dsi; /* sFlow library's notion of port number. */
- uint16_t odp_port; /* ODP port number. */
+ uint16_t odp_port; /* Datapath port number. */
};
struct dpif_sflow {
ovs_be16 tci;
switch (nl_attr_type(a)) {
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
fs.output = dpif_sflow_odp_port_to_ifindex(ds, nl_attr_get_u32(a));
n_outputs++;
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
tci = nl_attr_get_be16(a);
switchElem.flowType.sw.dst_vlan = vlan_tci_to_vid(tci);
switchElem.flowType.sw.dst_priority = vlan_tci_to_pcp(tci);
void dpif_sflow_clear(struct dpif_sflow *);
bool dpif_sflow_is_enabled(const struct dpif_sflow *);
-void dpif_sflow_add_port(struct dpif_sflow *, uint16_t odp_port,
+void dpif_sflow_add_port(struct dpif_sflow *, uint16_t ovs_port,
const char *netdev_name);
-void dpif_sflow_del_port(struct dpif_sflow *, uint16_t odp_port);
+void dpif_sflow_del_port(struct dpif_sflow *, uint16_t ovs_port);
void dpif_sflow_run(struct dpif_sflow *);
void dpif_sflow_wait(struct dpif_sflow *);
get_tables(struct ofproto *ofproto_, struct ofp_table_stats *ots)
{
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
- struct odp_stats s;
+ struct ovs_dp_stats s;
strcpy(ots->name, "classifier");
/* Check with in-band control to see if this packet should be sent
* to the local port regardless of the flow table. */
if (connmgr_msg_in_hook(ofproto->up.connmgr, &flow, upcall->packet)) {
- send_packet(ofproto, ODPP_LOCAL, upcall->packet);
+ send_packet(ofproto, OVSP_LOCAL, upcall->packet);
}
facet = facet_lookup_valid(ofproto, &flow);
ds_init(&s);
odp_flow_key_format(key, key_len, &s);
- VLOG_WARN_RL(&rl, "failed to convert ODP flow key to flow: %s",
+ VLOG_WARN_RL(&rl, "failed to convert datapath flow key to flow: %s",
ds_cstr(&s));
ds_destroy(&s);
struct ofpbuf *packet)
{
if (actions_len == NLA_ALIGN(NLA_HDRLEN + sizeof(uint64_t))
- && odp_actions->nla_type == ODP_ACTION_ATTR_USERSPACE) {
+ && odp_actions->nla_type == OVS_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. */
* applying flow_extract() to 'packet' would yield the same flow as
* 'facet->flow'.
*
- * 'facet' must have accurately composed ODP actions; that is, it must not be
- * in need of revalidation.
+ * 'facet' must have accurately composed datapath actions; that is, it must
+ * not be in need of revalidation.
*
* Takes ownership of 'packet'. */
static void
facet_free(facet);
}
-/* Composes the ODP actions for 'facet' based on its rule's actions. */
+/* Composes the datapath actions for 'facet' based on its rule's actions. */
static void
facet_make_actions(struct ofproto_dpif *p, struct facet *facet,
const struct ofpbuf *packet)
struct ofport_dpif *port;
switch (nl_attr_type(a)) {
- case ODP_ACTION_ATTR_OUTPUT:
+ case OVS_ACTION_ATTR_OUTPUT:
port = get_odp_port(ofproto, nl_attr_get_u32(a));
if (port && port->bundle && port->bundle->bond) {
bond_account(port->bundle->bond, &facet->flow,
}
break;
- case ODP_ACTION_ATTR_STRIP_VLAN:
+ case OVS_ACTION_ATTR_STRIP_VLAN:
vlan_tci = htons(0);
break;
- case ODP_ACTION_ATTR_SET_DL_TCI:
+ case OVS_ACTION_ATTR_SET_DL_TCI:
vlan_tci = nl_attr_get_be16(a);
break;
}
return false;
}
- /* Calculate new ODP actions.
+ /* Calculate new datapath actions.
*
* We do not modify any 'facet' state yet, because we might need to, e.g.,
* emit a NetFlow expiration and, if so, we need to have the old state
|| memcmp(facet->actions, odp_actions->data,
facet->actions_len));
- /* If the ODP actions changed or the installability changed, then we need
- * to talk to the datapath. */
+ /* If the datapath actions changed or the installability changed,
+ * then we need to talk to the datapath. */
if (actions_changed || ctx.may_set_up_flow != facet->installed) {
if (ctx.may_set_up_flow) {
struct dpif_flow_stats stats;
odp_flow_key_from_flow(&key, &flow);
ofpbuf_init(&odp_actions, 32);
- nl_msg_put_u32(&odp_actions, ODP_ACTION_ATTR_OUTPUT, odp_port);
+ nl_msg_put_u32(&odp_actions, OVS_ACTION_ATTR_OUTPUT, odp_port);
error = dpif_execute(ofproto->dpif,
key.data, key.size,
odp_actions.data, odp_actions.size,
return error;
}
\f
-/* OpenFlow to ODP action translation. */
+/* OpenFlow to datapath action translation. */
static void do_xlate_actions(const union ofp_action *in, size_t n_in,
struct action_xlate_ctx *ctx);
struct ofpbuf *odp_actions = ctx->odp_actions;
if (base->tun_id != flow->tun_id) {
- nl_msg_put_be64(odp_actions, ODP_ACTION_ATTR_SET_TUNNEL, flow->tun_id);
+ nl_msg_put_be64(odp_actions, OVS_ACTION_ATTR_SET_TUNNEL, flow->tun_id);
base->tun_id = flow->tun_id;
}
if (base->nw_src != flow->nw_src) {
- nl_msg_put_be32(odp_actions, ODP_ACTION_ATTR_SET_NW_SRC, flow->nw_src);
+ nl_msg_put_be32(odp_actions, OVS_ACTION_ATTR_SET_NW_SRC, flow->nw_src);
base->nw_src = flow->nw_src;
}
if (base->nw_dst != flow->nw_dst) {
- nl_msg_put_be32(odp_actions, ODP_ACTION_ATTR_SET_NW_DST, flow->nw_dst);
+ nl_msg_put_be32(odp_actions, OVS_ACTION_ATTR_SET_NW_DST, flow->nw_dst);
base->nw_dst = flow->nw_dst;
}
if (base->nw_tos != flow->nw_tos) {
- nl_msg_put_u8(odp_actions, ODP_ACTION_ATTR_SET_NW_TOS, flow->nw_tos);
+ nl_msg_put_u8(odp_actions, OVS_ACTION_ATTR_SET_NW_TOS, flow->nw_tos);
base->nw_tos = flow->nw_tos;
}
if (base->vlan_tci != flow->vlan_tci) {
if (!(flow->vlan_tci & htons(VLAN_CFI))) {
- nl_msg_put_flag(odp_actions, ODP_ACTION_ATTR_STRIP_VLAN);
+ nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_STRIP_VLAN);
} else {
- nl_msg_put_be16(odp_actions, ODP_ACTION_ATTR_SET_DL_TCI,
+ nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_SET_DL_TCI,
flow->vlan_tci & ~htons(VLAN_CFI));
}
base->vlan_tci = flow->vlan_tci;
}
if (base->tp_src != flow->tp_src) {
- nl_msg_put_be16(odp_actions, ODP_ACTION_ATTR_SET_TP_SRC, flow->tp_src);
+ nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_SET_TP_SRC, flow->tp_src);
base->tp_src = flow->tp_src;
}
if (base->tp_dst != flow->tp_dst) {
- nl_msg_put_be16(odp_actions, ODP_ACTION_ATTR_SET_TP_DST, flow->tp_dst);
+ nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_SET_TP_DST, flow->tp_dst);
base->tp_dst = flow->tp_dst;
}
if (!eth_addr_equals(base->dl_src, flow->dl_src)) {
- nl_msg_put_unspec(odp_actions, ODP_ACTION_ATTR_SET_DL_SRC,
+ nl_msg_put_unspec(odp_actions, OVS_ACTION_ATTR_SET_DL_SRC,
flow->dl_src, ETH_ADDR_LEN);
memcpy(base->dl_src, flow->dl_src, ETH_ADDR_LEN);
}
if (!eth_addr_equals(base->dl_dst, flow->dl_dst)) {
- nl_msg_put_unspec(odp_actions, ODP_ACTION_ATTR_SET_DL_DST,
+ nl_msg_put_unspec(odp_actions, OVS_ACTION_ATTR_SET_DL_DST,
flow->dl_dst, ETH_ADDR_LEN);
memcpy(base->dl_dst, flow->dl_dst, ETH_ADDR_LEN);
}
if (ctx->base_priority != ctx->priority) {
if (ctx->priority) {
- nl_msg_put_u32(odp_actions, ODP_ACTION_ATTR_SET_PRIORITY,
+ nl_msg_put_u32(odp_actions, OVS_ACTION_ATTR_SET_PRIORITY,
ctx->priority);
} else {
- nl_msg_put_flag(odp_actions, ODP_ACTION_ATTR_POP_PRIORITY);
+ nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_PRIORITY);
}
ctx->base_priority = ctx->priority;
}
}
commit_odp_actions(ctx);
- nl_msg_put_u32(ctx->odp_actions, ODP_ACTION_ATTR_OUTPUT, odp_port);
+ nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_OUTPUT, odp_port);
ctx->nf_output_iface = ofp_port;
}
HMAP_FOR_EACH (ofport, up.hmap_node, &ctx->ofproto->up.ports) {
uint16_t ofp_port = ofport->up.ofp_port;
if (ofp_port != ctx->flow.in_port && !(ofport->up.opp.config & mask)) {
- nl_msg_put_u32(ctx->odp_actions, ODP_ACTION_ATTR_OUTPUT,
+ nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_OUTPUT,
ofport->odp_port);
}
}
break;
case OFPP_CONTROLLER:
commit_odp_actions(ctx);
- nl_msg_put_u64(ctx->odp_actions, ODP_ACTION_ATTR_USERSPACE, max_len);
+ nl_msg_put_u64(ctx->odp_actions, OVS_ACTION_ATTR_USERSPACE, max_len);
break;
case OFPP_LOCAL:
add_output_action(ctx, OFPP_LOCAL);
return;
}
- /* Figure out ODP output port. */
+ /* Figure out datapath output port. */
ofp_port = ntohs(oae->port);
if (ofp_port == OFPP_IN_PORT) {
ofp_port = ctx->flow.in_port;
}
odp_port = ofp_port_to_odp_port(ofp_port);
- /* Add ODP actions. */
+ /* Add datapath actions. */
ctx_priority = ctx->priority;
ctx->priority = priority;
add_output_action(ctx, odp_port);
continue;
}
nl_msg_put_u32(ctx->odp_actions,
- ODP_ACTION_ATTR_OUTPUT, dst->port->odp_port);
+ OVS_ACTION_ATTR_OUTPUT, dst->port->odp_port);
}
/* Then output the rest. */
}
if (dst->vlan != cur_vlan) {
if (dst->vlan == OFP_VLAN_NONE) {
- nl_msg_put_flag(ctx->odp_actions, ODP_ACTION_ATTR_STRIP_VLAN);
+ nl_msg_put_flag(ctx->odp_actions, OVS_ACTION_ATTR_STRIP_VLAN);
} else {
ovs_be16 tci;
tci = htons(dst->vlan & VLAN_VID_MASK);
tci |= ctx->flow.vlan_tci & htons(VLAN_PCP_MASK);
nl_msg_put_be16(ctx->odp_actions,
- ODP_ACTION_ATTR_SET_DL_TCI, tci);
+ OVS_ACTION_ATTR_SET_DL_TCI, tci);
}
cur_vlan = dst->vlan;
}
nl_msg_put_u32(ctx->odp_actions,
- ODP_ACTION_ATTR_OUTPUT, dst->port->odp_port);
+ OVS_ACTION_ATTR_OUTPUT, dst->port->odp_port);
}
dst_set_free(&set);
/* ofproto/trace dpname flow */
int error;
- /* Convert string to ODP key. */
+ /* Convert string to datapath key. */
ofpbuf_init(&odp_key, 0);
error = odp_flow_key_from_string(arg1, &odp_key);
if (error) {
-AT_SETUP([ODP parsing and formatting - valid forms])
+AT_SETUP([OVS datapath parsing and formatting - valid forms])
AT_DATA([odp-base.txt], [dnl
in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15)
in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x1234)
continue;
}
- /* Convert string to ODP key. */
+ /* Convert string to OVS DP key. */
ofpbuf_init(&odp_key, 0);
error = odp_flow_key_from_string(ds_cstr(&in), &odp_key);
if (error) {
{
struct dpif_port_dump dump;
struct dpif_port dpif_port;
- struct odp_stats stats;
+ struct ovs_dp_stats stats;
printf("%s:\n", dpif_name(dpif));
if (!dpif_get_dp_stats(dpif, &stats)) {