Skip to content

Commit

Permalink
netdev-native-tnl: refactor the tunnel push header.
Browse files Browse the repository at this point in the history
The patch adds additional 'struct netdev *' to the
native tunnel's push_header() interface.  This is used
for later GRE sequence number support.

Signed-off-by: William Tu <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
williamtu authored and blp committed May 22, 2018
1 parent 320326e commit 754f8ac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/netdev-native-tnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ udp_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl,


void
netdev_tnl_push_udp_header(struct dp_packet *packet,
netdev_tnl_push_udp_header(const struct netdev *netdev OVS_UNUSED,
struct dp_packet *packet,
const struct ovs_action_push_tnl *data)
{
struct udp_header *udp;
Expand Down Expand Up @@ -435,7 +436,8 @@ netdev_gre_pop_header(struct dp_packet *packet)
}

void
netdev_gre_push_header(struct dp_packet *packet,
netdev_gre_push_header(const struct netdev *netdev OVS_UNUSED,
struct dp_packet *packet,
const struct ovs_action_push_tnl *data)
{
struct gre_base_hdr *greh;
Expand Down
6 changes: 4 additions & 2 deletions lib/netdev-native-tnl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ netdev_gre_build_header(const struct netdev *netdev,
const struct netdev_tnl_build_header_params *params);

void
netdev_gre_push_header(struct dp_packet *packet,
netdev_gre_push_header(const struct netdev *netdev,
struct dp_packet *packet,
const struct ovs_action_push_tnl *data);
struct dp_packet *
netdev_gre_pop_header(struct dp_packet *packet);

void
netdev_tnl_push_udp_header(struct dp_packet *packet,
netdev_tnl_push_udp_header(const struct netdev *netdev,
struct dp_packet *packet,
const struct ovs_action_push_tnl *data);
int
netdev_geneve_build_header(const struct netdev *netdev,
Expand Down
3 changes: 2 additions & 1 deletion lib/netdev-provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ struct netdev_class {
* flow. Push header is called for packet to build header specific to
* a packet on actual transmit. It uses partial header build by
* build_header() which is passed as data. */
void (*push_header)(struct dp_packet *packet,
void (*push_header)(const struct netdev *,
struct dp_packet *packet,
const struct ovs_action_push_tnl *data);

/* Pop tunnel header from packet, build tunnel metadata and resize packet
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ netdev_push_header(const struct netdev *netdev,
{
struct dp_packet *packet;
DP_PACKET_BATCH_FOR_EACH (i, packet, batch) {
netdev->netdev_class->push_header(packet, data);
netdev->netdev_class->push_header(netdev, packet, data);
pkt_metadata_init(&packet->md, data->out_port);
}

Expand Down

0 comments on commit 754f8ac

Please sign in to comment.