mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
openvswitch: Allow OVS_USERSPACE_ATTR_USERDATA to be variable length.
Until now, the optional OVS_USERSPACE_ATTR_USERDATA attribute had to be exactly 64 bits long, if it was present. However, 64 bits is not enough space to associate as much information with a flow as would be convenient for some userspace features now under development. This commit generalizes the attribute, allowing it to be any length. This generalization is backward-compatible: if userspace only uses 64-bit attributes, then it will not see any change in behavior. CC: Romain Lenglet <rlenglet@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
parent
14408dba84
commit
4490108b4a
3 changed files with 13 additions and 11 deletions
|
@ -370,8 +370,8 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
|
|||
len = sizeof(struct ovs_header);
|
||||
len += nla_total_size(skb->len);
|
||||
len += nla_total_size(FLOW_BUFSIZE);
|
||||
if (upcall_info->cmd == OVS_PACKET_CMD_ACTION)
|
||||
len += nla_total_size(8);
|
||||
if (upcall_info->userdata)
|
||||
len += NLA_ALIGN(upcall_info->userdata->nla_len);
|
||||
|
||||
user_skb = genlmsg_new(len, GFP_ATOMIC);
|
||||
if (!user_skb) {
|
||||
|
@ -388,8 +388,9 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
|
|||
nla_nest_end(user_skb, nla);
|
||||
|
||||
if (upcall_info->userdata)
|
||||
nla_put_u64(user_skb, OVS_PACKET_ATTR_USERDATA,
|
||||
nla_get_u64(upcall_info->userdata));
|
||||
__nla_put(user_skb, OVS_PACKET_ATTR_USERDATA,
|
||||
nla_len(upcall_info->userdata),
|
||||
nla_data(upcall_info->userdata));
|
||||
|
||||
nla = __nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, skb->len);
|
||||
|
||||
|
@ -544,7 +545,7 @@ static int validate_userspace(const struct nlattr *attr)
|
|||
{
|
||||
static const struct nla_policy userspace_policy[OVS_USERSPACE_ATTR_MAX + 1] = {
|
||||
[OVS_USERSPACE_ATTR_PID] = {.type = NLA_U32 },
|
||||
[OVS_USERSPACE_ATTR_USERDATA] = {.type = NLA_U64 },
|
||||
[OVS_USERSPACE_ATTR_USERDATA] = {.type = NLA_UNSPEC },
|
||||
};
|
||||
struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1];
|
||||
int error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue