diff options
author | Jan Scheurich <jan.scheurich@ericsson.com> | 2017-04-25 16:29:59 +0000 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-05-03 16:56:40 -0700 |
commit | 2482b0b0c8c4ceae1f7e4620cd8620ce144e1bf3 (patch) | |
tree | dca094fdddf67d6e24e686ecaf96485e48ffcb59 /ovn | |
parent | c2f4c39be4e288e7a08974aea53b18627a1ef9ef (diff) | |
download | openvswitch-2482b0b0c8c4ceae1f7e4620cd8620ce144e1bf3.tar.gz |
userspace: Add packet_type in dp_packet and flow
This commit adds a packet_type attribute to the structs dp_packet and flow
to explicitly carry the type of the packet as prepration for the
introduction of the so-called packet type-aware pipeline (PTAP) in OVS.
The packet_type is a big-endian 32 bit integer with the encoding as
specified in OpenFlow verion 1.5.
The upper 16 bits contain the packet type name space. Pre-defined values
are defined in openflow-common.h:
enum ofp_header_type_namespaces {
OFPHTN_ONF = 0, /* ONF namespace. */
OFPHTN_ETHERTYPE = 1, /* ns_type is an Ethertype. */
OFPHTN_IP_PROTO = 2, /* ns_type is a IP protocol number. */
OFPHTN_UDP_TCP_PORT = 3, /* ns_type is a TCP or UDP port. */
OFPHTN_IPV4_OPTION = 4, /* ns_type is an IPv4 option number. */
};
The lower 16 bits specify the actual type in the context of the name space.
Only name spaces 0 and 1 will be supported for now.
For name space OFPHTN_ONF the relevant packet type is 0 (Ethernet).
This is the default packet_type in OVS and the only one supported so far.
Packets of type (OFPHTN_ONF, 0) are called Ethernet packets.
In name space OFPHTN_ETHERTYPE the type is the Ethertype of the packet.
A packet of type (OFPHTN_ETHERTYPE, <Ethertype>) is a standard L2 packet
whith the Ethernet header (and any VLAN tags) removed to expose the L3
(or L2.5) payload of the packet. These will simply be called L3 packets.
The Ethernet address fields dl_src and dl_dst in struct flow are not
applicable for an L3 packet and must be zero. However, to maintain
compatibility with the large code base, we have chosen to copy the
Ethertype of an L3 packet into the the dl_type field of struct flow.
This does not mean that it will be possible to match on dl_type for L3
packets with PTAP later on. Matching must be done on packet_type instead.
New dp_packets are initialized with packet_type Ethernet. Ports that
receive L3 packets will have to explicitly adjust the packet_type.
Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com>
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r-- | ovn/controller/pinctrl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 4b443595b..9ad413376 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -143,7 +143,7 @@ pinctrl_handle_arp(const struct flow *ip_flow, const struct match *md, dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub); compose_arp__(&packet); - struct eth_header *eth = dp_packet_l2(&packet); + struct eth_header *eth = dp_packet_eth(&packet); eth->eth_dst = ip_flow->dl_dst; eth->eth_src = ip_flow->dl_src; @@ -361,7 +361,7 @@ pinctrl_handle_put_dhcp_opts( /* Log the response. */ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 40); - const struct eth_header *l2 = dp_packet_l2(&pkt_out); + const struct eth_header *l2 = dp_packet_eth(&pkt_out); VLOG_INFO_RL(&rl, "DHCP%s "ETH_ADDR_FMT" "IP_FMT"", msg_type == DHCP_MSG_OFFER ? "OFFER" : "ACK", ETH_ADDR_ARGS(l2->eth_src), IP_ARGS(*offer_ip)); @@ -641,7 +641,7 @@ pinctrl_handle_put_dhcpv6_opts( csum = packet_csum_pseudoheader6(dp_packet_l3(&pkt_out)); csum = csum_continue(csum, out_udp, dp_packet_size(&pkt_out) - ((const unsigned char *)out_udp - - (const unsigned char *)dp_packet_l2(&pkt_out))); + (const unsigned char *)dp_packet_eth(&pkt_out))); out_udp->udp_csum = csum_finish(csum); if (!out_udp->udp_csum) { out_udp->udp_csum = htons(0xffff); |