diff options
author | Jiri Benc <jbenc@redhat.com> | 2016-11-10 10:28:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-13 00:51:02 -0500 |
commit | 5108bbaddc37c1c8583f0cf2562d7d3463cd12cb (patch) | |
tree | 6f3b06a52f5ef5b64c66eefb94f51c76dad00d79 /net/openvswitch/datapath.c | |
parent | 1560a074df6297e76278e459ca3eb9ff83a6f878 (diff) |
openvswitch: add processing of L3 packets
Support receiving, extracting flow key and sending of L3 packets (packets
without an Ethernet header).
Note that even after this patch, non-Ethernet interfaces are still not
allowed to be added to bridges. Similarly, netlink interface for sending and
receiving L3 packets to/from user space is not in place yet.
Based on previous versions by Lorand Jakab and Simon Horman.
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r-- | net/openvswitch/datapath.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index fa8760176b7d..1402f1be642d 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -560,7 +560,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
560 | struct sw_flow *flow; | 560 | struct sw_flow *flow; |
561 | struct sw_flow_actions *sf_acts; | 561 | struct sw_flow_actions *sf_acts; |
562 | struct datapath *dp; | 562 | struct datapath *dp; |
563 | struct ethhdr *eth; | ||
564 | struct vport *input_vport; | 563 | struct vport *input_vport; |
565 | u16 mru = 0; | 564 | u16 mru = 0; |
566 | int len; | 565 | int len; |
@@ -581,17 +580,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
581 | 580 | ||
582 | nla_memcpy(__skb_put(packet, len), a[OVS_PACKET_ATTR_PACKET], len); | 581 | nla_memcpy(__skb_put(packet, len), a[OVS_PACKET_ATTR_PACKET], len); |
583 | 582 | ||
584 | skb_reset_mac_header(packet); | ||
585 | eth = eth_hdr(packet); | ||
586 | |||
587 | /* Normally, setting the skb 'protocol' field would be handled by a | ||
588 | * call to eth_type_trans(), but it assumes there's a sending | ||
589 | * device, which we may not have. */ | ||
590 | if (eth_proto_is_802_3(eth->h_proto)) | ||
591 | packet->protocol = eth->h_proto; | ||
592 | else | ||
593 | packet->protocol = htons(ETH_P_802_2); | ||
594 | |||
595 | /* Set packet's mru */ | 583 | /* Set packet's mru */ |
596 | if (a[OVS_PACKET_ATTR_MRU]) { | 584 | if (a[OVS_PACKET_ATTR_MRU]) { |
597 | mru = nla_get_u16(a[OVS_PACKET_ATTR_MRU]); | 585 | mru = nla_get_u16(a[OVS_PACKET_ATTR_MRU]); |
@@ -618,6 +606,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
618 | rcu_assign_pointer(flow->sf_acts, acts); | 606 | rcu_assign_pointer(flow->sf_acts, acts); |
619 | packet->priority = flow->key.phy.priority; | 607 | packet->priority = flow->key.phy.priority; |
620 | packet->mark = flow->key.phy.skb_mark; | 608 | packet->mark = flow->key.phy.skb_mark; |
609 | packet->protocol = flow->key.eth.type; | ||
621 | 610 | ||
622 | rcu_read_lock(); | 611 | rcu_read_lock(); |
623 | dp = get_dp_rcu(net, ovs_header->dp_ifindex); | 612 | dp = get_dp_rcu(net, ovs_header->dp_ifindex); |