Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1307859 > unrolled thread
| Started by | Janusz Wolak <januszvdm@awokados.com.pl> |
|---|---|
| First post | 2016-01-12 23:00 +0100 |
| Last post | 2016-01-12 23:20 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] Openvswitch: actions.c: Removed line over 80 characters and not necessary braces. Janusz Wolak <januszvdm@awokados.com.pl> - 2016-01-12 23:00 +0100
[PATCH] Openvswitch: datapath.c: Fixed coding style warnings. Janusz Wolak <januszvdm@awokados.com.pl> - 2016-01-12 23:00 +0100
Re: [ovs-dev] [PATCH] Openvswitch: datapath.c: Fixed coding style warnings. pravin shelar <pshelar@ovn.org> - 2016-01-12 23:20 +0100
[PATCH] Openvswitch: conntrack.c: Removed multiple blank lines. Janusz Wolak <januszvdm@awokados.com.pl> - 2016-01-12 23:00 +0100
Re: [PATCH] Openvswitch: actions.c: Removed line over 80 characters and not necessary braces. David Miller <davem@davemloft.net> - 2016-01-12 23:20 +0100
| From | Janusz Wolak <januszvdm@awokados.com.pl> |
|---|---|
| Date | 2016-01-12 23:00 +0100 |
| Subject | [PATCH] Openvswitch: actions.c: Removed line over 80 characters and not necessary braces. |
| Message-ID | <qQf8S-6R1-3@gated-at.bofh.it> |
Fixed a coding style issue.
Signed-off-by: Janusz Wolak <januszvdm@awokados.com.pl>
---
net/openvswitch/actions.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index c88d0f2..28bc395 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -620,7 +620,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;
@@ -707,9 +708,8 @@ static void ovs_fragment(struct net *net, struct vport *vport,
unsigned long orig_dst;
struct rt6_info ovs_rt;
- if (!v6ops) {
+ if (!v6ops)
goto err;
- }
prepare_frag(vport, skb);
memset(&ovs_rt, 0, sizeof(ovs_rt));
--
2.5.0
[toc] | [next] | [standalone]
| From | Janusz Wolak <januszvdm@awokados.com.pl> |
|---|---|
| Date | 2016-01-12 23:00 +0100 |
| Subject | [PATCH] Openvswitch: datapath.c: Fixed coding style warnings. |
| Message-ID | <qQf8U-6R1-47@gated-at.bofh.it> |
| In reply to | #1307859 |
Removed: block comments trailing without separate line,
missing blanks after decarations, comparasion to NULL, assignment in if
condition, not necessary spaces after a casts, multiple assignments, line
over 80 characters, alignment not matched to open parenthesis, kmalloc with
multiplying instead kmalloc_array.
Signed-off-by: Janusz Wolak <januszvdm@awokados.com.pl>
---
net/openvswitch/datapath.c | 75 ++++++++++++++++++++++++++--------------------
1 file changed, 42 insertions(+), 33 deletions(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 91a8b00..12ff8c2 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -79,8 +79,8 @@ static const struct genl_multicast_group ovs_dp_vport_multicast_group = {
.name = OVS_VPORT_MCGROUP,
};
-/* Check if need to build a reply message.
- * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */
+/* Check if need to build a reply message.*/
+/* OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */
static bool ovs_must_notify(struct genl_family *family, struct genl_info *info,
unsigned int group)
{
@@ -149,6 +149,7 @@ static struct datapath *get_dp_rcu(struct net *net, int dp_ifindex)
if (dev) {
struct vport *vport = ovs_internal_dev_get_vport(dev);
+
if (vport)
return vport->dp;
}
@@ -175,6 +176,7 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
const char *ovs_dp_name(const struct datapath *dp)
{
struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL);
+
return ovs_vport_name(vport);
}
@@ -344,7 +346,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
*OVS_CB(skb) = ovs_cb;
if (IS_ERR(segs))
return PTR_ERR(segs);
- if (segs == NULL)
+ if (!segs)
return -EINVAL;
if (gso_type & SKB_GSO_UDP) {
@@ -455,8 +457,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
}
/* Complete checksum if needed */
- if (skb->ip_summed == CHECKSUM_PARTIAL &&
- (err = skb_checksum_help(skb)))
+ err = skb_checksum_help(skb);
+ if (skb->ip_summed == CHECKSUM_PARTIAL && err)
goto out;
/* Older versions of OVS user space enforce alignment of the last
@@ -516,9 +518,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
pad_packet(dp, user_skb);
}
- /* Only reserve room for attribute header, packet data is added
- * in skb_zerocopy() */
- if (!(nla = nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, 0))) {
+ /* Only reserve room for attribute header, packet data is addedi */
+ /* in skb_zerocopy() */
+ nla = nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, 0);
+ if (!nla) {
err = -ENOBUFS;
goto out;
}
@@ -531,7 +534,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
/* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */
pad_packet(dp, user_skb);
- ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
+ ((struct nlmsghdr *)user_skb->data)->nlmsg_len = user_skb->len;
err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
user_skb = NULL;
@@ -577,9 +580,9 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
skb_reset_mac_header(packet);
eth = eth_hdr(packet);
- /* Normally, setting the skb 'protocol' field would be handled by a
- * call to eth_type_trans(), but it assumes there's a sending
- * device, which we may not have. */
+ /* Normally, setting the skb 'protocol' field would be handled by a */
+ /* call to eth_type_trans(), but it assumes there's a sending */
+ /* device, which we may not have. */
if (eth_proto_is_802_3(eth->h_proto))
packet->protocol = eth->h_proto;
else
@@ -685,7 +688,9 @@ static void get_dp_stats(const struct datapath *dp, struct ovs_dp_stats *stats,
stats->n_flows = ovs_flow_tbl_count(&dp->table);
mega_stats->n_masks = ovs_flow_tbl_num_masks(&dp->table);
- stats->n_hit = stats->n_missed = stats->n_lost = 0;
+ stats->n_hit = 0;
+ stats->n_missed = 0;
+ stats->n_lost = 0;
for_each_possible_cpu(i) {
const struct dp_stats_percpu *percpu_stats;
@@ -765,11 +770,12 @@ static int ovs_flow_cmd_fill_stats(const struct sw_flow *flow,
return -EMSGSIZE;
if (stats.n_packets &&
- nla_put(skb, OVS_FLOW_ATTR_STATS, sizeof(struct ovs_flow_stats), &stats))
+ nla_put(skb, OVS_FLOW_ATTR_STATS, sizeof(struct ovs_flow_stats),
+ &stats))
return -EMSGSIZE;
if ((u8)ntohs(tcp_flags) &&
- nla_put_u8(skb, OVS_FLOW_ATTR_TCP_FLAGS, (u8)ntohs(tcp_flags)))
+ nla_put_u8(skb, OVS_FLOW_ATTR_TCP_FLAGS, (u8)ntohs(tcp_flags)))
return -EMSGSIZE;
return 0;
@@ -800,9 +806,9 @@ static int ovs_flow_cmd_fill_actions(const struct sw_flow *flow,
err = ovs_nla_put_actions(sf_acts->actions,
sf_acts->actions_len, skb);
- if (!err)
+ if (!err) {
nla_nest_end(skb, start);
- else {
+ } else {
if (skb_orig_len)
return err;
@@ -1310,8 +1316,9 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
ovs_flow_tbl_remove(&dp->table, flow);
ovs_unlock();
- reply = ovs_flow_cmd_alloc_info((const struct sw_flow_actions __force *) flow->sf_acts,
- &flow->id, info, false, ufid_flags);
+ reply = ovs_flow_cmd_alloc_info((const struct sw_flow_actions __force *)
+ flow->sf_acts, &flow->id, info,
+ false, ufid_flags);
if (likely(reply)) {
if (likely(!IS_ERR(reply))) {
rcu_read_lock(); /*To keep RCU checker happy. */
@@ -1325,7 +1332,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));
}
}
@@ -1452,7 +1460,7 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
int err;
ovs_header = genlmsg_put(skb, portid, seq, &dp_datapath_genl_family,
- flags, cmd);
+ flags, cmd);
if (!ovs_header)
goto error;
@@ -1464,11 +1472,11 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
get_dp_stats(dp, &dp_stats, &dp_megaflow_stats);
if (nla_put(skb, OVS_DP_ATTR_STATS, sizeof(struct ovs_dp_stats),
- &dp_stats))
+ &dp_stats))
goto nla_put_failure;
if (nla_put(skb, OVS_DP_ATTR_MEGAFLOW_STATS,
- sizeof(struct ovs_dp_megaflow_stats),
+ sizeof(struct ovs_dp_megaflow_stats),
&dp_megaflow_stats))
goto nla_put_failure;
@@ -1496,9 +1504,9 @@ static struct datapath *lookup_datapath(struct net *net,
{
struct datapath *dp;
- if (!a[OVS_DP_ATTR_NAME])
+ if (!a[OVS_DP_ATTR_NAME]) {
dp = get_dp(net, ovs_header->dp_ifindex);
- else {
+ } else {
struct vport *vport;
vport = ovs_vport_locate(net, nla_data(a[OVS_DP_ATTR_NAME]));
@@ -1507,7 +1515,8 @@ 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;
@@ -1545,7 +1554,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
err = -ENOMEM;
dp = kzalloc(sizeof(*dp), GFP_KERNEL);
- if (dp == NULL)
+ if (!dp)
goto err_free_reply;
ovs_dp_set_net(dp, sock_net(skb->sk));
@@ -1561,8 +1570,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
goto err_destroy_table;
}
- dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
- GFP_KERNEL);
+ dp->ports = kmalloc_array(DP_VPORT_HASH_BUCKETS,
+ sizeof(struct hlist_head), GFP_KERNEL)
if (!dp->ports) {
err = -ENOMEM;
goto err_destroy_percpu;
@@ -1897,7 +1906,8 @@ static struct vport *lookup_vport(struct net *net,
ovs_header->dp_ifindex != get_dpifindex(vport->dp))
return ERR_PTR(-ENODEV);
return vport;
- } else if (a[OVS_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)
@@ -1911,8 +1921,9 @@ static struct vport *lookup_vport(struct net *net,
if (!vport)
return ERR_PTR(-ENODEV);
return vport;
- } else
+ } else {
return ERR_PTR(-EINVAL);
+ }
}
static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
@@ -2021,7 +2032,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
goto exit_unlock_free;
}
-
if (a[OVS_VPORT_ATTR_UPCALL_PID]) {
struct nlattr *ids = a[OVS_VPORT_ATTR_UPCALL_PID];
@@ -2218,7 +2228,6 @@ static int dp_register_genl(void)
int i;
for (i = 0; i < ARRAY_SIZE(dp_genl_families); i++) {
-
err = genl_register_family(dp_genl_families[i]);
if (err)
goto error;
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | pravin shelar <pshelar@ovn.org> |
|---|---|
| Date | 2016-01-12 23:20 +0100 |
| Subject | Re: [ovs-dev] [PATCH] Openvswitch: datapath.c: Fixed coding style warnings. |
| Message-ID | <qQfse-7eN-21@gated-at.bofh.it> |
| In reply to | #1307863 |
On Tue, Jan 12, 2016 at 1:55 PM, Janusz Wolak <januszvdm@awokados.com.pl> wrote: > Removed: block comments trailing without separate line, > missing blanks after decarations, comparasion to NULL, assignment in if > condition, not necessary spaces after a casts, multiple assignments, line > over 80 characters, alignment not matched to open parenthesis, kmalloc with > multiplying instead kmalloc_array. > > > Signed-off-by: Janusz Wolak <januszvdm@awokados.com.pl> > --- > net/openvswitch/datapath.c | 75 ++++++++++++++++++++++++++-------------------- > 1 file changed, 42 insertions(+), 33 deletions(-) > > diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c > index 91a8b00..12ff8c2 100644 > --- a/net/openvswitch/datapath.c > +++ b/net/openvswitch/datapath.c ... > @@ -455,8 +457,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, > } > > /* Complete checksum if needed */ > - if (skb->ip_summed == CHECKSUM_PARTIAL && > - (err = skb_checksum_help(skb))) > + err = skb_checksum_help(skb); > + if (skb->ip_summed == CHECKSUM_PARTIAL && err) > goto out; > skb checksum help can be expensive in some cases, so it should be moved inside the if condition block.
[toc] | [prev] | [next] | [standalone]
| From | Janusz Wolak <januszvdm@awokados.com.pl> |
|---|---|
| Date | 2016-01-12 23:00 +0100 |
| Subject | [PATCH] Openvswitch: conntrack.c: Removed multiple blank lines. |
| Message-ID | <qQf8U-6R1-49@gated-at.bofh.it> |
| In reply to | #1307859 |
Fixed a coding style issue. Signed-off-by: Janusz Wolak <januszvdm@awokados.com.pl> --- net/openvswitch/conntrack.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index e004067..fab7b55 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -201,7 +201,6 @@ static int ovs_ct_set_mark(struct sk_buff *skb, struct sw_flow_key *key, struct nf_conn *ct; u32 new_mark; - /* The connection could be invalid, in which case set_mark is no-op. */ ct = nf_ct_get(skb, &ctinfo); if (!ct) -- 2.5.0
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-01-12 23:20 +0100 |
| Subject | Re: [PATCH] Openvswitch: actions.c: Removed line over 80 characters and not necessary braces. |
| Message-ID | <qQfsf-7eN-35@gated-at.bofh.it> |
| In reply to | #1307859 |
It is not appropriate to submit net-next changes at this time. If you wish to contribute to the networking kernel code, you should read the netdev mailing lists, and read important announcements such as this: http://marc.info/?l=linux-netdev&m=145248145925834&w=2 THanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web