aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch/flow.c')
-rw-r--r--net/openvswitch/flow.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index b15321a2228c..093c191d4fc2 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -590,10 +590,10 @@ out:
590 * - skb->network_header: just past the Ethernet header, or just past the 590 * - skb->network_header: just past the Ethernet header, or just past the
591 * VLAN header, to the first byte of the Ethernet payload. 591 * VLAN header, to the first byte of the Ethernet payload.
592 * 592 *
593 * - skb->transport_header: If key->dl_type is ETH_P_IP or ETH_P_IPV6 593 * - skb->transport_header: If key->eth.type is ETH_P_IP or ETH_P_IPV6
594 * on output, then just past the IP header, if one is present and 594 * on output, then just past the IP header, if one is present and
595 * of a correct length, otherwise the same as skb->network_header. 595 * of a correct length, otherwise the same as skb->network_header.
596 * For other key->dl_type values it is left untouched. 596 * For other key->eth.type values it is left untouched.
597 */ 597 */
598int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key, 598int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key,
599 int *key_lenp) 599 int *key_lenp)
@@ -618,6 +618,9 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key,
618 memcpy(key->eth.dst, eth->h_dest, ETH_ALEN); 618 memcpy(key->eth.dst, eth->h_dest, ETH_ALEN);
619 619
620 __skb_pull(skb, 2 * ETH_ALEN); 620 __skb_pull(skb, 2 * ETH_ALEN);
621 /* We are going to push all headers that we pull, so no need to
622 * update skb->csum here.
623 */
621 624
622 if (vlan_tx_tag_present(skb)) 625 if (vlan_tx_tag_present(skb))
623 key->eth.tci = htons(skb->vlan_tci); 626 key->eth.tci = htons(skb->vlan_tci);
@@ -1122,10 +1125,8 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
1122 1125
1123/** 1126/**
1124 * 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.
1125 * @priority: receives the skb priority 1128 * @flow: Receives extracted in_port, priority, tun_key and skb_mark.
1126 * @mark: receives the skb mark 1129 * @attr: Netlink attribute holding nested %OVS_KEY_ATTR_* Netlink attribute
1127 * @in_port: receives the extracted input port.
1128 * @key: Netlink attribute holding nested %OVS_KEY_ATTR_* Netlink attribute
1129 * sequence. 1130 * sequence.
1130 * 1131 *
1131 * 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
@@ -1133,15 +1134,15 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
1133 * 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
1134 * extracted from the packet itself. 1135 * extracted from the packet itself.
1135 */ 1136 */
1136int ovs_flow_metadata_from_nlattrs(u32 *priority, u32 *mark, u16 *in_port, 1137int ovs_flow_metadata_from_nlattrs(struct sw_flow *flow,
1137 const struct nlattr *attr) 1138 const struct nlattr *attr)
1138{ 1139{
1139 const struct nlattr *nla; 1140 const struct nlattr *nla;
1140 int rem; 1141 int rem;
1141 1142
1142 *in_port = DP_MAX_PORTS; 1143 flow->key.phy.in_port = DP_MAX_PORTS;
1143 *priority = 0; 1144 flow->key.phy.priority = 0;
1144 *mark = 0; 1145 flow->key.phy.skb_mark = 0;
1145 1146
1146 nla_for_each_nested(nla, attr, rem) { 1147 nla_for_each_nested(nla, attr, rem) {
1147 int type = nla_type(nla); 1148 int type = nla_type(nla);
@@ -1152,17 +1153,17 @@ int ovs_flow_metadata_from_nlattrs(u32 *priority, u32 *mark, u16 *in_port,
1152 1153
1153 switch (type) { 1154 switch (type) {
1154 case OVS_KEY_ATTR_PRIORITY: 1155 case OVS_KEY_ATTR_PRIORITY:
1155 *priority = nla_get_u32(nla); 1156 flow->key.phy.priority = nla_get_u32(nla);
1156 break; 1157 break;
1157 1158
1158 case OVS_KEY_ATTR_IN_PORT: 1159 case OVS_KEY_ATTR_IN_PORT:
1159 if (nla_get_u32(nla) >= DP_MAX_PORTS) 1160 if (nla_get_u32(nla) >= DP_MAX_PORTS)
1160 return -EINVAL; 1161 return -EINVAL;
1161 *in_port = nla_get_u32(nla); 1162 flow->key.phy.in_port = nla_get_u32(nla);
1162 break; 1163 break;
1163 1164
1164 case OVS_KEY_ATTR_SKB_MARK: 1165 case OVS_KEY_ATTR_SKB_MARK:
1165 *mark = nla_get_u32(nla); 1166 flow->key.phy.skb_mark = nla_get_u32(nla);
1166 break; 1167 break;
1167 } 1168 }
1168 } 1169 }