X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fpackets.h;fp=lib%2Fpackets.h;h=f294d847e578373336b99341a2ccd6146ef2a2ff;hb=7d78f21c057ff50a823220d809ac38c3d907243c;hp=eca24d59585d62f61b3d19e4a59bdfa7c7827109;hpb=8d25251929c8f325bed0fff24192d5a87034b32e;p=sliver-openvswitch.git diff --git a/lib/packets.h b/lib/packets.h index eca24d595..f294d847e 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -23,7 +23,6 @@ #include #include #include "compiler.h" -#include "flow.h" #include "openvswitch/types.h" #include "random.h" #include "hash.h" @@ -32,6 +31,24 @@ struct ofpbuf; struct ds; +/* Tunnel information used in flow key and metadata. */ +struct flow_tnl { + ovs_be64 tun_id; + ovs_be32 ip_src; + ovs_be32 ip_dst; + uint16_t flags; + uint8_t ip_tos; + uint8_t ip_ttl; +}; + +/* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port + * numbers and other times datapath (dpif) port numbers. This union allows + * access to both. */ +union flow_in_port { + odp_port_t odp_port; + ofp_port_t ofp_port; +}; + /* Datapath packet metadata */ struct pkt_metadata { uint32_t recirc_id; /* Recirculation id carried with the @@ -48,21 +65,6 @@ struct pkt_metadata { #define PKT_METADATA_INITIALIZER(PORT) \ (struct pkt_metadata){ 0, 0, { 0, 0, 0, 0, 0, 0}, 0, 0, {(PORT)} } -static inline struct pkt_metadata -pkt_metadata_from_flow(const struct flow *flow) -{ - struct pkt_metadata md; - - md.recirc_id = flow->recirc_id; - md.dp_hash = flow->dp_hash; - md.tunnel = flow->tunnel; - md.skb_priority = flow->skb_priority; - md.pkt_mark = flow->pkt_mark; - md.in_port = flow->in_port; - - return md; -} - bool dpid_from_string(const char *s, uint64_t *dpidp); #define ETH_ADDR_LEN 6 @@ -536,6 +538,7 @@ BUILD_ASSERT_DECL(UDP_HEADER_LEN == sizeof(struct udp_header)); #define TCP_CTL(flags, offset) (htons((flags) | ((offset) << 12))) #define TCP_FLAGS(tcp_ctl) (ntohs(tcp_ctl) & 0x0fff) +#define TCP_FLAGS_BE16(tcp_ctl) ((tcp_ctl) & htons(0x0fff)) #define TCP_OFFSET(tcp_ctl) (ntohs(tcp_ctl) >> 12) #define TCP_HEADER_LEN 20 @@ -651,23 +654,6 @@ static inline bool dl_type_is_ip_any(ovs_be16 dl_type) || dl_type == htons(ETH_TYPE_IPV6); } -static inline bool is_ip_any(const struct flow *flow) -{ - return dl_type_is_ip_any(flow->dl_type); -} - -static inline bool is_icmpv4(const struct flow *flow) -{ - return (flow->dl_type == htons(ETH_TYPE_IP) - && flow->nw_proto == IPPROTO_ICMP); -} - -static inline bool is_icmpv6(const struct flow *flow) -{ - return (flow->dl_type == htons(ETH_TYPE_IPV6) - && flow->nw_proto == IPPROTO_ICMPV6); -} - void format_ipv6_addr(char *addr_str, const struct in6_addr *addr); void print_ipv6_addr(struct ds *string, const struct in6_addr *addr); void print_ipv6_masked(struct ds *string, const struct in6_addr *addr,