diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index dee9ab344e4..174c2bf8ed3 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -61,8 +61,8 @@ static struct vlog_rate_limit err_rl = VLOG_RATE_LIMIT_INIT(60, 5); uint16_t tnl_udp_port_min = 32768; uint16_t tnl_udp_port_max = 61000; -void * -netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, +static void * +ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, unsigned int *hlen) { void *nh; @@ -149,9 +149,9 @@ netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, * offsets in the 'packet'. * * Return pointer to the L4 header added to 'packet'. */ -void * -netdev_tnl_push_ip_header(struct dp_packet *packet, const void *header, - int size, int *ip_tot_size, ovs_be32 ipv6_label) +static void * +push_ip_header(struct dp_packet *packet, const void *header, int size, + int *ip_tot_size, ovs_be32 ipv6_label) { struct eth_header *eth; struct ip_header *ip; @@ -208,7 +208,7 @@ udp_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, { struct udp_header *udp; - udp = netdev_tnl_ip_extract_tnl_md(packet, tnl, hlen); + udp = ip_extract_tnl_md(packet, tnl, hlen); if (!udp) { return NULL; } @@ -243,8 +243,8 @@ udp_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, /* Calculate inner l2 l3 l4 len as tunnel outer header is not * encapsulated now. */ static void -dp_packet_tnl_ol_process(struct dp_packet *packet, - const struct ovs_action_push_tnl *data) +tnl_ol_process(struct dp_packet *packet, + const struct ovs_action_push_tnl *data) { struct udp_header *udp = NULL; uint8_t opt_len = 0; @@ -318,9 +318,9 @@ netdev_tnl_push_udp_header(const struct netdev *netdev OVS_UNUSED, struct udp_header *udp; int ip_tot_size; - dp_packet_tnl_ol_process(packet, data); - udp = netdev_tnl_push_ip_header(packet, data->header, data->header_len, - &ip_tot_size, 0); + tnl_ol_process(packet, data); + udp = push_ip_header(packet, data->header, data->header_len, + &ip_tot_size, 0); /* set udp src port */ udp->udp_src = netdev_tnl_get_src_port(packet); @@ -367,10 +367,10 @@ eth_build_header(struct ovs_action_push_tnl *data, return eth + 1; } -void * -netdev_tnl_ip_build_header(struct ovs_action_push_tnl *data, - const struct netdev_tnl_build_header_params *params, - uint8_t next_proto, ovs_be32 ipv6_label) +static void * +ip_build_header(struct ovs_action_push_tnl *data, + const struct netdev_tnl_build_header_params *params, + uint8_t next_proto, ovs_be32 ipv6_label) { void *l3; @@ -421,7 +421,7 @@ udp_build_header(const struct netdev_tunnel_config *tnl_cfg, { struct udp_header *udp; - udp = netdev_tnl_ip_build_header(data, params, IPPROTO_UDP, 0); + udp = ip_build_header(data, params, IPPROTO_UDP, 0); udp->udp_dst = tnl_cfg->dst_port; if (params->is_ipv6 || params->flow->tunnel.flags & FLOW_TNL_F_CSUM) { @@ -461,7 +461,7 @@ parse_gre_header(struct dp_packet *packet, unsigned int ulen; uint16_t greh_protocol; - greh = netdev_tnl_ip_extract_tnl_md(packet, tnl, &ulen); + greh = ip_extract_tnl_md(packet, tnl, &ulen); if (!greh) { return -EINVAL; } @@ -553,8 +553,8 @@ netdev_gre_push_header(const struct netdev *netdev, struct gre_base_hdr *greh; int ip_tot_size; - greh = netdev_tnl_push_ip_header(packet, data->header, data->header_len, - &ip_tot_size, 0); + greh = push_ip_header(packet, data->header, data->header_len, + &ip_tot_size, 0); if (greh->flags & htons(GRE_CSUM)) { ovs_be16 *csum_opt = (ovs_be16 *) (greh + 1); @@ -580,7 +580,7 @@ netdev_gre_build_header(const struct netdev *netdev, ovs_16aligned_be32 *options; unsigned int hlen; - greh = netdev_tnl_ip_build_header(data, params, IPPROTO_GRE, 0); + greh = ip_build_header(data, params, IPPROTO_GRE, 0); if (params->flow->packet_type == htonl(PT_ETH)) { greh->protocol = htons(ETH_TYPE_TEB); @@ -642,7 +642,7 @@ netdev_erspan_pop_header(struct dp_packet *packet) goto err; } - greh = netdev_tnl_ip_extract_tnl_md(packet, tnl, &ulen); + greh = ip_extract_tnl_md(packet, tnl, &ulen); if (!greh) { goto err; } @@ -701,8 +701,8 @@ netdev_erspan_push_header(const struct netdev *netdev, struct erspan_md2 *md2; int ip_tot_size; - greh = netdev_tnl_push_ip_header(packet, data->header, data->header_len, - &ip_tot_size, 0); + greh = push_ip_header(packet, data->header, data->header_len, + &ip_tot_size, 0); /* update GRE seqno */ ovs_16aligned_be32 *seqno = (ovs_16aligned_be32 *) (greh + 1); @@ -729,7 +729,7 @@ netdev_erspan_build_header(const struct netdev *netdev, int erspan_ver; uint16_t sid; - greh = netdev_tnl_ip_build_header(data, params, IPPROTO_GRE, 0); + greh = ip_build_header(data, params, IPPROTO_GRE, 0); ersh = ERSPAN_HDR(greh); tun_id = ntohl(be64_to_be32(params->flow->tunnel.tun_id)); @@ -875,8 +875,8 @@ netdev_gtpu_push_header(const struct netdev *netdev, unsigned int payload_len; payload_len = dp_packet_size(packet); - udp = netdev_tnl_push_ip_header(packet, data->header, data->header_len, - &ip_tot_size, 0); + udp = push_ip_header(packet, data->header, data->header_len, + &ip_tot_size, 0); udp->udp_src = netdev_tnl_get_src_port(packet); udp->udp_len = htons(ip_tot_size); /* Postpone checksum to the egress netdev. */ @@ -959,8 +959,8 @@ netdev_srv6_build_header(const struct netdev *netdev, /* Writes the netdev_srv6_flowlabel enum value to the ipv6 * flowlabel field. It must later be replaced by a valid value * in the header push. */ - srh = netdev_tnl_ip_build_header(data, params, IPPROTO_ROUTING, - htonl(tnl_cfg->srv6_flowlabel)); + srh = ip_build_header(data, params, IPPROTO_ROUTING, + htonl(tnl_cfg->srv6_flowlabel)); srh->rt_hdr.segments_left = nr_segs - 1; srh->rt_hdr.type = IPV6_SRCRT_TYPE_4; @@ -1023,8 +1023,8 @@ netdev_srv6_push_header(const struct netdev *netdev OVS_UNUSED, break; } - netdev_tnl_push_ip_header(packet, data->header, - data->header_len, &ip_tot_size, ipv6_label); + push_ip_header(packet, data->header, data->header_len, + &ip_tot_size, ipv6_label); } struct dp_packet * @@ -1068,7 +1068,7 @@ netdev_srv6_pop_header(struct dp_packet *packet) } pkt_metadata_init_tnl(md); - netdev_tnl_ip_extract_tnl_md(packet, tnl, &hlen); + ip_extract_tnl_md(packet, tnl, &hlen); dp_packet_reset_packet(packet, hlen); return packet; diff --git a/lib/netdev-native-tnl.h b/lib/netdev-native-tnl.h index eb55dd0417a..0d76c9932db 100644 --- a/lib/netdev-native-tnl.h +++ b/lib/netdev-native-tnl.h @@ -115,11 +115,6 @@ netdev_tnl_ipv6_hdr(void *eth) return (void *)((char *)eth + sizeof (struct eth_header)); } -void * -netdev_tnl_ip_build_header(struct ovs_action_push_tnl *data, - const struct netdev_tnl_build_header_params *params, - uint8_t next_proto, ovs_be32 ipv6_label); - extern uint16_t tnl_udp_port_min; extern uint16_t tnl_udp_port_max; @@ -134,12 +129,6 @@ netdev_tnl_get_src_port(struct dp_packet *packet) tnl_udp_port_min); } -void * -netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, - unsigned int *hlen); -void * -netdev_tnl_push_ip_header(struct dp_packet *packet, const void *header, - int size, int *ip_tot_size, ovs_be32 ipv6_label); void netdev_tnl_egress_port_range(struct unixctl_conn *conn, int argc, const char *argv[], void *aux OVS_UNUSED);