l4p/udp: fix errno not set 43/18843/2
authorJianfeng Tan <henry.tjf@antfin.com>
Tue, 18 Dec 2018 02:59:18 +0000 (02:59 +0000)
committerKonstantin Ananyev <konstantin.ananyev@intel.com>
Thu, 23 May 2019 12:33:12 +0000 (12:33 +0000)
Return EAGAIN as errno properly.

Change-Id: I056e34e6eca4955e1938bd00d86965236eef55fd
Signed-off-by: Jian Zhang <wuzai.zj@antfin.com>
Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
lib/libtle_l4p/udp_rxtx.c

index e6b8ded..ab746d1 100644 (file)
@@ -559,8 +559,10 @@ tle_udp_stream_send(struct tle_stream *us, struct rte_mbuf *pkt[],
        mtu = dst.mtu - dst.l2_len - dst.l3_len;
 
        /* mark stream as not closable. */
-       if (rwl_acquire(&s->tx.use) < 0)
+       if (rwl_acquire(&s->tx.use) < 0) {
+               rte_errno = EAGAIN;
                return 0;
+       }
 
        nb = 0;
        for (i = 0, k = 0; k != num; k = i) {
@@ -590,8 +592,10 @@ tle_udp_stream_send(struct tle_stream *us, struct rte_mbuf *pkt[],
                                drb, &nb);
 
                        /* stream TX queue is full. */
-                       if (k != i)
+                       if (k != i) {
+                               rte_errno = EAGAIN;
                                break;
+                       }
                }
 
                /* enqueue packet that need to be fragmented */
@@ -611,6 +615,7 @@ tle_udp_stream_send(struct tle_stream *us, struct rte_mbuf *pkt[],
                        if (n == 0) {
                                while (rc-- != 0)
                                        rte_pktmbuf_free(frag[rc]);
+                               rte_errno = EAGAIN;
                                break;
                        }