mirror of https://gitee.com/openkylin/linux.git
net: openvswitch: improve the coding style
Not change the logic, just improve the coding style. Cc: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
34e1ec319e
commit
cf3266ad48
|
@ -741,7 +741,8 @@ static int set_sctp(struct sk_buff *skb, struct sw_flow_key *flow_key,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ovs_vport_output(struct net *net, struct sock *sk, struct sk_buff *skb)
|
||||
static int ovs_vport_output(struct net *net, struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct ovs_frag_data *data = this_cpu_ptr(&ovs_frag_data_storage);
|
||||
struct vport *vport = data->vport;
|
||||
|
|
|
@ -1080,7 +1080,8 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
|
|||
}
|
||||
|
||||
/* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */
|
||||
static noinline_for_stack struct sw_flow_actions *get_flow_actions(struct net *net,
|
||||
static noinline_for_stack
|
||||
struct sw_flow_actions *get_flow_actions(struct net *net,
|
||||
const struct nlattr *a,
|
||||
const struct sw_flow_key *key,
|
||||
const struct sw_flow_mask *mask,
|
||||
|
@ -1383,7 +1384,8 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
|
|||
|
||||
ovs_notify(&dp_flow_genl_family, reply, info);
|
||||
} else {
|
||||
netlink_set_err(sock_net(skb->sk)->genl_sock, 0, 0, PTR_ERR(reply));
|
||||
netlink_set_err(sock_net(skb->sk)->genl_sock, 0, 0,
|
||||
PTR_ERR(reply));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1572,11 +1574,13 @@ static struct datapath *lookup_datapath(struct net *net,
|
|||
return dp ? dp : ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static void ovs_dp_reset_user_features(struct sk_buff *skb, struct genl_info *info)
|
||||
static void ovs_dp_reset_user_features(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct datapath *dp;
|
||||
|
||||
dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
|
||||
dp = lookup_datapath(sock_net(skb->sk), info->userhdr,
|
||||
info->attrs);
|
||||
if (IS_ERR(dp))
|
||||
return;
|
||||
|
||||
|
@ -2093,11 +2097,12 @@ static void ovs_update_headroom(struct datapath *dp, unsigned int new_headroom)
|
|||
int i;
|
||||
|
||||
dp->max_headroom = new_headroom;
|
||||
for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++)
|
||||
for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) {
|
||||
hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node,
|
||||
lockdep_ovsl_is_held())
|
||||
netdev_set_rx_headroom(vport->dev, new_headroom);
|
||||
}
|
||||
}
|
||||
|
||||
static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
|
@ -2551,7 +2556,8 @@ static int __init dp_init(void)
|
|||
{
|
||||
int err;
|
||||
|
||||
BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > sizeof_field(struct sk_buff, cb));
|
||||
BUILD_BUG_ON(sizeof(struct ovs_skb_cb) >
|
||||
sizeof_field(struct sk_buff, cb));
|
||||
|
||||
pr_info("Open vSwitch switching datapath\n");
|
||||
|
||||
|
|
|
@ -111,12 +111,16 @@ static void flow_free(struct sw_flow *flow)
|
|||
if (ovs_identifier_is_key(&flow->id))
|
||||
kfree(flow->id.unmasked_key);
|
||||
if (flow->sf_acts)
|
||||
ovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts);
|
||||
ovs_nla_free_flow_actions((struct sw_flow_actions __force *)
|
||||
flow->sf_acts);
|
||||
/* We open code this to make sure cpu 0 is always considered */
|
||||
for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask))
|
||||
for (cpu = 0; cpu < nr_cpu_ids;
|
||||
cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {
|
||||
if (flow->stats[cpu])
|
||||
kmem_cache_free(flow_stats_cache,
|
||||
(struct sw_flow_stats __force *)flow->stats[cpu]);
|
||||
}
|
||||
|
||||
kmem_cache_free(flow_cache, flow);
|
||||
}
|
||||
|
||||
|
@ -448,8 +452,9 @@ int ovs_flow_tbl_init(struct flow_table *table)
|
|||
|
||||
static void flow_tbl_destroy_rcu_cb(struct rcu_head *rcu)
|
||||
{
|
||||
struct table_instance *ti = container_of(rcu, struct table_instance, rcu);
|
||||
struct table_instance *ti;
|
||||
|
||||
ti = container_of(rcu, struct table_instance, rcu);
|
||||
__table_instance_destroy(ti);
|
||||
}
|
||||
|
||||
|
@ -484,9 +489,9 @@ void table_instance_flow_flush(struct flow_table *table,
|
|||
return;
|
||||
|
||||
for (i = 0; i < ti->n_buckets; i++) {
|
||||
struct sw_flow *flow;
|
||||
struct hlist_head *head = &ti->buckets[i];
|
||||
struct hlist_node *n;
|
||||
struct sw_flow *flow;
|
||||
|
||||
hlist_for_each_entry_safe(flow, n, head,
|
||||
flow_table.node[ti->node_ver]) {
|
||||
|
@ -897,7 +902,8 @@ static bool ovs_flow_cmp_ufid(const struct sw_flow *flow,
|
|||
return !memcmp(flow->id.ufid, sfid->ufid, sfid->ufid_len);
|
||||
}
|
||||
|
||||
bool ovs_flow_cmp(const struct sw_flow *flow, const struct sw_flow_match *match)
|
||||
bool ovs_flow_cmp(const struct sw_flow *flow,
|
||||
const struct sw_flow_match *match)
|
||||
{
|
||||
if (ovs_identifier_is_ufid(&flow->id))
|
||||
return flow_cmp_masked_key(flow, match->key, &match->range);
|
||||
|
|
|
@ -397,7 +397,8 @@ int ovs_vport_get_upcall_portids(const struct vport *vport,
|
|||
*
|
||||
* Returns the portid of the target socket. Must be called with rcu_read_lock.
|
||||
*/
|
||||
u32 ovs_vport_find_upcall_portid(const struct vport *vport, struct sk_buff *skb)
|
||||
u32 ovs_vport_find_upcall_portid(const struct vport *vport,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct vport_portids *ids;
|
||||
u32 ids_index;
|
||||
|
|
Loading…
Reference in New Issue