diff options
-rw-r--r-- | datapath/actions.c | 26 | ||||
-rw-r--r-- | datapath/actions.h | 4 | ||||
-rw-r--r-- | datapath/brcompat.c | 36 | ||||
-rw-r--r-- | datapath/datapath.c | 44 | ||||
-rw-r--r-- | datapath/table.c | 2 | ||||
-rw-r--r-- | datapath/vport-generic.c | 12 | ||||
-rw-r--r-- | datapath/vport-gre.c | 139 | ||||
-rw-r--r-- | datapath/vport-internal_dev.c | 25 | ||||
-rw-r--r-- | datapath/vport-netdev.c | 64 | ||||
-rw-r--r-- | datapath/vport-patch.c | 58 | ||||
-rw-r--r-- | datapath/vport.c | 144 | ||||
-rw-r--r-- | datapath/vport.h | 6 |
12 files changed, 203 insertions, 357 deletions
diff --git a/datapath/actions.c b/datapath/actions.c index 131548c7..51fb3105 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -24,8 +24,7 @@ #include "openvswitch/datapath-protocol.h" #include "vport.h" -static struct sk_buff * -make_writable(struct sk_buff *skb, unsigned min_headroom, gfp_t gfp) +static struct sk_buff *make_writable(struct sk_buff *skb, unsigned min_headroom, gfp_t gfp) { if (skb_shared(skb) || skb_cloned(skb)) { struct sk_buff *nskb; @@ -53,8 +52,7 @@ static void set_tunnel(struct sk_buff *skb, struct odp_flow_key *key, OVS_CB(skb)->tun_id = key->tun_id = tun_id; } -static struct sk_buff * -vlan_pull_tag(struct sk_buff *skb) +static struct sk_buff *vlan_pull_tag(struct sk_buff *skb) { struct vlan_ethhdr *vh = vlan_eth_hdr(skb); struct ethhdr *eh; @@ -78,10 +76,9 @@ vlan_pull_tag(struct sk_buff *skb) } -static struct sk_buff * -modify_vlan_tci(struct datapath *dp, struct sk_buff *skb, - struct odp_flow_key *key, const union odp_action *a, - int n_actions, gfp_t gfp) +static struct sk_buff *modify_vlan_tci(struct datapath *dp, struct sk_buff *skb, + struct odp_flow_key *key, const union odp_action *a, + int n_actions, gfp_t gfp) { u16 tci, mask; @@ -313,10 +310,8 @@ static struct sk_buff *set_nw_tos(struct sk_buff *skb, return skb; } -static struct sk_buff * -set_tp_port(struct sk_buff *skb, struct odp_flow_key *key, - const struct odp_action_tp_port *a, - gfp_t gfp) +static struct sk_buff *set_tp_port(struct sk_buff *skb, struct odp_flow_key *key, + const struct odp_action_tp_port *a, gfp_t gfp) { int check_ofs; @@ -347,8 +342,7 @@ set_tp_port(struct sk_buff *skb, struct odp_flow_key *key, return skb; } -static void -do_output(struct datapath *dp, struct sk_buff *skb, int out_port) +static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port) { struct dp_port *p; @@ -392,8 +386,8 @@ static int output_group(struct datapath *dp, __u16 group, return prev_port; } -static int -output_control(struct datapath *dp, struct sk_buff *skb, u32 arg, gfp_t gfp) +static int output_control(struct datapath *dp, struct sk_buff *skb, u32 arg, + gfp_t gfp) { skb = skb_clone(skb, gfp); if (!skb) diff --git a/datapath/actions.h b/datapath/actions.h index 9dfca365..09e35bd7 100644 --- a/datapath/actions.h +++ b/datapath/actions.h @@ -22,8 +22,8 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb, const union odp_action *, int n_actions, gfp_t gfp); -static inline void -set_skb_csum_bits(const struct sk_buff *old_skb, struct sk_buff *new_skb) +static inline void set_skb_csum_bits(const struct sk_buff *old_skb, + struct sk_buff *new_skb) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) /* Before 2.6.24 these fields were not copied when diff --git a/datapath/brcompat.c b/datapath/brcompat.c index b7fb6f87..b68720bd 100644 --- a/datapath/brcompat.c +++ b/datapath/brcompat.c @@ -42,8 +42,8 @@ static u32 brc_seq; /* Sequence number for current op. */ static struct sk_buff *brc_send_command(struct sk_buff *, struct nlattr **attrs); static int brc_send_simple_command(struct sk_buff *); -static struct sk_buff * -brc_make_request(int op, const char *bridge, const char *port) +static struct sk_buff *brc_make_request(int op, const char *bridge, + const char *port) { struct sk_buff *skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); if (!skb) @@ -146,8 +146,7 @@ static int brc_get_bridges(int __user *uindices, int n) } /* Legacy deviceless bridge ioctl's. Called with br_ioctl_mutex. */ -static int -old_deviceless(void __user *uarg) +static int old_deviceless(void __user *uarg) { unsigned long args[3]; @@ -189,8 +188,7 @@ brc_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __user *uarg) return -EOPNOTSUPP; } -static int -brc_add_del_port(struct net_device *dev, int port_ifindex, int add) +static int brc_add_del_port(struct net_device *dev, int port_ifindex, int add) { struct sk_buff *request; struct net_device *port; @@ -214,8 +212,8 @@ brc_add_del_port(struct net_device *dev, int port_ifindex, int add) return err; } -static int -brc_get_bridge_info(struct net_device *dev, struct __bridge_info __user *ub) +static int brc_get_bridge_info(struct net_device *dev, + struct __bridge_info __user *ub) { struct __bridge_info b; u64 id = 0; @@ -234,8 +232,8 @@ brc_get_bridge_info(struct net_device *dev, struct __bridge_info __user *ub) return 0; } -static int -brc_get_port_list(struct net_device *dev, int __user *uindices, int num) +static int brc_get_port_list(struct net_device *dev, int __user *uindices, + int num) { int retval; @@ -306,8 +304,7 @@ nla_put_failure: } /* Legacy ioctl's through SIOCDEVPRIVATE. Called with rtnl_lock. */ -static int -old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { unsigned long args[4]; @@ -335,8 +332,7 @@ old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } /* Called with the rtnl_lock. */ -static int -brc_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static int brc_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { int err; @@ -413,8 +409,7 @@ static struct nla_policy brc_genl_policy[BRC_GENL_A_MAX + 1] = { [BRC_GENL_A_FDB_DATA] = { .type = NLA_UNSPEC }, }; -static int -brc_genl_dp_result(struct sk_buff *skb, struct genl_info *info) +static int brc_genl_dp_result(struct sk_buff *skb, struct genl_info *info) { unsigned long int flags; int err; @@ -461,7 +456,8 @@ static struct genl_ops brc_genl_ops_set_proc = { .dumpit = NULL }; -static struct sk_buff *brc_send_command(struct sk_buff *request, struct nlattr **attrs) +static struct sk_buff *brc_send_command(struct sk_buff *request, + struct nlattr **attrs) { unsigned long int flags; struct sk_buff *reply; @@ -511,8 +507,7 @@ error: return ERR_PTR(error); } -static int -__init brc_init(void) +static int __init brc_init(void) { int err; @@ -561,8 +556,7 @@ error: return err; } -static void -brc_cleanup(void) +static void brc_cleanup(void) { /* Unregister ioctl hooks */ dp_ioctl_hook = NULL; diff --git a/datapath/datapath.c b/datapath/datapath.c index 2681fed7..eb260e33 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -656,8 +656,7 @@ out: * be reverified). If we receive a packet with CHECKSUM_HW that really means * CHECKSUM_PARTIAL, it will be sent with the wrong checksum. However, there * shouldn't be any devices that do this with bridging. */ -void -compute_ip_summed(struct sk_buff *skb, bool xmit) +void compute_ip_summed(struct sk_buff *skb, bool xmit) { /* For our convenience these defines change repeatedly between kernel * versions, so we can't just copy them over... */ @@ -714,8 +713,7 @@ compute_ip_summed(struct sk_buff *skb, bool xmit) * is slightly different because we are only concerned with bridging and not * other types of forwarding and can get away with slightly more optimal * behavior.*/ -void -forward_ip_summed(struct sk_buff *skb) +void forward_ip_summed(struct sk_buff *skb) { #ifdef CHECKSUM_HW if (OVS_CB(skb)->ip_summed == OVS_CSUM_COMPLETE) @@ -725,9 +723,8 @@ forward_ip_summed(struct sk_buff *skb) /* Append each packet in 'skb' list to 'queue'. There will be only one packet * unless we broke up a GSO packet. */ -static int -queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue, - int queue_no, u32 arg) +static int queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue, + int queue_no, u32 arg) { struct sk_buff *nskb; int port_no; @@ -769,9 +766,8 @@ err_kfree_skbs: return err; } -int -dp_output_control(struct datapath *dp, struct sk_buff *skb, int queue_no, - u32 arg) +int dp_output_control(struct datapath *dp, struct sk_buff *skb, int queue_no, + u32 arg) { struct dp_stats_percpu *stats; struct sk_buff_head *queue; @@ -1379,8 +1375,7 @@ void set_internal_devs_mtu(const struct datapath *dp) } } -static int -put_port(const struct dp_port *p, struct odp_port __user *uop) +static int put_port(const struct dp_port *p, struct odp_port __user *uop) { struct odp_port op; @@ -1396,8 +1391,7 @@ put_port(const struct dp_port *p, struct odp_port __user *uop) return copy_to_user(uop, &op, sizeof op) ? -EFAULT : 0; } -static int -query_port(struct datapath *dp, struct odp_port __user *uport) +static int query_port(struct datapath *dp, struct odp_port __user *uport) { struct odp_port port; @@ -1444,8 +1438,8 @@ error_unlock: return put_port(dp->ports[port.port], uport); } -static int -do_list_ports(struct datapath *dp, struct odp_port __user *uports, int n_ports) +static int do_list_ports(struct datapath *dp, struct odp_port __user *uports, + int n_ports) { int idx = 0; if (n_ports) { @@ -1461,8 +1455,7 @@ do_list_ports(struct datapath *dp, struct odp_port __user *uports, int n_ports) return idx; } -static int -list_ports(struct datapath *dp, struct odp_portvec __user *upv) +static int list_ports(struct datapath *dp, struct odp_portvec __user *upv) { struct odp_portvec pv; int retval; @@ -1484,8 +1477,8 @@ static void free_port_group(struct rcu_head *rcu) kfree(g); } -static int -do_set_port_group(struct datapath *dp, u16 __user *ports, int n_ports, int group) +static int do_set_port_group(struct datapath *dp, u16 __user *ports, + int n_ports, int group) { struct dp_port_group *new_group, *old_group; int error; @@ -1516,8 +1509,8 @@ error: return error; } -static int -set_port_group(struct datapath *dp, const struct odp_port_group __user *upg) +static int set_port_group(struct datapath *dp, + const struct odp_port_group __user *upg) { struct odp_port_group pg; @@ -1527,10 +1520,9 @@ set_port_group(struct datapath *dp, const struct odp_port_group __user *upg) return do_set_port_group(dp, pg.ports, pg.n_ports, pg.group); } -static int -do_get_port_group(struct datapath *dp, - u16 __user *ports, int n_ports, int group, - u16 __user *n_portsp) +static int do_get_port_group(struct datapath *dp, + u16 __user *ports, int n_ports, int group, + u16 __user *n_portsp) { struct dp_port_group *g; u16 n_copy; diff --git a/datapath/table.c b/datapath/table.c index e4561d69..5ea2c93b 100644 --- a/datapath/table.c +++ b/datapath/table.c @@ -367,7 +367,7 @@ int tbl_insert(struct tbl *table, struct tbl_node *target, u32 hash) } /** - * tbl_delete - remove object from table + * tbl_remove - remove object from table * @table: table from which to remove object * @target: tbl_node inside of object to remove * diff --git a/datapath/vport-generic.c b/datapath/vport-generic.c index 72909d9b..5bb27c78 100644 --- a/datapath/vport-generic.c +++ b/datapath/vport-generic.c @@ -10,8 +10,7 @@ #include "vport-generic.h" -void -vport_gen_rand_ether_addr(u8 *addr) +void vport_gen_rand_ether_addr(u8 *addr) { random_ether_addr(addr); @@ -24,20 +23,17 @@ vport_gen_rand_ether_addr(u8 *addr) addr[3] |= 0x80; } -unsigned -vport_gen_get_dev_flags(const struct vport *vport) +unsigned vport_gen_get_dev_flags(const struct vport *vport) { return IFF_UP | IFF_RUNNING | IFF_LOWER_UP; } -int -vport_gen_is_running(const struct vport *vport) +int vport_gen_is_running(const struct vport *vport) { return 1; } -unsigned char -vport_gen_get_operstate(const struct vport *vport) +unsigned char vport_gen_get_operstate(const struct vport *vport) { return IF_OPER_UP; } diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 41d3c960..883e5dc2 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -74,34 +74,30 @@ static unsigned int key_remote_ports; static unsigned int local_remote_ports; static unsigned int remote_ports; -static inline struct gre_vport * -gre_vport_priv(const struct vport *vport) +static inline struct gre_vport *gre_vport_priv(const struct vport *vport) { return vport_priv(vport); } -static inline struct vport * -gre_vport_to_vport(const struct gre_vport *gre_vport) +static inline struct vport *gre_vport_to_vport(const struct gre_vport *gre_vport) { return vport_from_priv(gre_vport); } -static inline struct gre_vport * -gre_vport_table_cast(const struct tbl_node *node) +static inline struct gre_vport *gre_vport_table_cast(const struct tbl_node *node) { return container_of(node, struct gre_vport, tbl_node); } /* RCU callback. */ -static void -free_config(struct rcu_head *rcu) +static void free_config(struct rcu_head *rcu) { struct mutable_config *c = container_of(rcu, struct mutable_config, rcu); kfree(c); } -static void -assign_config_rcu(struct vport *vport, struct mutable_config *new_config) +static void assign_config_rcu(struct vport *vport, + struct mutable_config *new_config) { struct gre_vport *gre_vport = gre_vport_priv(vport); struct mutable_config *old_config; @@ -111,8 +107,7 @@ assign_config_rcu(struct vport *vport, struct mutable_config *new_config) call_rcu(&old_config->rcu, free_config); } -static unsigned int * -find_port_pool(const struct mutable_config *mutable) +static unsigned int *find_port_pool(const struct mutable_config *mutable) { if (mutable->port_config.flags & GRE_F_IN_KEY_MATCH) { if (mutable->port_config.saddr) @@ -141,8 +136,7 @@ struct port_lookup_key { /* Modifies 'target' to store the rcu_dereferenced pointer that was used to do * the comparision. */ -static int -port_cmp(const struct tbl_node *node, void *target) +static int port_cmp(const struct tbl_node *node, void *target) { const struct gre_vport *gre_vport = gre_vport_table_cast(node); struct port_lookup_key *lookup = target; @@ -156,14 +150,12 @@ port_cmp(const struct tbl_node *node, void *target) lookup->mutable->port_config.saddr == lookup->vals[LOOKUP_SADDR]; } -static u32 -port_hash(struct port_lookup_key *lookup) +static u32 port_hash(struct port_lookup_key *lookup) { return jhash2(lookup->vals, ARRAY_SIZE(lookup->vals), 0); } -static int -add_port(struct vport *vport) +static int add_port(struct vport *vport) { struct gre_vport *gre_vport = gre_vport_priv(vport); struct port_lookup_key lookup; @@ -204,8 +196,7 @@ add_port(struct vport *vport) return 0; } -static int -del_port(struct vport *vport) +static int del_port(struct vport *vport) { struct gre_vport *gre_vport = gre_vport_priv(vport); int err; @@ -223,9 +214,9 @@ del_port(struct vport *vport) #define FIND_PORT_MATCH (1 << 1) #define FIND_PORT_ANY (FIND_PORT_KEY | FIND_PORT_MATCH) -static struct vport * -find_port(__be32 saddr, __be32 daddr, __be32 key, int port_type, - const struct mutable_config **mutable) +static struct vport *find_port(__be32 saddr, __be32 daddr, __be32 key, + int port_type, + const struct mutable_config **mutable) { struct port_lookup_key lookup; struct tbl *table = rcu_dereference(port_table); @@ -284,8 +275,7 @@ found: return gre_vport_to_vport(gre_vport_table_cast(tbl_node)); } -static bool -check_ipv4_address(__be32 addr) +static bool check_ipv4_address(__be32 addr) { if (ipv4_is_multicast(addr) || ipv4_is_lbcast(addr) || ipv4_is_loopback(addr) || ipv4_is_zeronet(addr)) @@ -294,8 +284,7 @@ check_ipv4_address(__be32 addr) return true; } -static bool -ipv4_should_icmp(struct sk_buff *skb) +static bool ipv4_should_icmp(struct sk_buff *skb) { struct iphdr *old_iph = ip_hdr(skb); @@ -335,9 +324,8 @@ ipv4_should_icmp(struct sk_buff *skb) return true; } -static void -ipv4_build_icmp(struct sk_buff *skb, struct sk_buff *nskb, - unsigned int mtu, unsigned int payload_length) +static void ipv4_build_icmp(struct sk_buff *skb, struct sk_buff *nskb, + unsigned int mtu, unsigned int payload_length) { struct iphdr *iph, *old_iph = ip_hdr(skb); struct icmphdr *icmph; @@ -378,8 +366,7 @@ ipv4_build_icmp(struct sk_buff *skb, struct sk_buff *nskb, } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -static bool -ipv6_should_icmp(struct sk_buff *skb) +static bool ipv6_should_icmp(struct sk_buff *skb) { struct ipv6hdr *old_ipv6h = ipv6_hdr(skb); int addr_type; @@ -415,9 +402,8 @@ ipv6_should_icmp(struct sk_buff *skb) return true; } -static void -ipv6_build_icmp(struct sk_buff *skb, struct sk_buff *nskb, unsigned int mtu, - unsigned int payload_length) +static void ipv6_build_icmp(struct sk_buff *skb, struct sk_buff *nskb, + unsigned int mtu, unsigned int payload_length) { struct ipv6hdr *ipv6h, *old_ipv6h = ipv6_hdr(skb); struct icmp6hdr *icmp6h; @@ -455,9 +441,10 @@ ipv6_build_icmp(struct sk_buff *skb, struct sk_buff *nskb, unsigned int mtu, } #endif /* IPv6 */ -static bool -send_frag_needed(struct vport *vport, const struct mutable_config *mutable, - struct sk_buff *skb, unsigned int mtu, __be32 flow_key) +static bool send_frag_needed(struct vport *vport, + const struct mutable_config *mutable, + struct sk_buff *skb, unsigned int mtu, + __be32 flow_key) { unsigned int eth_hdr_len = ETH_HLEN; unsigned int total_length = 0, header_length = 0, payload_length; @@ -554,8 +541,7 @@ send_frag_needed(struct vport *vport, const struct mutable_config *mutable, return true; } -static struct sk_buff * -check_headroom(struct sk_buff *skb, int headroom) +static struct sk_buff *check_headroom(struct sk_buff *skb, int headroom) { if (skb_headroom(skb) < headroom || skb_header_cloned(skb)) { struct sk_buff *nskb = skb_realloc_headroom(skb, headroom + 16); @@ -576,8 +562,8 @@ check_headroom(struct sk_buff *skb, int headroom) return skb; } -static void -create_gre_header(struct sk_buff *skb, const struct mutable_config *mutable) +static void create_gre_header(struct sk_buff *skb, + const struct mutable_config *mutable) { struct iphdr *iph = ip_hdr(skb); __be16 *flags = (__be16 *)(iph + 1); @@ -612,8 +598,7 @@ create_gre_header(struct sk_buff *skb, const struct mutable_config *mutable) } } -static int -check_checksum(struct sk_buff *skb) +static int check_checksum(struct sk_buff *skb) { struct iphdr *iph = ip_hdr(skb); __be16 flags = *(__be16 *)(iph + 1); @@ -639,8 +624,7 @@ check_checksum(struct sk_buff *skb) return (csum == 0); } -static int -parse_gre_header(struct iphdr *iph, __be16 *flags, __be32 *key) +static int parse_gre_header(struct iphdr *iph, __be16 *flags, __be32 *key) { /* IP and ICMP protocol handlers check that the IHL is valid. */ __be16 *flagsp = (__be16 *)((u8 *)iph + (iph->ihl << 2)); @@ -677,8 +661,7 @@ parse_gre_header(struct iphdr *iph, __be16 *flags, __be32 *key) return hdr_len; } -static inline u8 -ecn_encapsulate(u8 tos, struct sk_buff *skb) +static inline u8 ecn_encapsulate(u8 tos, struct sk_buff *skb) { u8 inner; @@ -694,8 +677,7 @@ ecn_encapsulate(u8 tos, struct sk_buff *skb) return INET_ECN_encapsulate(tos, inner); } -static inline void -ecn_decapsulate(u8 tos, struct sk_buff *skb) +static inline void ecn_decapsulate(u8 tos, struct sk_buff *skb) { if (INET_ECN_is_ce(tos)) { __be16 protocol = skb->protocol; @@ -729,8 +711,7 @@ ecn_decapsulate(u8 tos, struct sk_buff *skb) } } -static struct sk_buff * -handle_gso(struct sk_buff *skb) +static struct sk_buff *handle_gso(struct sk_buff *skb) { if (skb_is_gso(skb)) { struct sk_buff *nskb = skb_gso_segment(skb, 0); @@ -742,8 +723,7 @@ handle_gso(struct sk_buff *skb) return skb; } -static int -handle_csum_offload(struct sk_buff *skb) +static int handle_csum_offload(struct sk_buff *skb) { if (skb->ip_summed == CHECKSUM_PARTIAL) return skb_checksum_help(skb); @@ -754,8 +734,7 @@ handle_csum_offload(struct sk_buff *skb) } /* Called with rcu_read_lock. */ -static void -gre_err(struct sk_buff *skb, u32 info) +static void gre_err(struct sk_buff *skb, u32 info) { struct vport *vport; const struct mutable_config *mutable; @@ -871,8 +850,7 @@ out: } /* Called with rcu_read_lock. */ -static int -gre_rcv(struct sk_buff *skb) +static int gre_rcv(struct sk_buff *skb) { struct vport *vport; const struct mutable_config *mutable; @@ -937,10 +915,9 @@ error: return 0; } -static int -build_packet(struct vport *vport, const struct mutable_config *mutable, - struct iphdr *iph, struct rtable *rt, int max_headroom, int mtu, - struct sk_buff *skb) +static int build_packet(struct vport *vport, const struct mutable_config *mutable, + struct iphdr *iph, struct rtable *rt, int max_headroom, + int mtu, struct sk_buff *skb) { int err; struct iphdr *new_iph; @@ -1014,8 +991,7 @@ error: return 0; } -static int -gre_send(struct vport *vport, struct sk_buff *skb) +static int gre_send(struct vport *vport, struct sk_buff *skb) { struct gre_vport *gre_vport = gre_vport_priv(vport); const struct mutable_config *mutable = rcu_dereference(gre_vport->mutable); @@ -1167,8 +1143,7 @@ static struct net_protocol gre_protocol_handlers = { .err_handler = gre_err, }; -static int -gre_init(void) +static int gre_init(void) { int err; @@ -1179,16 +1154,14 @@ gre_init(void) return err; } -static void -gre_exit(void) +static void gre_exit(void) { tbl_destroy(port_table, NULL); inet_del_protocol(&gre_protocol_handlers, IPPROTO_GRE); } -static int -set_config(const struct vport *cur_vport, struct mutable_config *mutable, - const void __user *uconfig) +static int set_config(const struct vport *cur_vport, + struct mutable_config *mutable, const void __user *uconfig) { const struct vport *old_vport; const struct mutable_config *old_mutable; @@ -1229,8 +1202,7 @@ set_config(const struct vport *cur_vport, struct mutable_config *mutable, return 0; } -static struct vport * -gre_create(const char *name, const void __user *config) +static struct vport *gre_create(const char *name, const void __user *config) { struct vport *vport; struct gre_vport *gre_vport; @@ -1273,8 +1245,7 @@ error: return ERR_PTR(err); } -static int -gre_modify(struct vport *vport, const void __user *config) +static int gre_modify(struct vport *vport, const void __user *config) { struct gre_vport *gre_vport = gre_vport_priv(vport); struct mutable_config *mutable; @@ -1325,8 +1296,7 @@ error: return err; } -static int -gre_destroy(struct vport *vport) +static int gre_destroy(struct vport *vport) { struct gre_vport *gre_vport = gre_vport_priv(vport); int port_type; @@ -1350,8 +1320,7 @@ gre_destroy(struct vport *vport) return 0; } -static int -gre_set_mtu(struct vport *vport, int mtu) +static int gre_set_mtu(struct vport *vport, int mtu) { struct gre_vport *gre_vport = gre_vport_priv(vport); struct mutable_config *mutable; @@ -1366,8 +1335,7 @@ gre_set_mtu(struct vport *vport, int mtu) return 0; } -static int -gre_set_addr(struct vport *vport, const unsigned char *addr) +static int gre_set_addr(struct vport *vport, const unsigned char *addr) { struct gre_vport *gre_vport = gre_vport_priv(vport); struct mutable_config *mutable; @@ -1383,22 +1351,19 @@ gre_set_addr(struct vport *vport, const unsigned char *addr) } -static const char * -gre_get_name(const struct vport *vport) +static const char *gre_get_name(const struct vport *vport) { const struct gre_vport *gre_vport = gre_vport_priv(vport); return gre_vport->name; } -static const unsigned char * -gre_get_addr(const struct vport *vport) +static const unsigned char *gre_get_addr(const struct vport *vport) { const struct gre_vport *gre_vport = gre_vport_priv(vport); return rcu_dereference(gre_vport->mutable)->eth_addr; } -static int -gre_get_mtu(const struct vport *vport) +static int gre_get_mtu(const struct vport *vport) { const struct gre_vport *gre_vport = gre_vport_priv(vport); return rcu_dereference(gre_vport->mutable)->mtu; diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index c4937ed3..eca2a60b 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -161,8 +161,7 @@ static const struct net_device_ops internal_dev_netdev_ops = { }; #endif -static void -do_setup(struct net_device *netdev) +static void do_setup(struct net_device *netdev) { ether_setup(netdev); @@ -189,8 +188,8 @@ do_setup(struct net_device *netdev) vport_gen_rand_ether_addr(netdev->dev_addr); } -static struct vport * -internal_dev_create(const char *name, const void __user *config) +static struct vport *internal_dev_create(const char *name, + const void __user *config) { struct vport *vport; struct netdev_vport *netdev_vport; @@ -228,8 +227,7 @@ error: return ERR_PTR(err); } -static int -internal_dev_destroy(struct vport *vport) +static int internal_dev_destroy(struct vport *vport) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -239,8 +237,7 @@ internal_dev_destroy(struct vport *vport) return 0; } -static int -internal_dev_attach(struct vport *vport) +static int internal_dev_attach(struct vport *vport) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -254,8 +251,7 @@ internal_dev_attach(struct vport *vport) return 0; } -static int -internal_dev_detach(struct vport *vport) +static int internal_dev_detach(struct vport *vport) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -269,8 +265,7 @@ internal_dev_detach(struct vport *vport) return 0; } -static int -internal_dev_recv(struct vport *vport, struct sk_buff *skb) +static int internal_dev_recv(struct vport *vport, struct sk_buff *skb) { struct net_device *netdev = netdev_vport_priv(vport)->dev; int len; @@ -319,14 +314,12 @@ int is_internal_dev(const struct net_device *netdev) #endif } -int -is_internal_vport(const struct vport *vport) +int is_internal_vport(const struct vport *vport) { return vport->ops == &internal_vport_ops; } -struct vport * -internal_dev_get_vport(struct net_device *netdev) +struct vport *internal_dev_get_vport(struct net_device *netdev) { struct internal_dev *internal_dev = internal_dev_priv(netdev); return rcu_dereference(internal_dev->vport); diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 72d2928d..51724955 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -33,16 +33,15 @@ static void netdev_port_receive(struct net_bridge_port *, struct sk_buff *); */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) /* Called with rcu_read_lock and bottom-halves disabled. */ -static struct sk_buff * -netdev_frame_hook(struct net_bridge_port *p, struct sk_buff *skb) +static struct sk_buff *netdev_frame_hook(struct net_bridge_port *p, + struct sk_buff *skb) { netdev_port_receive(p, skb); return NULL; } #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) /* Called with rcu_read_lock and bottom-halves disabled. */ -static int -netdev_frame_hook(struct net_bridge_port *p, struct sk_buff **pskb) +static int netdev_frame_hook(struct net_bridge_port *p, struct sk_buff **pskb) { netdev_port_receive(p, *pskb); return 1; @@ -51,8 +50,7 @@ netdev_frame_hook(struct net_bridge_port *p, struct sk_buff **pskb) #error #endif -static int -netdev_init(void) +static int netdev_init(void) { /* Hook into callback used by the bridge to intercept packets. * Parasites we are. */ @@ -67,8 +65,7 @@ netdev_exit(void) br_handle_frame_hook = NULL; } -static struct vport * -netdev_create(const char *name, const void __user *config) +static struct vport *netdev_create(const char *name, const void __user *config) { struct vport *vport; struct netdev_vport *netdev_vport; @@ -120,8 +117,7 @@ error: return ERR_PTR(err); } -static int -netdev_destroy(struct vport *vport) +static int netdev_destroy(struct vport *vport) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -131,8 +127,7 @@ netdev_destroy(struct vport *vport) return 0; } -static int -netdev_attach(struct vport *vport) +static int netdev_attach(struct vport *vport) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -143,8 +138,7 @@ netdev_attach(struct vport *vport) return 0; } -static int -netdev_detach(struct vport *vport) +static int netdev_detach(struct vport *vport) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -154,15 +148,13 @@ netdev_detach(struct vport *vport) return 0; } -int -netdev_set_mtu(struct vport *vport, int mtu) +int netdev_set_mtu(struct vport *vport, int mtu) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return dev_set_mtu(netdev_vport->dev, mtu); } -int -netdev_set_addr(struct vport *vport, const unsigned char *addr) +int netdev_set_addr(struct vport *vport, const unsigned char *addr) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); struct sockaddr sa; @@ -173,29 +165,25 @@ netdev_set_addr(struct vport *vport, const unsigned char *addr) return dev_set_mac_address(netdev_vport->dev, &sa); } -const char * -netdev_get_name(const struct vport *vport) +const char *netdev_get_name(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return netdev_vport->dev->name; } -const unsigned char * -netdev_get_addr(const struct vport *vport) +const unsigned char *netdev_get_addr(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return netdev_vport->dev->dev_addr; } -struct kobject * -netdev_get_kobj(const struct vport *vport) +struct kobject *netdev_get_kobj(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return &netdev_vport->dev->NETDEV_DEV_MEMBER.kobj; } -int -netdev_get_stats(const struct vport *vport, struct odp_vport_stats *stats) +int netdev_get_stats(const struct vport *vport, struct odp_vport_stats *stats) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); const struct net_device_stats *netdev_stats; @@ -218,22 +206,19 @@ netdev_get_stats(const struct vport *vport, struct odp_vport_stats *stats) return 0; } -unsigned -netdev_get_dev_flags(const struct vport *vport) +unsigned netdev_get_dev_flags(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return dev_get_flags(netdev_vport->dev); } -int -netdev_is_running(const struct vport *vport) +int netdev_is_running(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return netif_running(netdev_vport->dev); } -unsigned char -netdev_get_operstate(const struct vport *vport) +unsigned char netdev_get_operstate(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return netdev_vport->dev->operstate; @@ -246,23 +231,20 @@ netdev_get_ifindex(const struct vport *vport) return netdev_vport->dev->ifindex; } -int -netdev_get_iflink(const struct vport *vport) +int netdev_get_iflink(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return netdev_vport->dev->iflink; } -int -netdev_get_mtu(const struct vport *vport) +int netdev_get_mtu(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); return netdev_vport->dev->mtu; } /* Must be called with rcu_read_lock. */ -static void -netdev_port_receive(struct net_bridge_port *p, struct sk_buff *skb) +static void netdev_port_receive(struct net_bridge_port *p, struct sk_buff *skb) { struct vport *vport = (struct vport *)p; @@ -282,8 +264,7 @@ netdev_port_receive(struct net_bridge_port *p, struct sk_buff *skb) vport_receive(vport, skb); } -static int -netdev_send(struct vport *vport, struct sk_buff *skb) +static int netdev_send(struct vport *vport, struct sk_buff *skb) { struct netdev_vport *netdev_vport = netdev_vport_priv(vport); int len = skb->len; @@ -296,8 +277,7 @@ netdev_send(struct vport *vport, struct sk_buff *skb) } /* Returns null if this device is not attached to a datapath. */ -struct vport * -netdev_get_vport(struct net_device *dev) +struct vport *netdev_get_vport(struct net_device *dev) { return (struct vport *)dev->br_port; } diff --git a/datapath/vport-patch.c b/datapath/vport-patch.c index ff94be00..d55a1bf2 100644 --- a/datapath/vport-patch.c +++ b/datapath/vport-patch.c @@ -39,22 +39,20 @@ struct patch_vport { static struct hlist_head *peer_table; #define PEER_HASH_BUCKETS 256 -static inline struct patch_vport * -patch_vport_priv(const struct vport *vport) +static inline struct patch_vport *patch_vport_priv(const struct vport *vport) { return vport_priv(vport); } /* RCU callback. */ -static void -free_config(struct rcu_head *rcu) +static void free_config(struct rcu_head *rcu) { struct device_config *c = container_of(rcu, struct device_config, rcu); kfree(c); } -static void -assign_config_rcu(struct vport *vport, struct device_config *new_config) +static void assign_config_rcu(struct vport *vport, + struct device_config *new_config) { struct patch_vport *patch_vport = patch_vport_priv(vport); struct device_config *old_config; @@ -64,15 +62,13 @@ assign_config_rcu(struct vport *vport, struct device_config *new_config) call_rcu(&old_config->rcu, free_config); } -static struct hlist_head * -hash_bucket(const char *name) +static struct hlist_head *hash_bucket(const char *name) { unsigned int hash = full_name_hash(name, strlen(name)); return &peer_table[hash & (PEER_HASH_BUCKETS - 1)]; } -static int -patch_init(void) +static int patch_init(void) { peer_table = kzalloc(PEER_HASH_BUCKETS * sizeof(struct hlist_head), GFP_KERNEL); @@ -82,14 +78,12 @@ patch_init(void) return 0; } -static void -patch_exit(void) +static void patch_exit(void) { kfree(peer_table); } -static int -set_config(struct vport *vport, const void __user *uconfig) +static int set_config(struct vport *vport, const void __user *uconfig) { struct patch_vport *patch_vport = patch_vport_priv(vport); char peer_name[IFNAMSIZ]; @@ -115,8 +109,7 @@ set_config(struct vport *vport, const void __user *uconfig) return 0; } -static struct vport * -patch_create(const char *name, const void __user *config) +static struct vport *patch_create(const char *name, const void __user *config) { struct vport *vport; struct patch_vport *patch_vport; @@ -153,14 +146,12 @@ error: return ERR_PTR(err); } -static int -patch_modify(struct vport *vport, const void __user *config) +static int patch_modify(struct vport *vport, const void __user *config) { return set_config(vport, config); } -static int -patch_destroy(struct vport *vport) +static int patch_destroy(struct vport *vport) { struct patch_vport *patch_vport = patch_vport_priv(vport); @@ -170,8 +161,7 @@ patch_destroy(struct vport *vport) return 0; } -static void -update_peers(const char *name, struct vport *vport) +static void update_peers(const char *name, struct vport *vport) { struct hlist_head *bucket = hash_bucket(name); struct patch_vport *peer_vport; @@ -182,8 +172,7 @@ update_peers(const char *name, struct vport *vport) rcu_assign_pointer(peer_vport->peer, vport); } -static int -patch_attach(struct vport *vport) +static int patch_attach(struct vport *vport) { struct patch_vport *patch_vport = patch_vport_priv(vport); @@ -195,8 +184,7 @@ patch_attach(struct vport *vport) return 0; } -static int -patch_detach(struct vport *vport) +static int patch_detach(struct vport *vport) { struct patch_vport *patch_vport = patch_vport_priv(vport); @@ -208,8 +196,7 @@ patch_detach(struct vport *vport) return 0; } -static int -patch_set_mtu(struct vport *vport, int mtu) +static int patch_set_mtu(struct vport *vport, int mtu) { struct patch_vport *patch_vport = patch_vport_priv(vport); struct device_config *devconf; @@ -224,8 +211,7 @@ patch_set_mtu(struct vport *vport, int mtu) return 0; } -static int -patch_set_addr(struct vport *vport, const unsigned char *addr) +static int patch_set_addr(struct vport *vport, const unsigned char *addr) { struct patch_vport *patch_vport = patch_vport_priv(vport); struct device_config *devconf; @@ -241,29 +227,25 @@ patch_set_addr(struct vport *vport, const unsigned char *addr) } -static const char * -patch_get_name(const struct vport *vport) +static const char *patch_get_name(const struct vport *vport) { const struct patch_vport *patch_vport = patch_vport_priv(vport); return patch_vport->name; } -static const unsigned char * -patch_get_addr(const struct vport *vport) +static const unsigned char *patch_get_addr(const struct vport *vport) { const struct patch_vport *patch_vport = patch_vport_priv(vport); return rcu_dereference(patch_vport->devconf)->eth_addr; } -static int -patch_get_mtu(const struct vport *vport) +static int patch_get_mtu(const struct vport *vport) { const struct patch_vport *patch_vport = patch_vport_priv(vport); return rcu_dereference(patch_vport->devconf)->mtu; } -static int -patch_send(struct vport *vport, struct sk_buff *skb) +static int patch_send(struct vport *vport, struct sk_buff *skb) { struct patch_vport *patch_vport = patch_vport_priv(vport); struct vport *peer = rcu_dereference(patch_vport->peer); diff --git a/datapath/vport.c b/datapath/vport.c index 5b865e16..5437a975 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -68,8 +68,7 @@ static DEFINE_MUTEX(vport_mutex); * Acquire global vport lock. See above comment about locking requirements * and specific function definitions. May sleep. */ -void -vport_lock(void) +void vport_lock(void) { mutex_lock(&vport_mutex); } @@ -79,8 +78,7 @@ vport_lock(void) * * Release lock acquired with vport_lock. */ -void -vport_unlock(void) +void vport_unlock(void) { mutex_unlock(&vport_mutex); } @@ -99,8 +97,7 @@ vport_unlock(void) * Called at module load time to initialize the vport subsystem and any * compiled in vport types. */ -int -vport_init(void) +int vport_init(void) { int err; int i; @@ -151,8 +148,7 @@ error: return err; } -static void -vport_del_all(void) +static void vport_del_all(void) { int i; @@ -178,8 +174,7 @@ vport_del_all(void) * Called at module exit time to shutdown the vport subsystem and any * initialized vport types. */ -void -vport_exit(void) +void vport_exit(void) { int i; @@ -195,8 +190,7 @@ vport_exit(void) kfree(dev_table); } -static int -do_vport_add(struct odp_vport_add *vport_config) +static int do_vport_add(struct odp_vport_add *vport_config) { struct vport *vport; int err = 0; @@ -234,8 +228,7 @@ out: * on device type). This function is for userspace callers and assumes no * locks are held. */ -int -vport_user_add(const struct odp_vport_add __user *uvport_config) +int vport_user_add(const struct odp_vport_add __user *uvport_config) { struct odp_vport_add vport_config; @@ -246,8 +239,7 @@ vport_user_add(const struct odp_vport_add __user *uvport_config) } #ifdef CONFIG_COMPAT -int -compat_vport_user_add(struct compat_odp_vport_add *ucompat) +int compat_vport_user_add(struct compat_odp_vport_add *ucompat) { struct compat_odp_vport_add compat; struct odp_vport_add vport_config; @@ -263,8 +255,7 @@ compat_vport_user_add(struct compat_odp_vport_add *ucompat) } #endif -static int -do_vport_mod(struct odp_vport_mod *vport_config) +static int do_vport_mod(struct odp_vport_mod *vport_config) { struct vport *vport; int err; @@ -297,8 +288,7 @@ out: * dependent on device type). This function is for userspace callers and * assumes no locks are held. */ -int -vport_user_mod(const struct odp_vport_mod __user *uvport_config) +int vport_user_mod(const struct odp_vport_mod __user *uvport_config) { struct odp_vport_mod vport_config; @@ -309,8 +299,7 @@ vport_user_mod(const struct odp_vport_mod __user *uvport_config) } #ifdef CONFIG_COMPAT -int -compat_vport_user_mod(struct compat_odp_vport_mod *ucompat) +int compat_vport_user_mod(struct compat_odp_vport_mod *ucompat) { struct compat_odp_vport_mod compat; struct odp_vport_mod vport_config; @@ -336,8 +325,7 @@ compat_vport_user_mod(struct compat_odp_vport_mod *ucompat) * reasons, such as lack of memory. This function is for userspace callers and * assumes no locks are held. */ -int -vport_user_del(const char __user *udevname) +int vport_user_del(const char __user *udevname) { char devname[IFNAMSIZ]; struct vport *vport; @@ -396,8 +384,7 @@ out: * Retrieves transmit, receive, and error stats for the given device. This * function is for userspace callers and assumes no locks are held. */ -int -vport_user_stats_get(struct odp_vport_stats_req __user *ustats_req) +int vport_user_stats_get(struct odp_vport_stats_req __user *ustats_req) { struct odp_vport_stats_req stats_req; struct vport *vport; @@ -439,8 +426,7 @@ out: * -EOPNOTSUPP. This function is for userspace callers and assumes no locks * are held. */ -int -vport_user_stats_set(struct odp_vport_stats_req __user *ustats_req) +int vport_user_stats_set(struct odp_vport_stats_req __user *ustats_req) { struct odp_vport_stats_req stats_req; struct vport *vport; @@ -477,8 +463,7 @@ out: * Retrieves the Ethernet address of the given device. This function is for * userspace callers and assumes no locks are held. */ -int -vport_user_ether_get(struct odp_vport_ether __user *uvport_ether) +int vport_user_ether_get(struct odp_vport_ether __user *uvport_ether) { struct odp_vport_ether vport_ether; struct vport *vport; @@ -521,8 +506,7 @@ out: * -EOPNOTSUPP. This function is for userspace callers and assumes no locks * are held. */ -int -vport_user_ether_set(struct odp_vport_ether __user *uvport_ether) +int vport_user_ether_set(struct odp_vport_ether __user *uvport_ether) { struct odp_vport_ether vport_ether; struct vport *vport; @@ -558,8 +542,7 @@ out: * Retrieves the MTU of the given device. This function is for userspace * callers and assumes no locks are held. */ -int -vport_user_mtu_get(struct odp_vport_mtu __user *uvport_mtu) +int vport_user_mtu_get(struct odp_vport_mtu __user *uvport_mtu) { struct odp_vport_mtu vport_mtu; struct vport *vport; @@ -599,8 +582,7 @@ out: * MTU, in which case the result will always be -EOPNOTSUPP. This function is * for userspace callers and assumes no locks are held. */ -int -vport_user_mtu_set(struct odp_vport_mtu __user *uvport_mtu) +int vport_user_mtu_set(struct odp_vport_mtu __user *uvport_mtu) { struct odp_vport_mtu vport_mtu; struct vport *vport; @@ -628,8 +610,7 @@ out: return err; } -static struct hlist_head * -hash_bucket(const char *name) +static struct hlist_head *hash_bucket(const char *name) { unsigned int hash = full_name_hash(name, strlen(name)); return &dev_table[hash & (VPORT_HASH_BUCKETS - 1)]; @@ -644,8 +625,7 @@ hash_bucket(const char *name) * and held while using the found port. See the locking comments at the * top of the file. */ -struct vport * -vport_locate(const char *name) +struct vport *vport_locate(const char *name) { struct hlist_head *bucket = hash_bucket(name); struct vport *vport; @@ -669,14 +649,12 @@ out: return vport; } -static void -register_vport(struct vport *vport) +static void register_vport(struct vport *vport) { hlist_add_head(&vport->hash_node, hash_bucket(vport_get_name(vport))); } -static void -unregister_vport(struct vport *vport) +static void unregister_vport(struct vport *vport) { hlist_del(&vport->hash_node); } @@ -692,8 +670,7 @@ unregister_vport(struct vport *vport) * vport_priv(). vports that are no longer needed should be released with * vport_free(). */ -struct vport * -vport_alloc(int priv_size, const struct vport_ops *ops) +struct vport *vport_alloc(int priv_size, const struct vport_ops *ops) { struct vport *vport; size_t alloc_size; @@ -728,8 +705,7 @@ vport_alloc(int priv_size, const struct vport_ops *ops) * * Frees a vport allocated with vport_alloc() when it is no longer needed. */ -void -vport_free(struct vport *vport) +void vport_free(struct vport *vport) { if (vport->ops->flags & VPORT_F_GEN_STATS) free_percpu(vport->percpu_stats); @@ -748,8 +724,7 @@ vport_free(struct vport *vport) * Creates a new vport with the specified configuration (which is dependent * on device type). Both RTNL and vport locks must be held. */ -struct vport * -vport_add(const char *name, const char *type, const void __user *config) +struct vport *vport_add(const char *name, const char *type, const void __user *config) { struct vport *vport; int err = 0; @@ -786,8 +761,7 @@ out: * Modifies an existing device with the specified configuration (which is * dependent on device type). Both RTNL and vport locks must be held. */ -int -vport_mod(struct vport *vport, const void __user *config) +int vport_mod(struct vport *vport, const void __user *config) { ASSERT_RTNL(); ASSERT_VPORT(); @@ -807,8 +781,7 @@ vport_mod(struct vport *vport, const void __user *config) * a datapath. It is possible to fail for reasons such as lack of memory. * Both RTNL and vport locks must be held. */ -int -vport_del(struct vport *vport) +int vport_del(struct vport *vport) { ASSERT_RTNL(); ASSERT_VPORT(); @@ -830,8 +803,7 @@ vport_del(struct vport *vport) * attached to a vport before it is connected to a datapath and must not be * modified while connected. RTNL lock and the appropriate DP mutex must be held. */ -int -vport_attach(struct vport *vport, struct dp_port *dp_port) +int vport_attach(struct vport *vport, struct dp_port *dp_port) { ASSERT_RTNL(); @@ -863,8 +835,7 @@ vport_attach(struct vport *vport, struct dp_port *dp_port) * Detaches a vport from a datapath. May fail for a variety of reasons, * including lack of memory. RTNL lock and the appropriate DP mutex must be held. */ -int -vport_detach(struct vport *vport) +int vport_detach(struct vport *vport) { struct dp_port *dp_port; @@ -893,8 +864,7 @@ vport_detach(struct vport *vport) * MTU, in which case the result will always be -EOPNOTSUPP. RTNL lock must * be held. */ -int -vport_set_mtu(struct vport *vport, int mtu) +int vport_set_mtu(struct vport *vport, int mtu) { ASSERT_RTNL(); @@ -928,8 +898,7 @@ vport_set_mtu(struct vport *vport, int mtu) * setting the Ethernet address, in which case the result will always be * -EOPNOTSUPP. RTNL lock must be held. */ -int -vport_set_addr(struct vport *vport, const unsigned char *addr) +int vport_set_addr(struct vport *vport, const unsigned char *addr) { ASSERT_RTNL(); @@ -953,8 +922,7 @@ vport_set_addr(struct vport *vport, const unsigned char *addr) * support setting the stats, in which case the result will always be * -EOPNOTSUPP. RTNL lock must be held. */ -int -vport_set_stats(struct vport *vport, struct odp_vport_stats *stats) +int vport_set_stats(struct vport *vport, struct odp_vport_stats *stats) { ASSERT_RTNL(); @@ -978,8 +946,7 @@ vport_set_stats(struct vport *vport, struct odp_vport_stats *stats) * Retrieves the name of the given device. Either RTNL lock or rcu_read_lock * must be held for the entire duration that the name is in use. */ -const char * -vport_get_name(const struct vport *vport) +const char *vport_get_name(const struct vport *vport) { return vport->ops->get_name(vport); } @@ -992,8 +959,7 @@ vport_get_name(const struct vport *vport) * Retrieves the type of the given device. Either RTNL lock or rcu_read_lock * must be held for the entire duration that the type is in use. */ -const char * -vport_get_type(const struct vport *vport) +const char *vport_get_type(const struct vport *vport) { return vport->ops->type; } @@ -1007,8 +973,7 @@ vport_get_type(const struct vport *vport) * rcu_read_lock must be held for the entire duration that the Ethernet address * is in use. */ -const unsigned char * -vport_get_addr(const struct vport *vport) +const unsigned char *vport_get_addr(const struct vport *vport) { return vport->ops->get_addr(vport); } @@ -1022,8 +987,7 @@ vport_get_addr(const struct vport *vport) * lock or rcu_read_lock must be held for the entire duration that the datapath * port is being accessed. */ -struct dp_port * -vport_get_dp_port(const struct vport *vport) +struct dp_port *vport_get_dp_port(const struct vport *vport) { return rcu_dereference(vport->dp_port); } @@ -1036,8 +1000,7 @@ vport_get_dp_port(const struct vport *vport) * Retrieves the associated kobj or null if no kobj. The returned kobj is * valid for as long as the vport exists. */ -struct kobject * -vport_get_kobj(const struct vport *vport) +struct kobject *vport_get_kobj(const struct vport *vport) { if (vport->ops->get_kobj) return vport->ops->get_kobj(vport); @@ -1053,8 +1016,7 @@ vport_get_kobj(const struct vport *vport) * * Retrieves transmit, receive, and error stats for the given device. */ -int -vport_get_stats(struct vport *vport, struct odp_vport_stats *stats) +int vport_get_stats(struct vport *vport, struct odp_vport_stats *stats) { struct odp_vport_stats dev_stats; struct odp_vport_stats *dev_statsp = NULL; @@ -1139,8 +1101,7 @@ out: * Retrieves the flags of the given device. Either RTNL lock or rcu_read_lock * must be held. */ -unsigned -vport_get_flags(const struct vport *vport) +unsigned vport_get_flags(const struct vport *vport) { return vport->ops->get_dev_flags(vport); } @@ -1153,8 +1114,7 @@ vport_get_flags(const struct vport *vport) * Checks whether the given device is running. Either RTNL lock or * rcu_read_lock must be held. */ -int -vport_is_running(const struct vport *vport) +int vport_is_running(const struct vport *vport) { return vport->ops->is_running(vport); } @@ -1167,8 +1127,7 @@ vport_is_running(const struct vport *vport) * Retrieves the RFC2863 operstate of the given device. Either RTNL lock or * rcu_read_lock must be held. */ -unsigned char -vport_get_operstate(const struct vport *vport) +unsigned char vport_get_operstate(const struct vport *vport) { return vport->ops->get_operstate(vport); } @@ -1183,8 +1142,7 @@ vport_get_operstate(const struct vport *vport) * port is returned. Returns a negative index on error. Either RTNL lock or * rcu_read_lock must be held. */ -int -vport_get_ifindex(const struct vport *vport) +int vport_get_ifindex(const struct vport *vport) { const struct dp_port *dp_port; @@ -1211,8 +1169,7 @@ vport_get_ifindex(const struct vport *vport) * Returns a negative index on error. Either RTNL lock or rcu_read_lock must * be held. */ -int -vport_get_iflink(const struct vport *vport) +int vport_get_iflink(const struct vport *vport) { if (vport->ops->get_iflink) return vport->ops->get_iflink(vport); @@ -1230,8 +1187,7 @@ vport_get_iflink(const struct vport *vport) * Retrieves the MTU of the given device. Either RTNL lock or rcu_read_lock * must be held. */ -int -vport_get_mtu(const struct vport *vport) +int vport_get_mtu(const struct vport *vport) { return vport->ops->get_mtu(vport); } @@ -1246,8 +1202,7 @@ vport_get_mtu(const struct vport *vport) * skb->data should point to the Ethernet header. The caller must have already * called compute_ip_summed() to initialize the checksumming fields. */ -void -vport_receive(struct vport *vport, struct sk_buff *skb) +void vport_receive(struct vport *vport, struct sk_buff *skb) { struct dp_port *dp_port = vport_get_dp_port(vport); @@ -1276,8 +1231,7 @@ vport_receive(struct vport *vport, struct sk_buff *skb) dp_process_received_packet(dp_port, skb); } -static inline unsigned -packet_length(const struct sk_buff *skb) +static inline unsigned packet_length(const struct sk_buff *skb) { unsigned length = skb->len - ETH_HLEN; @@ -1296,8 +1250,7 @@ packet_length(const struct sk_buff *skb) * Sends the given packet and returns the length of data sent. Either RTNL * lock or rcu_read_lock must be held. */ -int -vport_send(struct vport *vport, struct sk_buff *skb) +int vport_send(struct vport *vport, struct sk_buff *skb) { int *loop_count; int mtu; @@ -1357,8 +1310,7 @@ out: * If using the vport generic stats layer indicate that an error of the given * type has occured. */ -void -vport_record_error(struct vport *vport, enum vport_err_type err_type) +void vport_record_error(struct vport *vport, enum vport_err_type err_type) { if (vport->ops->flags & VPORT_F_GEN_STATS) { diff --git a/datapath/vport.h b/datapath/vport.h index 7a3d527a..a5c17f6e 100644 --- a/datapath/vport.h +++ b/datapath/vport.h @@ -219,8 +219,7 @@ void vport_free(struct vport *); * area was allocated on creation. This allows that area to be accessed and * used for any purpose needed by the vport implementer. */ -static inline void * -vport_priv(const struct vport *vport) +static inline void *vport_priv(const struct vport *vport) { return (u8 *)vport + ALIGN(sizeof(struct vport), VPORT_ALIGN); } @@ -235,8 +234,7 @@ vport_priv(const struct vport *vport) * the result of a hash table lookup. @priv must point to the start of the * private data area. */ -static inline struct vport * -vport_from_priv(const void *priv) +static inline struct vport *vport_from_priv(const void *priv) { return (struct vport *)(priv - ALIGN(sizeof(struct vport), VPORT_ALIGN)); } |