dpdk: automate make config
authorJianfeng Tan <henry.tjf@antfin.com>
Thu, 13 Jun 2019 07:01:09 +0000 (15:01 +0800)
committerDaniel Pono Takamori <dtakamori@contractor.linuxfoundation.org>
Thu, 27 Jun 2019 18:57:30 +0000 (11:57 -0700)
Users need two steps to compile DPDK:
  $ make config -C dpdk
  $ make -C dpdk

We don't see the value for that. Add config as a dependency so that we
can compile it with only one step:
  $ make -C dpdk

Change-Id: I78bc728e904d969be9ef7575029eea9fda105bc6
Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
IT-16521

dpdk/Makefile
lib/libtle_l4p/tcp_stream.c
lib/libtle_l4p/tcp_tx_seg.h

index ddb4287..15204fa 100644 (file)
@@ -155,9 +155,7 @@ $(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config
 .PHONY: config
 config: $(B)/.config.ok
 
-$(B)/.build.ok: $(DPDK_SOURCE_FILES)
-       @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" \
-               first' && false ; fi
+$(B)/.build.ok: $(DPDK_SOURCE_FILES) $(B)/.config.ok
        @make $(DPDK_MAKE_ARGS) install
        @cp $(I)/.config $(B)/.config
        @touch $@
index 4e9ddb7..676521b 100644 (file)
@@ -506,6 +506,12 @@ tle_tcp_stream_listen(struct tle_stream *ts)
        if (ts == NULL || s->s.type >= TLE_VNUM)
                return -EINVAL;
 
+       /* app may listen for multiple times to change backlog,
+        * we will just return success for such cases.
+        */
+       if (s->tcb.state == TCP_ST_LISTEN)
+               return 0;
+
        /* mark stream as not closable. */
        if (tcp_stream_try_acquire(s) > 0) {
                rc = rte_atomic16_cmpset(&s->tcb.state, TCP_ST_CLOSED,
index a8d2425..ac2b13b 100644 (file)
@@ -27,6 +27,7 @@ tcp_segmentation(struct rte_mbuf *mbin, struct rte_mbuf *mbout[], uint16_t num,
        struct rte_mbuf *in_seg = NULL;
        uint32_t nbseg, in_seg_data_pos;
        uint32_t more_in_segs;
+       uint16_t bytes_left;
 
        in_seg = mbin;
        in_seg_data_pos = 0;
@@ -48,6 +49,7 @@ tcp_segmentation(struct rte_mbuf *mbin, struct rte_mbuf *mbout[], uint16_t num,
                        return -ENOMEM;
                }
 
+               bytes_left = mss;
                out_seg_prev = out_pkt;
                more_out_segs = 1;
                while (more_out_segs && more_in_segs) {
@@ -66,7 +68,7 @@ tcp_segmentation(struct rte_mbuf *mbin, struct rte_mbuf *mbout[], uint16_t num,
 
                        /* Prepare indirect buffer */
                        rte_pktmbuf_attach(out_seg, in_seg);
-                       len = mss;
+                       len = bytes_left;
                        if (len > (in_seg->data_len - in_seg_data_pos))
                                len = in_seg->data_len - in_seg_data_pos;
 
@@ -75,9 +77,10 @@ tcp_segmentation(struct rte_mbuf *mbin, struct rte_mbuf *mbout[], uint16_t num,
                        out_pkt->pkt_len = (uint16_t)(len + out_pkt->pkt_len);
                        out_pkt->nb_segs += 1;
                        in_seg_data_pos += len;
+                       bytes_left -= len;
 
                        /* Current output packet (i.e. fragment) done ? */
-                       if (out_pkt->pkt_len >= mss)
+                       if (bytes_left == 0)
                                more_out_segs = 0;
 
                        /* Current input segment done ? */