Skip to content

Commit

Permalink
netdev-native-tnl: Cleanup exported functions.
Browse files Browse the repository at this point in the history
Do not expose functions that are not used anywhere else in OVS.

Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Apr 18, 2024
1 parent 79ee26e commit 0414af0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 42 deletions.
62 changes: 31 additions & 31 deletions lib/netdev-native-tnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 0 additions & 11 deletions lib/netdev-native-tnl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit 0414af0

Please sign in to comment.