X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fpackets.h;h=bf12937b1005b02648028b5eda4ab04db40ad32c;hb=7dc88496081cccc0b22e3e341d88d2e4867323df;hp=a1dd113901fd5168dc50b87edfb45549d58d24ad;hpb=b0d390e5fd65bc5b83e91b6e9970e069f66f77a5;p=cascardo%2Fovs.git diff --git a/lib/packets.h b/lib/packets.h index a1dd11390..bf12937b1 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -163,6 +163,14 @@ pkt_metadata_init(struct pkt_metadata *md, odp_port_t port) md->in_port.odp_port = port; } +/* This function prefetches the cachelines touched by pkt_metadata_init() + * For performance reasons the two functions should be kept in sync. */ +static inline void +pkt_metadata_prefetch_init(struct pkt_metadata *md) +{ + ovs_prefetch_range(md, offsetof(struct pkt_metadata, tunnel.ip_src)); +} + bool dpid_from_string(const char *s, uint64_t *dpidp); #define ETH_ADDR_LEN 6 @@ -581,8 +589,16 @@ ip_is_local_multicast(ovs_be32 ip) } int ip_count_cidr_bits(ovs_be32 netmask); void ip_format_masked(ovs_be32 ip, ovs_be32 mask, struct ds *); +bool ip_parse(const char *s, ovs_be32 *ip); char *ip_parse_masked(const char *s, ovs_be32 *ip, ovs_be32 *mask) OVS_WARN_UNUSED_RESULT; +char *ip_parse_cidr(const char *s, ovs_be32 *ip, unsigned int *plen) + OVS_WARN_UNUSED_RESULT; +char *ip_parse_masked_len(const char *s, int *n, ovs_be32 *ip, ovs_be32 *mask) + OVS_WARN_UNUSED_RESULT; +char *ip_parse_cidr_len(const char *s, int *n, ovs_be32 *ip, + unsigned int *plen) + OVS_WARN_UNUSED_RESULT; #define IP_VER(ip_ihl_ver) ((ip_ihl_ver) >> 4) #define IP_IHL(ip_ihl_ver) ((ip_ihl_ver) & 15) @@ -1024,8 +1040,17 @@ struct in6_addr ipv6_addr_bitand(const struct in6_addr *src, struct in6_addr ipv6_create_mask(int mask); int ipv6_count_cidr_bits(const struct in6_addr *netmask); bool ipv6_is_cidr(const struct in6_addr *netmask); + +bool ipv6_parse(const char *s, struct in6_addr *ip); char *ipv6_parse_masked(const char *s, struct in6_addr *ipv6, struct in6_addr *mask); +char *ipv6_parse_cidr(const char *s, struct in6_addr *ip, unsigned int *plen) + OVS_WARN_UNUSED_RESULT; +char *ipv6_parse_masked_len(const char *s, int *n, struct in6_addr *ipv6, + struct in6_addr *mask); +char *ipv6_parse_cidr_len(const char *s, int *n, struct in6_addr *ip, + unsigned int *plen) + OVS_WARN_UNUSED_RESULT; void *eth_compose(struct dp_packet *, const struct eth_addr eth_dst, const struct eth_addr eth_src, uint16_t eth_type,