mirror of
https://github.com/openvswitch/ovs
synced 2025-08-28 21:07:47 +00:00
datapath: Fix comment style.
Use netdev comment style. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
This commit is contained in:
parent
46051cf8ad
commit
af465b67a9
@ -62,7 +62,8 @@ struct action_fifo {
|
|||||||
|
|
||||||
static struct action_fifo __percpu *action_fifos;
|
static struct action_fifo __percpu *action_fifos;
|
||||||
#define EXEC_ACTIONS_LEVEL_LIMIT 4 /* limit used to detect packet
|
#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 DEFINE_PER_CPU(int, exec_actions_level);
|
||||||
|
|
||||||
static void action_fifo_init(struct action_fifo *fifo)
|
static void action_fifo_init(struct action_fifo *fifo)
|
||||||
|
@ -49,7 +49,8 @@ static inline struct rtable *find_route(struct net *net,
|
|||||||
{
|
{
|
||||||
struct rtable *rt;
|
struct rtable *rt;
|
||||||
/* Tunnel configuration keeps DSCP part of TOS bits, But Linux
|
/* 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)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
|
||||||
struct flowi fl = { .nl_u = { .ip4_u = {
|
struct flowi fl = { .nl_u = { .ip4_u = {
|
||||||
|
@ -79,7 +79,8 @@ struct genl_multicast_group ovs_dp_vport_multicast_group = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Check if need to build a reply message.
|
/* 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,
|
static bool ovs_must_notify(struct genl_family *family, struct genl_info *info,
|
||||||
unsigned int group)
|
unsigned int group)
|
||||||
{
|
{
|
||||||
@ -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
|
/* 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)
|
static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
|
||||||
{
|
{
|
||||||
struct datapath *dp;
|
struct datapath *dp;
|
||||||
@ -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
|
/* 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))) {
|
if (!(nla = nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, 0))) {
|
||||||
err = -ENOBUFS;
|
err = -ENOBUFS;
|
||||||
goto out;
|
goto out;
|
||||||
@ -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
|
/* Normally, setting the skb 'protocol' field would be handled by a
|
||||||
* call to eth_type_trans(), but it assumes there's a sending
|
* 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)
|
if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
|
||||||
packet->protocol = eth->h_proto;
|
packet->protocol = eth->h_proto;
|
||||||
else
|
else
|
||||||
@ -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
|
/* Most of the time we need to allocate a new flow, do it before
|
||||||
* locking. */
|
* locking.
|
||||||
|
*/
|
||||||
new_flow = ovs_flow_alloc();
|
new_flow = ovs_flow_alloc();
|
||||||
if (IS_ERR(new_flow)) {
|
if (IS_ERR(new_flow)) {
|
||||||
error = PTR_ERR(new_flow);
|
error = PTR_ERR(new_flow);
|
||||||
|
@ -467,7 +467,8 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
|
|||||||
|
|
||||||
__skb_pull(skb, 2 * ETH_ALEN);
|
__skb_pull(skb, 2 * ETH_ALEN);
|
||||||
/* We are going to push all headers that we pull, so no need to
|
/* 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;
|
key->eth.tci = 0;
|
||||||
if (vlan_tx_tag_present(skb))
|
if (vlan_tx_tag_present(skb))
|
||||||
@ -550,7 +551,8 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
|
|||||||
struct icmphdr *icmp = icmp_hdr(skb);
|
struct icmphdr *icmp = icmp_hdr(skb);
|
||||||
/* The ICMP type and code fields use the 16-bit
|
/* The ICMP type and code fields use the 16-bit
|
||||||
* transport port fields, so we need to store
|
* 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.src = htons(icmp->type);
|
||||||
key->tp.dst = htons(icmp->code);
|
key->tp.dst = htons(icmp->code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -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 */
|
u64 mask_allowed = key_attrs; /* At most allow all key attributes */
|
||||||
|
|
||||||
/* The following mask attributes allowed only if they
|
/* The following mask attributes allowed only if they
|
||||||
* pass the validation tests. */
|
* pass the validation tests.
|
||||||
|
*/
|
||||||
mask_allowed &= ~((1ULL << OVS_KEY_ATTR_IPV4)
|
mask_allowed &= ~((1ULL << OVS_KEY_ATTR_IPV4)
|
||||||
| (1ULL << OVS_KEY_ATTR_IPV6)
|
| (1ULL << OVS_KEY_ATTR_IPV6)
|
||||||
| (1ULL << OVS_KEY_ATTR_TCP)
|
| (1ULL << OVS_KEY_ATTR_TCP)
|
||||||
@ -253,7 +254,8 @@ static bool match_validate(const struct sw_flow_match *match,
|
|||||||
size_t ovs_tun_key_attr_size(void)
|
size_t ovs_tun_key_attr_size(void)
|
||||||
{
|
{
|
||||||
/* Whenever adding new OVS_TUNNEL_KEY_ FIELDS, we should consider
|
/* 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 */
|
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_SRC */
|
||||||
+ nla_total_size(4) /* OVS_TUNNEL_KEY_ATTR_IPV4_DST */
|
+ nla_total_size(4) /* OVS_TUNNEL_KEY_ATTR_IPV4_DST */
|
||||||
@ -270,7 +272,8 @@ size_t ovs_tun_key_attr_size(void)
|
|||||||
size_t ovs_key_attr_size(void)
|
size_t ovs_key_attr_size(void)
|
||||||
{
|
{
|
||||||
/* Whenever adding new OVS_KEY_ FIELDS, we should consider
|
/* Whenever adding new OVS_KEY_ FIELDS, we should consider
|
||||||
* updating this function. */
|
* updating this function.
|
||||||
|
*/
|
||||||
BUILD_BUG_ON(OVS_KEY_ATTR_TUNNEL_INFO != 22);
|
BUILD_BUG_ON(OVS_KEY_ATTR_TUNNEL_INFO != 22);
|
||||||
|
|
||||||
return nla_total_size(4) /* OVS_KEY_ATTR_PRIORITY */
|
return nla_total_size(4) /* OVS_KEY_ATTR_PRIORITY */
|
||||||
@ -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.
|
/* 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)
|
void ovs_nla_free_flow_actions(struct sw_flow_actions *sf_acts)
|
||||||
{
|
{
|
||||||
call_rcu(&sf_acts->rcu, rcu_free_acts_callback);
|
call_rcu(&sf_acts->rcu, rcu_free_acts_callback);
|
||||||
|
@ -331,7 +331,8 @@ skip_flows:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* No need for locking this function is called from RCU callback or
|
/* 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)
|
void ovs_flow_tbl_destroy(struct flow_table *table)
|
||||||
{
|
{
|
||||||
struct table_instance *ti = rcu_dereference_raw(table->ti);
|
struct table_instance *ti = rcu_dereference_raw(table->ti);
|
||||||
@ -564,7 +565,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl,
|
|||||||
* cache entry in mask cache.
|
* cache entry in mask cache.
|
||||||
* This is per cpu cache and is divided in MC_HASH_SEGS segments.
|
* 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.
|
* 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,
|
struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl,
|
||||||
const struct sw_flow_key *key,
|
const struct sw_flow_key *key,
|
||||||
u32 skb_hash,
|
u32 skb_hash,
|
||||||
@ -715,7 +716,8 @@ void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow)
|
|||||||
table->count--;
|
table->count--;
|
||||||
|
|
||||||
/* RCU delete the mask. 'flow->mask' is not NULLed, as it should be
|
/* 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);
|
flow_mask_remove(table, flow->mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +847,8 @@ int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes the flow module.
|
/* 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)
|
int ovs_flow_init(void)
|
||||||
{
|
{
|
||||||
BUILD_BUG_ON(__alignof__(struct sw_flow_key) % __alignof__(long));
|
BUILD_BUG_ON(__alignof__(struct sw_flow_key) % __alignof__(long));
|
||||||
|
@ -59,7 +59,8 @@ static struct net_device_stats *internal_dev_sys_stats(struct net_device *netdev
|
|||||||
ovs_vport_get_stats(vport, &vport_stats);
|
ovs_vport_get_stats(vport, &vport_stats);
|
||||||
|
|
||||||
/* The tx and rx stats need to be swapped because the
|
/* 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->rx_packets = vport_stats.tx_packets;
|
||||||
stats->tx_packets = vport_stats.rx_packets;
|
stats->tx_packets = vport_stats.rx_packets;
|
||||||
stats->rx_bytes = vport_stats.tx_bytes;
|
stats->rx_bytes = vport_stats.tx_bytes;
|
||||||
|
@ -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
|
/* 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).
|
* 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
|
* (No one comes after us, since we tell handle_bridge() that we took
|
||||||
* the packet.) */
|
* the packet.)
|
||||||
|
*/
|
||||||
skb = skb_share_check(skb, GFP_ATOMIC);
|
skb = skb_share_check(skb, GFP_ATOMIC);
|
||||||
if (unlikely(!skb))
|
if (unlikely(!skb))
|
||||||
return;
|
return;
|
||||||
|
@ -40,7 +40,8 @@ static void ovs_vport_record_error(struct vport *,
|
|||||||
enum vport_err_type err_type);
|
enum vport_err_type err_type);
|
||||||
|
|
||||||
/* List of statically compiled vport implementations. Don't forget to also
|
/* 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[] = {
|
static const struct vport_ops *vport_ops_list[] = {
|
||||||
&ovs_netdev_vport_ops,
|
&ovs_netdev_vport_ops,
|
||||||
&ovs_internal_vport_ops,
|
&ovs_internal_vport_ops,
|
||||||
|
@ -221,7 +221,8 @@ void ovs_vport_receive(struct vport *, struct sk_buff *,
|
|||||||
const struct ovs_tunnel_info *);
|
const struct ovs_tunnel_info *);
|
||||||
|
|
||||||
/* List of statically compiled vport implementations. Don't forget to also
|
/* 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_netdev_vport_ops;
|
||||||
extern const struct vport_ops ovs_internal_vport_ops;
|
extern const struct vport_ops ovs_internal_vport_ops;
|
||||||
extern const struct vport_ops ovs_geneve_vport_ops;
|
extern const struct vport_ops ovs_geneve_vport_ops;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user