Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12eb18f7 authored by Thomas Graf's avatar Thomas Graf Committed by Pravin B Shelar
Browse files

openvswitch: Constify various function arguments



Help produce better optimized code.

Signed-off-by: default avatarThomas Graf <tgraf@noironetworks.com>
Signed-off-by: default avatarPravin B Shelar <pshelar@nicira.com>
parent e8eedb85
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ static void action_fifo_init(struct action_fifo *fifo)
	fifo->tail = 0;
}

static bool action_fifo_is_empty(struct action_fifo *fifo)
static bool action_fifo_is_empty(const struct action_fifo *fifo)
{
	return (fifo->head == fifo->tail);
}
@@ -92,7 +92,7 @@ static struct deferred_action *action_fifo_put(struct action_fifo *fifo)

/* Return true if fifo is not full */
static struct deferred_action *add_deferred_actions(struct sk_buff *skb,
						    struct sw_flow_key *key,
						    const struct sw_flow_key *key,
						    const struct nlattr *attr)
{
	struct action_fifo *fifo;
@@ -944,7 +944,8 @@ static void process_deferred_actions(struct datapath *dp)

/* Execute a list of actions against 'skb'. */
int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
			struct sw_flow_actions *acts, struct sw_flow_key *key)
			const struct sw_flow_actions *acts,
			struct sw_flow_key *key)
{
	int level = this_cpu_read(exec_actions_level);
	int err;
+5 −5
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ const char *ovs_dp_name(const struct datapath *dp)
	return vport->ops->get_name(vport);
}

static int get_dpifindex(struct datapath *dp)
static int get_dpifindex(const struct datapath *dp)
{
	struct vport *local;
	int ifindex;
@@ -633,7 +633,7 @@ static struct genl_family dp_packet_genl_family = {
	.n_ops = ARRAY_SIZE(dp_packet_genl_ops),
};

static void get_dp_stats(struct datapath *dp, struct ovs_dp_stats *stats,
static void get_dp_stats(const struct datapath *dp, struct ovs_dp_stats *stats,
			 struct ovs_dp_megaflow_stats *mega_stats)
{
	int i;
@@ -1352,7 +1352,7 @@ static struct sk_buff *ovs_dp_cmd_alloc_info(struct genl_info *info)

/* Called with rcu_read_lock or ovs_mutex. */
static struct datapath *lookup_datapath(struct net *net,
					struct ovs_header *ovs_header,
					const struct ovs_header *ovs_header,
					struct nlattr *a[OVS_DP_ATTR_MAX + 1])
{
	struct datapath *dp;
@@ -1380,7 +1380,7 @@ static void ovs_dp_reset_user_features(struct sk_buff *skb, struct genl_info *in
	dp->user_features = 0;
}

static void ovs_dp_change(struct datapath *dp, struct nlattr **a)
static void ovs_dp_change(struct datapath *dp, struct nlattr *a[])
{
	if (a[OVS_DP_ATTR_USER_FEATURES])
		dp->user_features = nla_get_u32(a[OVS_DP_ATTR_USER_FEATURES]);
@@ -1744,7 +1744,7 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid,

/* Called with ovs_mutex or RCU read lock. */
static struct vport *lookup_vport(struct net *net,
				  struct ovs_header *ovs_header,
				  const struct ovs_header *ovs_header,
				  struct nlattr *a[OVS_VPORT_ATTR_MAX + 1])
{
	struct datapath *dp;
+2 −2
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ int lockdep_ovsl_is_held(void);
#define rcu_dereference_ovsl(p)					\
	rcu_dereference_check(p, lockdep_ovsl_is_held())

static inline struct net *ovs_dp_get_net(struct datapath *dp)
static inline struct net *ovs_dp_get_net(const struct datapath *dp)
{
	return read_pnet(&dp->net);
}
@@ -192,7 +192,7 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 pid, u32 seq,
					 u8 cmd);

int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
			struct sw_flow_actions *acts, struct sw_flow_key *);
			const struct sw_flow_actions *, struct sw_flow_key *);

void ovs_dp_notify_wq(struct work_struct *work);

+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies)
#define TCP_FLAGS_BE16(tp) (*(__be16 *)&tcp_flag_word(tp) & htons(0x0FFF))

void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
			   struct sk_buff *skb)
			   const struct sk_buff *skb)
{
	struct flow_stats *stats;
	int node = numa_node_id();
@@ -679,7 +679,7 @@ int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key)
	return key_extract(skb, key);
}

int ovs_flow_key_extract(struct ovs_tunnel_info *tun_info,
int ovs_flow_key_extract(const struct ovs_tunnel_info *tun_info,
			 struct sk_buff *skb, struct sw_flow_key *key)
{
	/* Extract metadata from packet. */
+6 −5
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ struct ovs_key_ipv4_tunnel {

struct ovs_tunnel_info {
	struct ovs_key_ipv4_tunnel tunnel;
	struct geneve_opt *options;
	const struct geneve_opt *options;
	u8 options_len;
};

@@ -73,7 +73,7 @@ static inline void __ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
					    __be16 tp_dst,
					    __be64 tun_id,
					    __be16 tun_flags,
					    struct geneve_opt *opts,
					    const struct geneve_opt *opts,
					    u8 opts_len)
{
	tun_info->tunnel.tun_id = tun_id;
@@ -105,7 +105,7 @@ static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
					  __be16 tp_dst,
					  __be64 tun_id,
					  __be16 tun_flags,
					  struct geneve_opt *opts,
					  const struct geneve_opt *opts,
					  u8 opts_len)
{
	__ovs_flow_tun_info_init(tun_info, iph->saddr, iph->daddr,
@@ -244,14 +244,15 @@ struct arp_eth_header {
} __packed;

void ovs_flow_stats_update(struct sw_flow *, __be16 tcp_flags,
			   struct sk_buff *);
			   const struct sk_buff *);
void ovs_flow_stats_get(const struct sw_flow *, struct ovs_flow_stats *,
			unsigned long *used, __be16 *tcp_flags);
void ovs_flow_stats_clear(struct sw_flow *);
u64 ovs_flow_used_time(unsigned long flow_jiffies);

int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key);
int ovs_flow_key_extract(struct ovs_tunnel_info *tun_info, struct sk_buff *skb,
int ovs_flow_key_extract(const struct ovs_tunnel_info *tun_info,
			 struct sk_buff *skb,
			 struct sw_flow_key *key);
/* Extract key from packet coming from userspace. */
int ovs_flow_key_extract_userspace(const struct nlattr *attr,
Loading