From: Matias Elo <matias....@nokia.com>

The maximum frame length should include Ethernet header.

Signed-off-by: Matias Elo <matias....@nokia.com>
---
/** Email created from pull request 397 (matiaselo:dev/pktio_fixes)
 ** https://github.com/Linaro/odp/pull/397
 ** Patch: https://github.com/Linaro/odp/pull/397.patch
 ** Base sha: 520c170d758f2d37554631bf1467ec50e027cd3e
 ** Merge commit sha: 926e7716387610a8be67fbc051845450640f8df6
 **/
 platform/linux-generic/pktio/netmap.c | 5 ++---
 platform/linux-generic/pktio/socket.c | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 32df20709..0bdac737d 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -417,14 +417,13 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
        }
        pkt_nm->sockfd = sockfd;
 
-       /* Use either interface MTU (+ ethernet header length) or netmap buffer
-        * size as MTU, whichever is smaller. */
+       /* Use either interface MTU or netmap buffer size as MTU, whichever is
+        * smaller. */
        mtu = mtu_get_fd(pktio_entry->s.pkt_nm.sockfd, pkt_nm->if_name);
        if (mtu == 0) {
                ODP_ERR("Unable to read interface MTU\n");
                goto error;
        }
-       mtu += _ODP_ETHHDR_LEN;
        pkt_nm->mtu = (mtu < buf_size) ? mtu : buf_size;
 
        /* Check if RSS is supported. If not, set 'max_input_queues' to 1. */
diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 0a80035f5..b59775aef 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -143,7 +143,7 @@ uint32_t mtu_get_fd(int fd, const char *name)
                        ifr.ifr_name);
                return 0;
        }
-       return ifr.ifr_mtu;
+       return ifr.ifr_mtu + _ODP_ETHHDR_LEN;
 }
 
 /*

Reply via email to