Skip to content

Commit

Permalink
datapath: Fix comment style.
Browse files Browse the repository at this point in the history
Use netdev comment style.

Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Andy Zhou <[email protected]>
  • Loading branch information
Pravin B Shelar committed Oct 24, 2014
1 parent 46051cf commit af465b6
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 21 deletions.
3 changes: 2 additions & 1 deletion datapath/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ struct action_fifo {

static struct action_fifo __percpu *action_fifos;
#define EXEC_ACTIONS_LEVEL_LIMIT 4 /* limit used to detect packet
looping by the network stack */
* looping by the network stack
*/
static DEFINE_PER_CPU(int, exec_actions_level);

static void action_fifo_init(struct action_fifo *fifo)
Expand Down
3 changes: 2 additions & 1 deletion datapath/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ static inline struct rtable *find_route(struct net *net,
{
struct rtable *rt;
/* Tunnel configuration keeps DSCP part of TOS bits, But Linux
* router expect RT_TOS bits only. */
* router expect RT_TOS bits only.
*/

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
struct flowi fl = { .nl_u = { .ip4_u = {
Expand Down
15 changes: 10 additions & 5 deletions datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ struct genl_multicast_group ovs_dp_vport_multicast_group = {
};

/* Check if need to build a reply message.
* OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */
* 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)
{
Expand Down Expand Up @@ -156,7 +157,8 @@ static struct datapath *get_dp_rcu(struct net *net, int dp_ifindex)
}

/* The caller must hold either ovs_mutex or rcu_read_lock to keep the
* returned dp pointer valid. */
* returned dp pointer valid.
*/
static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
{
struct datapath *dp;
Expand Down Expand Up @@ -486,7 +488,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
}

/* Only reserve room for attribute header, packet data is added
* in skb_zerocopy() */
* in skb_zerocopy()
*/
if (!(nla = nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, 0))) {
err = -ENOBUFS;
goto out;
Expand Down Expand Up @@ -552,7 +555,8 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)

/* 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. */
* device, which we may not have.
*/
if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
packet->protocol = eth->h_proto;
else
Expand Down Expand Up @@ -877,7 +881,8 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
}

/* Most of the time we need to allocate a new flow, do it before
* locking. */
* locking.
*/
new_flow = ovs_flow_alloc();
if (IS_ERR(new_flow)) {
error = PTR_ERR(new_flow);
Expand Down
6 changes: 4 additions & 2 deletions datapath/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)

__skb_pull(skb, 2 * ETH_ALEN);
/* We are going to push all headers that we pull, so no need to
* update skb->csum here. */
* update skb->csum here.
*/

key->eth.tci = 0;
if (vlan_tx_tag_present(skb))
Expand Down Expand Up @@ -550,7 +551,8 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
struct icmphdr *icmp = icmp_hdr(skb);
/* The ICMP type and code fields use the 16-bit
* transport port fields, so we need to store
* them in 16-bit network byte order. */
* them in 16-bit network byte order.
*/
key->tp.src = htons(icmp->type);
key->tp.dst = htons(icmp->code);
} else {
Expand Down
12 changes: 8 additions & 4 deletions datapath/flow_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ static bool match_validate(const struct sw_flow_match *match,
u64 mask_allowed = key_attrs; /* At most allow all key attributes */

/* The following mask attributes allowed only if they
* pass the validation tests. */
* pass the validation tests.
*/
mask_allowed &= ~((1ULL << OVS_KEY_ATTR_IPV4)
| (1ULL << OVS_KEY_ATTR_IPV6)
| (1ULL << OVS_KEY_ATTR_TCP)
Expand Down Expand Up @@ -253,7 +254,8 @@ static bool match_validate(const struct sw_flow_match *match,
size_t ovs_tun_key_attr_size(void)
{
/* Whenever adding new OVS_TUNNEL_KEY_ FIELDS, we should consider
* updating this function. */
* updating this function.
*/
return nla_total_size(8) /* OVS_TUNNEL_KEY_ATTR_ID */
+ nla_total_size(4) /* OVS_TUNNEL_KEY_ATTR_IPV4_SRC */
+ nla_total_size(4) /* OVS_TUNNEL_KEY_ATTR_IPV4_DST */
Expand All @@ -270,7 +272,8 @@ size_t ovs_tun_key_attr_size(void)
size_t ovs_key_attr_size(void)
{
/* Whenever adding new OVS_KEY_ FIELDS, we should consider
* updating this function. */
* updating this function.
*/
BUILD_BUG_ON(OVS_KEY_ATTR_TUNNEL_INFO != 22);

return nla_total_size(4) /* OVS_KEY_ATTR_PRIORITY */
Expand Down Expand Up @@ -1388,7 +1391,8 @@ static void rcu_free_acts_callback(struct rcu_head *rcu)
}

/* Schedules 'sf_acts' to be freed after the next RCU grace period.
* The caller must hold rcu_read_lock for this to be sensible. */
* The caller must hold rcu_read_lock for this to be sensible.
*/
void ovs_nla_free_flow_actions(struct sw_flow_actions *sf_acts)
{
call_rcu(&sf_acts->rcu, rcu_free_acts_callback);
Expand Down
11 changes: 7 additions & 4 deletions datapath/flow_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ static void table_instance_destroy(struct table_instance *ti, bool deferred)
}

/* No need for locking this function is called from RCU callback or
* error path. */
* error path.
*/
void ovs_flow_tbl_destroy(struct flow_table *table)
{
struct table_instance *ti = rcu_dereference_raw(table->ti);
Expand Down Expand Up @@ -564,7 +565,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl,
* cache entry in mask cache.
* This is per cpu cache and is divided in MC_HASH_SEGS segments.
* In case of a hash collision the entry is hashed in next segment.
* */
*/
struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl,
const struct sw_flow_key *key,
u32 skb_hash,
Expand Down Expand Up @@ -715,7 +716,8 @@ void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow)
table->count--;

/* RCU delete the mask. 'flow->mask' is not NULLed, as it should be
* accessible as long as the RCU read lock is held. */
* accessible as long as the RCU read lock is held.
*/
flow_mask_remove(table, flow->mask);
}

Expand Down Expand Up @@ -845,7 +847,8 @@ int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
}

/* Initializes the flow module.
* Returns zero if successful or a negative error code. */
* Returns zero if successful or a negative error code.
*/
int ovs_flow_init(void)
{
BUILD_BUG_ON(__alignof__(struct sw_flow_key) % __alignof__(long));
Expand Down
3 changes: 2 additions & 1 deletion datapath/vport-internal_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ static struct net_device_stats *internal_dev_sys_stats(struct net_device *netdev
ovs_vport_get_stats(vport, &vport_stats);

/* The tx and rx stats need to be swapped because the
* switch and host OS have opposite perspectives. */
* switch and host OS have opposite perspectives.
*/
stats->rx_packets = vport_stats.tx_packets;
stats->tx_packets = vport_stats.rx_packets;
stats->rx_bytes = vport_stats.tx_bytes;
Expand Down
3 changes: 2 additions & 1 deletion datapath/vport-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
/* Make our own copy of the packet. Otherwise we will mangle the
* packet for anyone who came before us (e.g. tcpdump via AF_PACKET).
* (No one comes after us, since we tell handle_bridge() that we took
* the packet.) */
* the packet.)
*/
skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
return;
Expand Down
3 changes: 2 additions & 1 deletion datapath/vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ static void ovs_vport_record_error(struct vport *,
enum vport_err_type err_type);

/* List of statically compiled vport implementations. Don't forget to also
* add yours to the list at the bottom of vport.h. */
* add yours to the list at the bottom of vport.h.
*/
static const struct vport_ops *vport_ops_list[] = {
&ovs_netdev_vport_ops,
&ovs_internal_vport_ops,
Expand Down
3 changes: 2 additions & 1 deletion datapath/vport.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ void ovs_vport_receive(struct vport *, struct sk_buff *,
const struct ovs_tunnel_info *);

/* List of statically compiled vport implementations. Don't forget to also
* add yours to the list at the top of vport.c. */
* add yours to the list at the top of vport.c.
*/
extern const struct vport_ops ovs_netdev_vport_ops;
extern const struct vport_ops ovs_internal_vport_ops;
extern const struct vport_ops ovs_geneve_vport_ops;
Expand Down

0 comments on commit af465b6

Please sign in to comment.