X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fpktbuf.c;h=b8698021d35ed1318c0ae9563a399329ffaf4e34;hb=8fec720d1371b5a15abdc02e173c746f2b8088d9;hp=67adb560624cd901351bc6b29d4abb85098f2870;hpb=750638bbefd179b91f8fb3c9c1bde855af05cf45;p=openvswitch diff --git a/ofproto/pktbuf.c b/ofproto/pktbuf.c index 67adb560..b8698021 100644 --- a/ofproto/pktbuf.c +++ b/ofproto/pktbuf.c @@ -26,7 +26,12 @@ #include "vconn.h" #include "vlog.h" -VLOG_DEFINE_THIS_MODULE(pktbuf) +VLOG_DEFINE_THIS_MODULE(pktbuf); + +COVERAGE_DEFINE(pktbuf_buffer_unknown); +COVERAGE_DEFINE(pktbuf_null_cookie); +COVERAGE_DEFINE(pktbuf_retrieved); +COVERAGE_DEFINE(pktbuf_reuse_error); /* Buffers are identified by a 32-bit opaque ID. We divide the ID * into a buffer number (low bits) and a cookie (high bits). The buffer number @@ -112,8 +117,8 @@ pktbuf_save(struct pktbuf *pb, struct ofpbuf *buffer, uint16_t in_port) if (++p->cookie >= COOKIE_MAX) { p->cookie = 0; } - p->buffer = ofpbuf_new(sizeof(struct ofp_packet_in) + buffer->size); - ofpbuf_reserve(p->buffer, sizeof(struct ofp_packet_in)); + p->buffer = ofpbuf_new_with_headroom(buffer->size, + sizeof(struct ofp_packet_in)); ofpbuf_put(p->buffer, buffer->data, buffer->size); p->timeout = time_msec() + OVERWRITE_MSECS; p->in_port = in_port;