On Wed, May 31, 2017 at 01:45:08AM +0000, Zhenyu Gao wrote: > We don't need to initialize sock,msg and sll before calling > sendmsg each time. > Just initialize them before the loop, it can reduce cpu cycles. > > Signed-off-by: Zhenyu Gao <[email protected]>
Thanks. I folded in the following additional style improvements and applied this to master. By the way, "[email protected]" is an obsolete email address. Please use [email protected]. --8<--------------------------cut here-------------------------->8-- diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index e5ad6ae32289..8ae740a17e4c 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -1192,13 +1192,11 @@ netdev_linux_send(struct netdev *netdev_, int qid OVS_UNUSED, struct dp_packet_batch *batch, bool may_steal, bool concurrent_txq OVS_UNUSED) { - int i; int error = 0; - int ifindex; int sock = 0; + struct sockaddr_ll sll; struct msghdr msg; - if (!is_tap_netdev(netdev_)) { sock = af_packet_sock(); if (sock < 0) { @@ -1206,7 +1204,7 @@ netdev_linux_send(struct netdev *netdev_, int qid OVS_UNUSED, goto free_batch; } - ifindex = netdev_get_ifindex(netdev_); + int ifindex = netdev_get_ifindex(netdev_); if (ifindex < 0) { error = -ifindex; goto free_batch; @@ -1227,7 +1225,7 @@ netdev_linux_send(struct netdev *netdev_, int qid OVS_UNUSED, } /* 'i' is incremented only if there's no error */ - for (i = 0; i < batch->count;) { + for (int i = 0; i < batch->count; ) { const void *data = dp_packet_data(batch->packets[i]); size_t size = dp_packet_size(batch->packets[i]); ssize_t retval; _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
