projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New dir_name() function plus tests.
[openvswitch]
/
datapath
/
datapath.c
diff --git
a/datapath/datapath.c
b/datapath/datapath.c
index b8ef104aa63659158aa9c982c3cb7cbc11f09d92..1ae1d771a31a5a3f2128ee75f474cf9e2c645f1d 100644
(file)
--- a/
datapath/datapath.c
+++ b/
datapath/datapath.c
@@
-782,7
+782,8
@@
static int validate_actions(const struct sw_flow_actions *actions)
break;
case ODPAT_SET_VLAN_PCP:
break;
case ODPAT_SET_VLAN_PCP:
- if (a->vlan_pcp.vlan_pcp & ~VLAN_PCP_MASK)
+ if (a->vlan_pcp.vlan_pcp
+ & ~(VLAN_PCP_MASK >> VLAN_PCP_SHIFT))
return -EINVAL;
break;
return -EINVAL;
break;
@@
-1371,6
+1372,16
@@
get_port_group(struct datapath *dp, struct odp_port_group *upg)
return 0;
}
return 0;
}
+static int get_listen_mask(const struct file *f)
+{
+ return (long)f->private_data;
+}
+
+static void set_listen_mask(struct file *f, int listen_mask)
+{
+ f->private_data = (void*)(long)listen_mask;
+}
+
static long openvswitch_ioctl(struct file *f, unsigned int cmd,
unsigned long argp)
{
static long openvswitch_ioctl(struct file *f, unsigned int cmd,
unsigned long argp)
{
@@
-1426,7
+1437,7
@@
static long openvswitch_ioctl(struct file *f, unsigned int cmd,
break;
case ODP_GET_LISTEN_MASK:
break;
case ODP_GET_LISTEN_MASK:
- err = put_user(
(int)f->private_data
, (int __user *)argp);
+ err = put_user(
get_listen_mask(f)
, (int __user *)argp);
break;
case ODP_SET_LISTEN_MASK:
break;
case ODP_SET_LISTEN_MASK:
@@
-1437,7
+1448,7
@@
static long openvswitch_ioctl(struct file *f, unsigned int cmd,
if (listeners & ~ODPL_ALL)
break;
err = 0;
if (listeners & ~ODPL_ALL)
break;
err = 0;
-
f->private_data = (void*)listeners
;
+
set_listen_mask(f, listeners)
;
break;
case ODP_PORT_QUERY:
break;
case ODP_PORT_QUERY:
@@
-1503,7
+1514,7
@@
ssize_t openvswitch_read(struct file *f, char __user *buf, size_t nbytes,
loff_t *ppos)
{
/* XXX is there sufficient synchronization here? */
loff_t *ppos)
{
/* XXX is there sufficient synchronization here? */
- int listeners =
(int) f->private_data
;
+ int listeners =
get_listen_mask(f)
;
int dp_idx = iminor(f->f_dentry->d_inode);
struct datapath *dp = get_dp(dp_idx);
struct sk_buff *skb;
int dp_idx = iminor(f->f_dentry->d_inode);
struct datapath *dp = get_dp(dp_idx);
struct sk_buff *skb;
@@
-1543,7
+1554,7
@@
ssize_t openvswitch_read(struct file *f, char __user *buf, size_t nbytes,
}
}
success:
}
}
success:
- copy_bytes = min
(
skb->len, nbytes);
+ copy_bytes = min
_t(size_t,
skb->len, nbytes);
iov.iov_base = buf;
iov.iov_len = copy_bytes;
retval = skb_copy_datagram_iovec(skb, 0, &iov, iov.iov_len);
iov.iov_base = buf;
iov.iov_len = copy_bytes;
retval = skb_copy_datagram_iovec(skb, 0, &iov, iov.iov_len);
@@
-1565,7
+1576,7
@@
static unsigned int openvswitch_poll(struct file *file, poll_table *wait)
if (dp) {
mask = 0;
poll_wait(file, &dp->waitqueue, wait);
if (dp) {
mask = 0;
poll_wait(file, &dp->waitqueue, wait);
- if (dp_has_packet_of_interest(dp,
(int)file->private_data
))
+ if (dp_has_packet_of_interest(dp,
get_listen_mask(file)
))
mask |= POLLIN | POLLRDNORM;
} else {
mask = POLLIN | POLLRDNORM | POLLHUP;
mask |= POLLIN | POLLRDNORM;
} else {
mask = POLLIN | POLLRDNORM | POLLHUP;