mirror of
https://github.com/openvswitch/ovs
synced 2025-10-29 15:28:56 +00:00
ofpbuf: Simplify ofpbuf API.
ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
18
lib/rconn.c
18
lib/rconn.c
@@ -745,11 +745,11 @@ rconn_send__(struct rconn *rc, struct ofpbuf *b,
|
||||
copy_to_monitor(rc, b);
|
||||
|
||||
if (counter) {
|
||||
rconn_packet_counter_inc(counter, ofpbuf_size(b));
|
||||
rconn_packet_counter_inc(counter, b->size);
|
||||
}
|
||||
|
||||
/* Reuse 'frame' as a private pointer while 'b' is in txq. */
|
||||
ofpbuf_set_frame(b, counter);
|
||||
b->header = counter;
|
||||
|
||||
list_push_back(&rc->txq, &b->list_node);
|
||||
|
||||
@@ -1113,19 +1113,19 @@ try_send(struct rconn *rc)
|
||||
OVS_REQUIRES(rc->mutex)
|
||||
{
|
||||
struct ofpbuf *msg = ofpbuf_from_list(rc->txq.next);
|
||||
unsigned int n_bytes = ofpbuf_size(msg);
|
||||
struct rconn_packet_counter *counter = msg->frame;
|
||||
unsigned int n_bytes = msg->size;
|
||||
struct rconn_packet_counter *counter = msg->header;
|
||||
int retval;
|
||||
|
||||
/* Eagerly remove 'msg' from the txq. We can't remove it from the list
|
||||
* after sending, if sending is successful, because it is then owned by the
|
||||
* vconn, which might have freed it already. */
|
||||
list_remove(&msg->list_node);
|
||||
ofpbuf_set_frame(msg, NULL);
|
||||
msg->header = NULL;
|
||||
|
||||
retval = vconn_send(rc->vconn, msg);
|
||||
if (retval) {
|
||||
ofpbuf_set_frame(msg, counter);
|
||||
msg->header = counter;
|
||||
list_push_front(&rc->txq, &msg->list_node);
|
||||
if (retval != EAGAIN) {
|
||||
report_error(rc, retval);
|
||||
@@ -1226,9 +1226,9 @@ flush_queue(struct rconn *rc)
|
||||
}
|
||||
while (!list_is_empty(&rc->txq)) {
|
||||
struct ofpbuf *b = ofpbuf_from_list(list_pop_front(&rc->txq));
|
||||
struct rconn_packet_counter *counter = b->frame;
|
||||
struct rconn_packet_counter *counter = b->header;
|
||||
if (counter) {
|
||||
rconn_packet_counter_dec(counter, ofpbuf_size(b));
|
||||
rconn_packet_counter_dec(counter, b->size);
|
||||
}
|
||||
COVERAGE_INC(rconn_discarded);
|
||||
ofpbuf_delete(b);
|
||||
@@ -1338,7 +1338,7 @@ is_admitted_msg(const struct ofpbuf *b)
|
||||
enum ofptype type;
|
||||
enum ofperr error;
|
||||
|
||||
error = ofptype_decode(&type, ofpbuf_data(b));
|
||||
error = ofptype_decode(&type, b->data);
|
||||
if (error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user