Any progress with https://bugs.linaro.org/show_bug.cgi?id=1365

On 2 April 2015 at 11:21, Stuart Haslam <[email protected]> wrote:

> On Thu, Apr 02, 2015 at 02:17:02PM +0300, Maxim Uvarov wrote:
> > On 04/02/15 14:07, Stuart Haslam wrote:
> > >  {
> > >-    odp_packet_t pkt;
> > >     uint8_t *frame;
> > >     uint32_t frame_len;
> > >-    unsigned i;
> > >-    unsigned flags;
> > >     int sockfd;
> > >-    int nb_tx;
> > >     int ret;
> > >+    unsigned i, n;
> > >     sockfd = pkt_sock->sockfd;
> > >-    flags = MSG_DONTWAIT;
> > >     i = 0;
> > >     while (i < len) {
> > >-            pkt = pkt_table[i];
> > >+            frame = odp_packet_l2_ptr(pkt_table[i], &frame_len);
> > >-            frame = odp_packet_l2_ptr(pkt, &frame_len);
> > >-
> > >-            ret = send(sockfd, frame, frame_len, flags);
> > >+            ret = send(sockfd, frame, frame_len, MSG_DONTWAIT);
> > >             if (odp_unlikely(ret == -1)) {
> > >-                    if (odp_likely(errno == EAGAIN)) {
> > >-                            flags = 0;      /* blocking for next
> rounds */
> > >-                            continue;       /* resend buffer */
> > >-                    } else {
> > >-                            break;
> > >+                    if (i == 0 && SOCK_ERR_REPORT(errno)) {
> > >+                            __odp_errno = errno;
> > >+                            ODP_ERR("send(basic): %s\n",
> strerror(errno));
> > >+                            return -1;
> > >                     }
> > >+                    break;
> > >             }
> > >             i++;
> > >-    }                       /* end while */
> > >-    nb_tx = i;
> > >+    }
> > >-    for (i = 0; i < len; i++)
> > >-            odp_packet_free(pkt_table[i]);
> > >+    for (n = 0; n < i; ++n)
> > >+            odp_packet_free(pkt_table[n]);
> > >-    return nb_tx;
> > >+    return i;
> > >  }
> > >  /*
> > >@@ -383,9 +379,7 @@ int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock,
> > >     struct iovec iovecs[ODP_PACKET_SOCKET_MAX_BURST_TX];
> > >     int ret;
> > >     int sockfd;
> > >-    unsigned i;
> > >-    unsigned sent_msgs = 0;
> > >-    unsigned flags;
> > >+    unsigned i, n;
> > >     if (odp_unlikely(len > ODP_PACKET_SOCKET_MAX_BURST_TX))
> > >             return -1;
> > >@@ -401,17 +395,24 @@ int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock,
> > >             msgvec[i].msg_hdr.msg_iovlen = 1;
> > >     }
> > >-    flags = MSG_DONTWAIT;
> > >-    for (i = 0; i < len; i += sent_msgs) {
> > >-            ret = sendmmsg(sockfd, &msgvec[i], len - i, flags);
> > >-            sent_msgs = ret > 0 ? (unsigned)ret : 0;
> > >-            flags = 0;      /* blocking for next rounds */
> > >+    for (i = 0; i < len; ) {
> > >+            ret = sendmmsg(sockfd, &msgvec[i], len - i, MSG_DONTWAIT);
> > >+            if (odp_unlikely(ret == -1)) {
> > >+                    if (i == 0 && SOCK_ERR_REPORT(errno)) {
> > >+                            __odp_errno = errno;
> > >+                            ODP_ERR("sendmmsg(): %s\n",
> strerror(errno));
> > >+                            return -1;
> > >+                    }
> > >+                    break;
> > >+            }
> > >+
> > >+            i += (unsigned)ret;
> > it looks like i should be simple int not unsigned.
> >
> > Maxim.
>
> Possibly would be tidier, yes. I'll take a look at the best way to sort
> it out, as it's compared with len which is unsigned, even though len is
> signed in odp_pktio_send().
>
> --
> Stuart.
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to