Skip to content

Commit

Permalink
dpif_packet: Rename to dp_packet
Browse files Browse the repository at this point in the history
dp_packet is short and better name for datapath packet
structure.

Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
Pravin B Shelar committed Mar 3, 2015
1 parent 5aa5d00 commit e14deea
Show file tree
Hide file tree
Showing 20 changed files with 143 additions and 144 deletions.
4 changes: 2 additions & 2 deletions lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ lib_libopenvswitch_la_SOURCES = \
lib/dirs.h \
lib/dpctl.c \
lib/dpctl.h \
lib/dp-packet.h \
lib/dp-packet.c \
lib/dpif-netdev.c \
lib/dpif-netdev.h \
lib/dpif-provider.h \
Expand Down Expand Up @@ -177,8 +179,6 @@ lib_libopenvswitch_la_SOURCES = \
lib/ovsdb-parser.h \
lib/ovsdb-types.c \
lib/ovsdb-types.h \
lib/packet-dpif.c \
lib/packet-dpif.h \
lib/packets.c \
lib/packets.h \
lib/pcap-file.c \
Expand Down
24 changes: 12 additions & 12 deletions lib/packet-dpif.c → lib/dp-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/

#include <config.h>
#include "packet-dpif.h"
#include "dp-packet.h"

#include "ofpbuf.h"

struct dpif_packet *
dpif_packet_new_with_headroom(size_t size, size_t headroom)
struct dp_packet *
dp_packet_new_with_headroom(size_t size, size_t headroom)
{
struct dpif_packet *p = xmalloc(sizeof *p);
struct dp_packet *p = xmalloc(sizeof *p);
struct ofpbuf *b = &p->ofpbuf;

ofpbuf_init(b, size + headroom);
Expand All @@ -32,10 +32,10 @@ dpif_packet_new_with_headroom(size_t size, size_t headroom)
return p;
}

struct dpif_packet *
dpif_packet_clone_from_ofpbuf(const struct ofpbuf *b)
struct dp_packet *
dp_packet_clone_from_ofpbuf(const struct ofpbuf *b)
{
struct dpif_packet *p = xmalloc(sizeof *p);
struct dp_packet *p = xmalloc(sizeof *p);
size_t headroom = ofpbuf_headroom(b);

ofpbuf_init(&p->ofpbuf, ofpbuf_size(b) + headroom);
Expand All @@ -57,15 +57,15 @@ dpif_packet_clone_from_ofpbuf(const struct ofpbuf *b)
return p;
}

struct dpif_packet *
dpif_packet_clone(struct dpif_packet *p)
struct dp_packet *
dp_packet_clone(struct dp_packet *p)
{
struct dpif_packet *newp;
struct dp_packet *newp;

newp = dpif_packet_clone_from_ofpbuf(&p->ofpbuf);
newp = dp_packet_clone_from_ofpbuf(&p->ofpbuf);
memcpy(&newp->md, &p->md, sizeof p->md);

dpif_packet_set_dp_hash(newp, dpif_packet_get_dp_hash(p));
dp_packet_set_dp_hash(newp, dp_packet_get_dp_hash(p));

return newp;
}
16 changes: 8 additions & 8 deletions lib/packet-dpif.h → lib/dp-packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ extern "C" {

/* A packet received from a netdev and passed to a dpif. */

struct dpif_packet {
struct dp_packet {
struct ofpbuf ofpbuf; /* Packet data. */
#ifndef DPDK_NETDEV
uint32_t dp_hash; /* Packet hash. */
#endif
struct pkt_metadata md;
};

struct dpif_packet *dpif_packet_new_with_headroom(size_t size,
struct dp_packet *dp_packet_new_with_headroom(size_t size,
size_t headroom);

struct dpif_packet *dpif_packet_clone_from_ofpbuf(const struct ofpbuf *b);
struct dp_packet *dp_packet_clone_from_ofpbuf(const struct ofpbuf *b);

struct dpif_packet *dpif_packet_clone(struct dpif_packet *p);
struct dp_packet *dp_packet_clone(struct dp_packet *p);

static inline void dpif_packet_delete(struct dpif_packet *p)
static inline void dp_packet_delete(struct dp_packet *p)
{
struct ofpbuf *buf = &p->ofpbuf;

ofpbuf_delete(buf);
}

static inline uint32_t dpif_packet_get_dp_hash(struct dpif_packet *p)
static inline uint32_t dp_packet_get_dp_hash(struct dp_packet *p)
{
#ifdef DPDK_NETDEV
return p->ofpbuf.mbuf.pkt.hash.rss;
Expand All @@ -56,7 +56,7 @@ static inline uint32_t dpif_packet_get_dp_hash(struct dpif_packet *p)
#endif
}

static inline void dpif_packet_set_dp_hash(struct dpif_packet *p,
static inline void dp_packet_set_dp_hash(struct dp_packet *p,
uint32_t hash)
{
#ifdef DPDK_NETDEV
Expand All @@ -70,4 +70,4 @@ static inline void dpif_packet_set_dp_hash(struct dpif_packet *p,
}
#endif

#endif /* packet-dpif.h */
#endif /* dp-packet.h */
Loading

0 comments on commit e14deea

Please sign in to comment.