From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by dpdk.org (Postfix) with ESMTP id 307BAC350 for ; Wed, 3 Jun 2015 21:19:32 +0200 (CEST) Received: by obbea3 with SMTP id ea3so16016590obb.0 for ; Wed, 03 Jun 2015 12:19:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pqdf4GIm56ZFin2r+x/ZGropT3svA/oWycNXIqGKjI8=; b=fadLN6eR/aMo6fyeirsKrs9S5S/2fdQHmO+Y8ZqvSYgJq7kNdz8Dm9XqRfKy44Zu1n bVX39yL9C9gZXAAiDPYKb44OxRzAp00XZUGanEwxbwudkwokoks8VrS+MR/Gl55QtqE2 MeIZiqEz2nhVBa764BUepO0z+2THVrd3LXJRgopjZX+WKziCU1d9FRpQzVfpd4mrZZNx o9JU3y3SV3hVh+wayEH6/OAf/PdaHRvu6l1BTf6nlwYHUEz4R491o8GJQAkGM+FtxXZG cklq3q4eCigGXI4u7y8Iw5n6LFsoDvbNMtYYJfZjMXtFm452wnJ8xxvYv1fnZjjMJDw+ c+rQ== X-Gm-Message-State: ALoCoQlXig1TSATcq7XyAnOspeAy4QdANFojU9SezkfM97D8j95k5AJpnVUzzylWC0l3twr45X7P X-Received: by 10.202.96.8 with SMTP id u8mr27476562oib.77.1433359171741; Wed, 03 Jun 2015 12:19:31 -0700 (PDT) Received: from localhost.localdomain (rrcs-97-77-120-78.sw.biz.rr.com. [97.77.120.78]) by mx.google.com with ESMTPSA id c9sm12039646oih.11.2015.06.03.12.19.29 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jun 2015 12:19:30 -0700 (PDT) From: Jay Rolette To: dev@dpdk.org Date: Wed, 3 Jun 2015 14:18:57 -0500 Message-Id: <1433359137-12720-3-git-send-email-rolette@infiniteio.com> X-Mailer: git-send-email 2.3.2 (Apple Git-55) In-Reply-To: <1433359137-12720-1-git-send-email-rolette@infiniteio.com> References: <1433359137-12720-1-git-send-email-rolette@infiniteio.com> Subject: [dpdk-dev] [PATCH 3/3] kni: rx loop was using the wrong counter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 19:19:32 -0000 Loop processing packets dequeued from rx_q was using the number of packets requested, not how many it actually received. Variable rename to make code a little more clear Signed-off-by: Jay Rolette --- lib/librte_eal/linuxapp/kni/kni_net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 13ccbb8..d37a6b9 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -131,7 +131,7 @@ kni_net_rx_normal(struct kni_dev *kni) { unsigned ret; uint32_t len; - unsigned i, num, num_fq; + unsigned i, num_rx, num_fq; struct rte_kni_mbuf *kva; struct rte_kni_mbuf *va[MBUF_BURST_SZ]; void * data_kva; @@ -146,15 +146,15 @@ kni_net_rx_normal(struct kni_dev *kni) } /* Calculate the number of entries to dequeue from rx_q */ - num = min(num_fq, (unsigned)MBUF_BURST_SZ); + num_rx = min(num_fq, (unsigned)MBUF_BURST_SZ); /* Burst dequeue from rx_q */ - ret = kni_fifo_get(kni->rx_q, (void **)va, num); - if (ret == 0) + num_rx = kni_fifo_get(kni->rx_q, (void **)va, num_rx); + if (num_rx == 0) return; /* Transfer received packets to netif */ - for (i = 0; i < num; i++) { + for (i = 0; i < num_rx; i++) { kva = (void *)va[i] - kni->mbuf_va + kni->mbuf_kva; len = kva->data_len; data_kva = kva->buf_addr + kva->data_off - kni->mbuf_va @@ -184,8 +184,8 @@ kni_net_rx_normal(struct kni_dev *kni) } /* Burst enqueue mbufs into free_q */ - ret = kni_fifo_put(kni->free_q, (void **)va, num); - if (ret != num) + ret = kni_fifo_put(kni->free_q, (void **)va, num_rx); + if (ret != num_rx) /* Failing should not happen */ KNI_ERR("Fail to enqueue entries into free_q\n"); } -- 2.3.2 (Apple Git-55)