diff options
| author | Pravin B Shelar <pshelar@nicira.com> | 2013-06-13 14:11:32 -0400 |
|---|---|---|
| committer | Jesse Gross <jesse@nicira.com> | 2013-06-14 18:09:12 -0400 |
| commit | 93d8fd1514b6862c3370ea92be3f3b4216e0bf8f (patch) | |
| tree | c46a46cf0d597a5fe63904dba90c8e50521f0c0f | |
| parent | b34df5e805a6e98cae0bc5bc80c1b52d9ff811de (diff) | |
openvswitch: Simplify interface ovs_flow_metadata_from_nlattrs()
This is not functional change, this is just code cleanup.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
| -rw-r--r-- | net/openvswitch/datapath.c | 5 | ||||
| -rw-r--r-- | net/openvswitch/flow.c | 22 | ||||
| -rw-r--r-- | net/openvswitch/flow.h | 4 |
3 files changed, 13 insertions, 18 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 748aa97cbfb2..0f783d9fa00d 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -739,10 +739,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
| 739 | if (err) | 739 | if (err) |
| 740 | goto err_flow_free; | 740 | goto err_flow_free; |
| 741 | 741 | ||
| 742 | err = ovs_flow_metadata_from_nlattrs(&flow->key.phy.priority, | 742 | err = ovs_flow_metadata_from_nlattrs(flow, a[OVS_PACKET_ATTR_KEY]); |
| 743 | &flow->key.phy.skb_mark, | ||
| 744 | &flow->key.phy.in_port, | ||
| 745 | a[OVS_PACKET_ATTR_KEY]); | ||
| 746 | if (err) | 743 | if (err) |
| 747 | goto err_flow_free; | 744 | goto err_flow_free; |
| 748 | 745 | ||
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index fca483360ce2..093c191d4fc2 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
| @@ -1125,10 +1125,8 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, | |||
| 1125 | 1125 | ||
| 1126 | /** | 1126 | /** |
| 1127 | * ovs_flow_metadata_from_nlattrs - parses Netlink attributes into a flow key. | 1127 | * ovs_flow_metadata_from_nlattrs - parses Netlink attributes into a flow key. |
| 1128 | * @priority: receives the skb priority | 1128 | * @flow: Receives extracted in_port, priority, tun_key and skb_mark. |
| 1129 | * @mark: receives the skb mark | 1129 | * @attr: Netlink attribute holding nested %OVS_KEY_ATTR_* Netlink attribute |
| 1130 | * @in_port: receives the extracted input port. | ||
| 1131 | * @key: Netlink attribute holding nested %OVS_KEY_ATTR_* Netlink attribute | ||
| 1132 | * sequence. | 1130 | * sequence. |
| 1133 | * | 1131 | * |
| 1134 | * This parses a series of Netlink attributes that form a flow key, which must | 1132 | * This parses a series of Netlink attributes that form a flow key, which must |
| @@ -1136,15 +1134,15 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, | |||
| 1136 | * get the metadata, that is, the parts of the flow key that cannot be | 1134 | * get the metadata, that is, the parts of the flow key that cannot be |
| 1137 | * extracted from the packet itself. | 1135 | * extracted from the packet itself. |
| 1138 | */ | 1136 | */ |
| 1139 | int ovs_flow_metadata_from_nlattrs(u32 *priority, u32 *mark, u16 *in_port, | 1137 | int ovs_flow_metadata_from_nlattrs(struct sw_flow *flow, |
| 1140 | const struct nlattr *attr) | 1138 | const struct nlattr *attr) |
| 1141 | { | 1139 | { |
| 1142 | const struct nlattr *nla; | 1140 | const struct nlattr *nla; |
| 1143 | int rem; | 1141 | int rem; |
| 1144 | 1142 | ||
| 1145 | *in_port = DP_MAX_PORTS; | 1143 | flow->key.phy.in_port = DP_MAX_PORTS; |
| 1146 | *priority = 0; | 1144 | flow->key.phy.priority = 0; |
| 1147 | *mark = 0; | 1145 | flow->key.phy.skb_mark = 0; |
| 1148 | 1146 | ||
| 1149 | nla_for_each_nested(nla, attr, rem) { | 1147 | nla_for_each_nested(nla, attr, rem) { |
| 1150 | int type = nla_type(nla); | 1148 | int type = nla_type(nla); |
| @@ -1155,17 +1153,17 @@ int ovs_flow_metadata_from_nlattrs(u32 *priority, u32 *mark, u16 *in_port, | |||
| 1155 | 1153 | ||
| 1156 | switch (type) { | 1154 | switch (type) { |
| 1157 | case OVS_KEY_ATTR_PRIORITY: | 1155 | case OVS_KEY_ATTR_PRIORITY: |
| 1158 | *priority = nla_get_u32(nla); | 1156 | flow->key.phy.priority = nla_get_u32(nla); |
| 1159 | break; | 1157 | break; |
| 1160 | 1158 | ||
| 1161 | case OVS_KEY_ATTR_IN_PORT: | 1159 | case OVS_KEY_ATTR_IN_PORT: |
| 1162 | if (nla_get_u32(nla) >= DP_MAX_PORTS) | 1160 | if (nla_get_u32(nla) >= DP_MAX_PORTS) |
| 1163 | return -EINVAL; | 1161 | return -EINVAL; |
| 1164 | *in_port = nla_get_u32(nla); | 1162 | flow->key.phy.in_port = nla_get_u32(nla); |
| 1165 | break; | 1163 | break; |
| 1166 | 1164 | ||
| 1167 | case OVS_KEY_ATTR_SKB_MARK: | 1165 | case OVS_KEY_ATTR_SKB_MARK: |
| 1168 | *mark = nla_get_u32(nla); | 1166 | flow->key.phy.skb_mark = nla_get_u32(nla); |
| 1169 | break; | 1167 | break; |
| 1170 | } | 1168 | } |
| 1171 | } | 1169 | } |
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h index 0875fde65b9c..2a83e2141f08 100644 --- a/net/openvswitch/flow.h +++ b/net/openvswitch/flow.h | |||
| @@ -141,8 +141,8 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies); | |||
| 141 | int ovs_flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *); | 141 | int ovs_flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *); |
| 142 | int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, | 142 | int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, |
| 143 | const struct nlattr *); | 143 | const struct nlattr *); |
| 144 | int ovs_flow_metadata_from_nlattrs(u32 *priority, u32 *mark, u16 *in_port, | 144 | int ovs_flow_metadata_from_nlattrs(struct sw_flow *flow, |
| 145 | const struct nlattr *); | 145 | const struct nlattr *attr); |
| 146 | 146 | ||
| 147 | #define MAX_ACTIONS_BUFSIZE (16 * 1024) | 147 | #define MAX_ACTIONS_BUFSIZE (16 * 1024) |
| 148 | #define TBL_MIN_BUCKETS 1024 | 148 | #define TBL_MIN_BUCKETS 1024 |
