summaryrefslogtreecommitdiff
path: root/drivers/net/enic
diff options
context:
space:
mode:
authorHyong Youb Kim <hyonkim@cisco.com>2018-11-13 07:38:10 -0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-14 00:35:53 +0100
commit7ac790d63bf0045d79b1c9f3bf692fc460fcd375 (patch)
tree4d17af8c2252dfa8ee92cab00c52773b2b9af3f7 /drivers/net/enic
parentf7c8539801480bf39f1792daf562c664ee6ad37b (diff)
downloaddpdk-next-eventdev-7ac790d63bf0045d79b1c9f3bf692fc460fcd375.zip
dpdk-next-eventdev-7ac790d63bf0045d79b1c9f3bf692fc460fcd375.tar.gz
dpdk-next-eventdev-7ac790d63bf0045d79b1c9f3bf692fc460fcd375.tar.xz
net/enic: fix size check in Tx prepare handler
The current code wrongly assumes that packets are non-TSO and ends up rejecting large TSO packets. Check non-TSO and TSO max packet sizes separately. Fixes: 5a12c387405a ("net/enic: check maximum packet size in Tx prepare handler") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
Diffstat (limited to 'drivers/net/enic')
-rw-r--r--drivers/net/enic/enic_rxtx.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index 5189ee6..0aadd34 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -393,11 +393,22 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
for (i = 0; i != nb_pkts; i++) {
m = tx_pkts[i];
- if (unlikely(m->pkt_len > ENIC_TX_MAX_PKT_SIZE)) {
- rte_errno = EINVAL;
- return i;
- }
ol_flags = m->ol_flags;
+ if (!(ol_flags & PKT_TX_TCP_SEG)) {
+ if (unlikely(m->pkt_len > ENIC_TX_MAX_PKT_SIZE)) {
+ rte_errno = EINVAL;
+ return i;
+ }
+ } else {
+ uint16_t header_len;
+
+ header_len = m->l2_len + m->l3_len + m->l4_len;
+ if (m->tso_segsz + header_len > ENIC_TX_MAX_PKT_SIZE) {
+ rte_errno = EINVAL;
+ return i;
+ }
+ }
+
if (ol_flags & wq->tx_offload_notsup_mask) {
rte_errno = ENOTSUP;
return i;