[ovs-dev,v4,4/7] netdev: Remove useless cutlen.

Message ID 1507215962-17692-5-git-send-email-i.maximets@samsung.com
State New
Headers show
Series
  • Output packet batching.
Related show

Commit Message

Ilya Maximets Oct. 5, 2017, 3:05 p.m.
Cutlen already applied while processing OVS_ACTION_ATTR_OUTPUT.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/netdev-bsd.c   | 2 +-
 lib/netdev-dpdk.c  | 5 -----
 lib/netdev-dummy.c | 2 +-
 lib/netdev-linux.c | 4 ++--
 4 files changed, 4 insertions(+), 9 deletions(-)

Comments

Eelco Chaudron Oct. 11, 2017, 9:07 a.m. | #1
On 05/10/17 17:05, Ilya Maximets wrote:
> Cutlen already applied while processing OVS_ACTION_ATTR_OUTPUT.
>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
This change looks good to me.

Acked-by: Eelco Chaudron <echaudro@redhat.com>

---8<---
Bodireddy, Bhanuprakash Oct. 13, 2017, 1:02 p.m. | #2
>Cutlen already applied while processing OVS_ACTION_ATTR_OUTPUT.
>
>Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>---
> lib/netdev-bsd.c   | 2 +-
> lib/netdev-dpdk.c  | 5 -----
> lib/netdev-dummy.c | 2 +-
> lib/netdev-linux.c | 4 ++--
> 4 files changed, 4 insertions(+), 9 deletions(-)
>
>diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c index 4f243b5..7454d03 100644
>--- a/lib/netdev-bsd.c
>+++ b/lib/netdev-bsd.c
>@@ -697,7 +697,7 @@ netdev_bsd_send(struct netdev *netdev_, int qid
>OVS_UNUSED,
>
>     for (i = 0; i < batch->count; i++) {
>         const void *data = dp_packet_data(batch->packets[i]);
>-        size_t size = dp_packet_get_send_len(batch->packets[i]);
>+        size_t size = dp_packet_size(batch->packets[i]);
>
>         while (!error) {
>             ssize_t retval;
>diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 011c6f7..300a0ae
>100644
>--- a/lib/netdev-dpdk.c
>+++ b/lib/netdev-dpdk.c
>@@ -1851,8 +1851,6 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid,
>struct dp_packet_batch *batch)
>         dropped += batch_cnt - cnt;
>     }
>
>-    dp_packet_batch_apply_cutlen(batch);
>-
>     for (uint32_t i = 0; i < cnt; i++) {
>         struct dp_packet *packet = batch->packets[i];
>         uint32_t size = dp_packet_size(packet); @@ -1905,7 +1903,6 @@
>netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
>         dpdk_do_tx_copy(netdev, qid, batch);
>         dp_packet_delete_batch(batch, true);
>     } else {
>-        dp_packet_batch_apply_cutlen(batch);
>         __netdev_dpdk_vhost_send(netdev, qid, batch->packets, batch-
>>count);
>     }
>     return 0;
>@@ -1936,8 +1933,6 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int
>qid,
>         int batch_cnt = dp_packet_batch_size(batch);
>         struct rte_mbuf **pkts = (struct rte_mbuf **) batch->packets;
>
>-        dp_packet_batch_apply_cutlen(batch);
>-
>         tx_cnt = netdev_dpdk_filter_packet_len(dev, pkts, batch_cnt);
>         tx_cnt = netdev_dpdk_qos_run(dev, pkts, tx_cnt);
>         dropped = batch_cnt - tx_cnt;
>diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 57ef13f..1f846b5
>100644
>--- a/lib/netdev-dummy.c
>+++ b/lib/netdev-dummy.c
>@@ -1071,7 +1071,7 @@ netdev_dummy_send(struct netdev *netdev, int
>qid OVS_UNUSED,
>     struct dp_packet *packet;
>     DP_PACKET_BATCH_FOR_EACH(packet, batch) {
>         const void *buffer = dp_packet_data(packet);
>-        size_t size = dp_packet_get_send_len(packet);
>+        size_t size = dp_packet_size(packet);
>
>         if (batch->packets[i]->packet_type != htonl(PT_ETH)) {
>             error = EPFNOSUPPORT;
>diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index aaf4899..e70cef3
>100644
>--- a/lib/netdev-linux.c
>+++ b/lib/netdev-linux.c
>@@ -1197,7 +1197,7 @@ netdev_linux_sock_batch_send(int sock, int ifindex,
>     for (int i = 0; i < batch->count; i++) {
>         struct dp_packet *packet = batch->packets[i];
>         iov[i].iov_base = dp_packet_data(packet);
>-        iov[i].iov_len = dp_packet_get_send_len(packet);
>+        iov[i].iov_len = dp_packet_size(packet);
>         mmsg[i].msg_hdr = (struct msghdr) { .msg_name = &sll,
>                                             .msg_namelen = sizeof sll,
>                                             .msg_iov = &iov[i], @@ -1234,7 +1234,7 @@
>netdev_linux_tap_batch_send(struct netdev *netdev_,
>     struct netdev_linux *netdev = netdev_linux_cast(netdev_);
>     for (int i = 0; i < batch->count; i++) {
>         struct dp_packet *packet = batch->packets[i];
>-        size_t size = dp_packet_get_send_len(packet);
>+        size_t size = dp_packet_size(packet);
>         ssize_t retval;
>         int error;

With the above change, I think we can get rid of dp_packet_get_send_len() API altogether. 
The only place it gets called now is dp_packet_batch_apply_cutlen() and that can be replaced.

dp_packet_batch_apply_cutlen(..) {
    ...
-    dp_packet_set_size(packet, dp_packet_get_send_len(packet));
+   dp_packet_set_size(packet, dp_packet_size(packet) - dp_packet_get_cutlen(packet));
}

- Bhanuprakash.

Patch

diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c
index 4f243b5..7454d03 100644
--- a/lib/netdev-bsd.c
+++ b/lib/netdev-bsd.c
@@ -697,7 +697,7 @@  netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED,
 
     for (i = 0; i < batch->count; i++) {
         const void *data = dp_packet_data(batch->packets[i]);
-        size_t size = dp_packet_get_send_len(batch->packets[i]);
+        size_t size = dp_packet_size(batch->packets[i]);
 
         while (!error) {
             ssize_t retval;
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 011c6f7..300a0ae 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1851,8 +1851,6 @@  dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch)
         dropped += batch_cnt - cnt;
     }
 
-    dp_packet_batch_apply_cutlen(batch);
-
     for (uint32_t i = 0; i < cnt; i++) {
         struct dp_packet *packet = batch->packets[i];
         uint32_t size = dp_packet_size(packet);
@@ -1905,7 +1903,6 @@  netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
         dpdk_do_tx_copy(netdev, qid, batch);
         dp_packet_delete_batch(batch, true);
     } else {
-        dp_packet_batch_apply_cutlen(batch);
         __netdev_dpdk_vhost_send(netdev, qid, batch->packets, batch->count);
     }
     return 0;
@@ -1936,8 +1933,6 @@  netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
         int batch_cnt = dp_packet_batch_size(batch);
         struct rte_mbuf **pkts = (struct rte_mbuf **) batch->packets;
 
-        dp_packet_batch_apply_cutlen(batch);
-
         tx_cnt = netdev_dpdk_filter_packet_len(dev, pkts, batch_cnt);
         tx_cnt = netdev_dpdk_qos_run(dev, pkts, tx_cnt);
         dropped = batch_cnt - tx_cnt;
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 57ef13f..1f846b5 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -1071,7 +1071,7 @@  netdev_dummy_send(struct netdev *netdev, int qid OVS_UNUSED,
     struct dp_packet *packet;
     DP_PACKET_BATCH_FOR_EACH(packet, batch) {
         const void *buffer = dp_packet_data(packet);
-        size_t size = dp_packet_get_send_len(packet);
+        size_t size = dp_packet_size(packet);
 
         if (batch->packets[i]->packet_type != htonl(PT_ETH)) {
             error = EPFNOSUPPORT;
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index aaf4899..e70cef3 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1197,7 +1197,7 @@  netdev_linux_sock_batch_send(int sock, int ifindex,
     for (int i = 0; i < batch->count; i++) {
         struct dp_packet *packet = batch->packets[i];
         iov[i].iov_base = dp_packet_data(packet);
-        iov[i].iov_len = dp_packet_get_send_len(packet);
+        iov[i].iov_len = dp_packet_size(packet);
         mmsg[i].msg_hdr = (struct msghdr) { .msg_name = &sll,
                                             .msg_namelen = sizeof sll,
                                             .msg_iov = &iov[i],
@@ -1234,7 +1234,7 @@  netdev_linux_tap_batch_send(struct netdev *netdev_,
     struct netdev_linux *netdev = netdev_linux_cast(netdev_);
     for (int i = 0; i < batch->count; i++) {
         struct dp_packet *packet = batch->packets[i];
-        size_t size = dp_packet_get_send_len(packet);
+        size_t size = dp_packet_size(packet);
         ssize_t retval;
         int error;