aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-06-14 18:31:22 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-14 18:31:22 -0400
commit09ce069dff607f86dcdeb541d20734a8f42478c5 (patch)
tree03c7e9dc78d4dbfc2b3687053bbbd1680789934d
parent948e306d7d645af80ea331b60495710fe4fe12bb (diff)
parent93d8fd1514b6862c3370ea92be3f3b4216e0bf8f (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch
Jesse Gross says: ==================== A few miscellaneous improvements and cleanups before the GRE tunnel integration series. Intended for net-next/3.11. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/uapi/linux/openvswitch.h1
-rw-r--r--net/openvswitch/actions.c4
-rw-r--r--net/openvswitch/datapath.c17
-rw-r--r--net/openvswitch/flow.c29
-rw-r--r--net/openvswitch/flow.h4
-rw-r--r--net/openvswitch/vport-internal_dev.c1
-rw-r--r--net/openvswitch/vport-netdev.c7
-rw-r--r--net/openvswitch/vport-netdev.h1
-rw-r--r--net/openvswitch/vport.c11
-rw-r--r--net/openvswitch/vport.h13
10 files changed, 51 insertions, 37 deletions
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 405918dd7b3f..424672db7f12 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -192,7 +192,6 @@ enum ovs_vport_type {
192 * optional; if not specified a free port number is automatically selected. 192 * optional; if not specified a free port number is automatically selected.
193 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 193 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
194 * of vport. 194 * of vport.
195 * and other attributes are ignored.
196 * 195 *
197 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 196 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
198 * look up the vport to operate on; otherwise dp_idx from the &struct 197 * look up the vport to operate on; otherwise dp_idx from the &struct
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 894b6cbdd929..596d6373399d 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -130,9 +130,13 @@ static int set_eth_addr(struct sk_buff *skb,
130 if (unlikely(err)) 130 if (unlikely(err))
131 return err; 131 return err;
132 132
133 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_ALEN * 2);
134
133 memcpy(eth_hdr(skb)->h_source, eth_key->eth_src, ETH_ALEN); 135 memcpy(eth_hdr(skb)->h_source, eth_key->eth_src, ETH_ALEN);
134 memcpy(eth_hdr(skb)->h_dest, eth_key->eth_dst, ETH_ALEN); 136 memcpy(eth_hdr(skb)->h_dest, eth_key->eth_dst, ETH_ALEN);
135 137
138 ovs_skb_postpush_rcsum(skb, eth_hdr(skb), ETH_ALEN * 2);
139
136 return 0; 140 return 0;
137} 141}
138 142
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index d12d6b8b5e8b..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
@@ -1812,10 +1809,11 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
1812 if (IS_ERR(vport)) 1809 if (IS_ERR(vport))
1813 goto exit_unlock; 1810 goto exit_unlock;
1814 1811
1815 err = 0;
1816 if (a[OVS_VPORT_ATTR_TYPE] && 1812 if (a[OVS_VPORT_ATTR_TYPE] &&
1817 nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) 1813 nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) {
1818 err = -EINVAL; 1814 err = -EINVAL;
1815 goto exit_unlock;
1816 }
1819 1817
1820 reply = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 1818 reply = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
1821 if (!reply) { 1819 if (!reply) {
@@ -1823,10 +1821,11 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
1823 goto exit_unlock; 1821 goto exit_unlock;
1824 } 1822 }
1825 1823
1826 if (!err && a[OVS_VPORT_ATTR_OPTIONS]) 1824 if (a[OVS_VPORT_ATTR_OPTIONS]) {
1827 err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]); 1825 err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]);
1828 if (err) 1826 if (err)
1829 goto exit_free; 1827 goto exit_free;
1828 }
1830 1829
1831 if (a[OVS_VPORT_ATTR_UPCALL_PID]) 1830 if (a[OVS_VPORT_ATTR_UPCALL_PID])
1832 vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]); 1831 vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]);
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: