DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [dpdk-dev] [Bug 213] Fix the problem of KNI device (Net Stack kthread) keeps dropping packets (stats.tx_dropped++) and TX thread logs "KNI: Out of memory"
Date: Mon, 25 Feb 2019 03:02:51 +0000	[thread overview]
Message-ID: <bug-213-3@http.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=213

            Bug ID: 213
           Summary: Fix the problem of KNI device (Net Stack kthread)
                    keeps dropping packets (stats.tx_dropped++) and TX
                    thread logs "KNI: Out of memory"
           Product: DPDK
           Version: unspecified
          Hardware: All
                OS: All
            Status: CONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: willkozheng@tencent.com
  Target Milestone: ---

When the number of concurrent packets is greater than the size of
rte_kni::pktmbuf_pool, it may fall into a situation that both fifo->alloc_q and
fifo->tx_q are empty, in which there is no condition to trigger kni_fifo_put
for fifo->alloc_q, resulting in no available mbuf for KNI device and dropping
packets, which is unrecoverable.
---------------------------------------------------------------
中文版:
修复KNI虚拟网卡(Net Stack kthread)一直发包丢失(stats.tx_dropped++)且TX Thread输出Log "KNI: Out
of memory"的问题
当KNI并发包量大于rte_kni::pktmbuf_pool的大小时,可能出现fifo->alloc_q和fifo->tx_q同时为空,这时由于没有条件触发fifo->alloc_q的kni_fifo_put方法,导致虚拟网卡没有可用的mbuf,从而出现一直丢包,并且该状态不可恢复.

lib/librte_kni/rte_kni_fifo.h 增加函数
static inline bool
kni_fifo_empty(struct rte_kni_fifo *fifo)
{
        return fifo->write == fifo->read;
}

lib/librte_kni/rte_kni.c 修改函数
unsigned
rte_kni_rx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs, unsigned num)
{
        unsigned ret = kni_fifo_get(kni->tx_q, (void **)mbufs, num);

        /* If buffers removed, allocate mbufs and then put them into alloc_q */
        if (ret)
                kni_allocate_mbufs(kni);
        else if (unlikely(kni_fifo_empty(kni->alloc_q))) { //add by Willko, on
alloc_q is empty, try allocate mbuf
                kni_allocate_mbufs(kni);
        }

        return ret;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2019-02-25  3:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-213-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).