diff options
author | Matias Elo <matias.elo@nokia.com> | 2017-03-03 13:53:15 +0200 |
---|---|---|
committer | Balakrishna Garapati <balakrishna.garapati@linaro.org> | 2017-03-03 14:05:08 +0100 |
commit | 3ed5cffff2dffdb8ada42353729bb16741a2985d (patch) | |
tree | 7a18b4474f45e549de83679fda0db6fb8ed19589 | |
parent | 052a759357c7af9e0bf8445da6c99a3de2cf86fa (diff) |
linux-dpdk: pktio: fix send_pkt_dpdk() return value
Fix send_pkt_dpdk() return value in mtu error case to make the pktio
validation suite pass.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
-rw-r--r-- | platform/linux-dpdk/odp_packet_dpdk.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c index c6ae446c6..a2acbd6f0 100644 --- a/platform/linux-dpdk/odp_packet_dpdk.c +++ b/platform/linux-dpdk/odp_packet_dpdk.c @@ -44,6 +44,8 @@ const pktio_if_ops_t * const pktio_if_ops[] = { extern pktio_table_t *pktio_tbl; +static uint32_t mtu_get_pkt_dpdk(pktio_entry_t *pktio_entry); + /* Test if s has only digits or not. Dpdk pktio uses only digits.*/ static int _dpdk_netdev_is_valid(const char *s) { @@ -468,12 +470,20 @@ static int send_pkt_dpdk(pktio_entry_t *pktio_entry, int index, if (!pkt_dpdk->lockless_tx) odp_ticketlock_unlock(&pkt_dpdk->tx_lock[index]); - if (odp_unlikely(pkts == 0 && rte_errno != 0)) { - return -1; - } else { - rte_errno = 0; - return pkts; + if (pkts == 0) { + uint32_t mtu; + + if (odp_unlikely(rte_errno != 0)) + return -1; + + mtu = mtu_get_pkt_dpdk(pktio_entry); + if (odp_unlikely(odp_packet_len(pkt_table[0]) > mtu)) { + __odp_errno = EMSGSIZE; + return -1; + } } + rte_errno = 0; + return pkts; } static int _dpdk_vdev_mtu(uint8_t port_id) |