#include "list.h"
#include "netdev-provider.h"
#include "odp-netlink.h"
-#include "ofpbuf.h"
+#include "dp-packet.h"
#include "ovs-router.h"
#include "packets.h"
#include "poll-loop.h"
}
static void *
-ip_extract_tnl_md(struct ofpbuf *packet, struct flow_tnl *tnl)
+ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl)
{
struct ip_header *nh;
void *l4;
- nh = ofpbuf_l3(packet);
- l4 = ofpbuf_l4(packet);
+ nh = dp_packet_l3(packet);
+ l4 = dp_packet_l4(packet);
if (!nh || !l4) {
return NULL;
*
* Return pointer to the L4 header added to 'packet'. */
static void *
-push_ip_header(struct ofpbuf *packet,
+push_ip_header(struct dp_packet *packet,
const void *header, int size, int *ip_tot_size)
{
struct eth_header *eth;
struct ip_header *ip;
- eth = ofpbuf_push_uninit(packet, size);
- *ip_tot_size = ofpbuf_size(packet) - sizeof (struct eth_header);
+ eth = dp_packet_push_uninit(packet, size);
+ *ip_tot_size = dp_packet_size(packet) - sizeof (struct eth_header);
memcpy(eth, header, size);
ip = ip_hdr(eth);
}
static int
-parse_gre_header(struct ofpbuf *packet,
+parse_gre_header(struct dp_packet *packet,
struct flow_tnl *tnl)
{
const struct gre_base_hdr *greh;
}
hlen = gre_header_len(greh->flags);
- if (hlen > ofpbuf_size(packet)) {
+ if (hlen > dp_packet_size(packet)) {
return -EINVAL;
}
if (greh->flags & htons(GRE_CSUM)) {
ovs_be16 pkt_csum;
- pkt_csum = csum(greh, ofpbuf_size(packet) -
+ pkt_csum = csum(greh, dp_packet_size(packet) -
((const unsigned char *)greh -
- (const unsigned char *)ofpbuf_l2(packet)));
+ (const unsigned char *)dp_packet_l2(packet)));
if (pkt_csum) {
return -EINVAL;
}
}
static void
-gre_extract_md(struct dp_packet *dpif_pkt)
+gre_extract_md(struct dp_packet *packet)
{
- struct ofpbuf *packet = &dpif_pkt->ofpbuf;
- struct pkt_metadata *md = &dpif_pkt->md;
+ struct pkt_metadata *md = &packet->md;
struct flow_tnl *tnl = &md->tunnel;
int hlen = sizeof(struct eth_header) +
sizeof(struct ip_header) + 4;
memset(md, 0, sizeof *md);
- if (hlen > ofpbuf_size(packet)) {
+ if (hlen > dp_packet_size(packet)) {
return;
}
reset_tnl_md(md);
}
- ofpbuf_reset_packet(packet, hlen);
+ dp_packet_reset_packet(packet, hlen);
}
static int
}
static void
-netdev_gre_push_header__(struct ofpbuf *packet,
+netdev_gre_push_header__(struct dp_packet *packet,
const void *header, int size)
{
struct gre_base_hdr *greh;
int i;
for (i = 0; i < cnt; i++) {
- netdev_gre_push_header__(&packets[i]->ofpbuf,
- data->header, data->header_len);
+ netdev_gre_push_header__(packets[i], data->header, data->header_len);
packets[i]->md = PKT_METADATA_INITIALIZER(u32_to_odp(data->out_port));
}
return 0;
}
static void
-vxlan_extract_md(struct dp_packet *dpif_pkt)
+vxlan_extract_md(struct dp_packet *packet)
{
- struct ofpbuf *packet = &dpif_pkt->ofpbuf;
- struct pkt_metadata *md = &dpif_pkt->md;
+ struct pkt_metadata *md = &packet->md;
struct flow_tnl *tnl = &md->tunnel;
struct udp_header *udp;
struct vxlanhdr *vxh;
memset(md, 0, sizeof *md);
- if (VXLAN_HLEN > ofpbuf_size(packet)) {
+ if (VXLAN_HLEN > dp_packet_size(packet)) {
return;
}
tnl->tp_dst = udp->udp_dst;
tnl->tun_id = htonll(ntohl(get_16aligned_be32(&vxh->vx_vni)) >> 8);
- ofpbuf_reset_packet(packet, VXLAN_HLEN);
+ dp_packet_reset_packet(packet, VXLAN_HLEN);
}
static int
struct udp_header *udp;
int ip_tot_size;
- udp = push_ip_header(&packet->ofpbuf, header, size, &ip_tot_size);
+ udp = push_ip_header(packet, header, size, &ip_tot_size);
/* set udp src port */
udp->udp_src = get_src_port(packet);