<html>
    <head>
      <base href="https://bugs.dpdk.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Packet segments do not get freed in mprq_buf_to_pkt() upon encountering MLX5_RXQ_CODE_NOMBUF"
   href="https://bugs.dpdk.org/show_bug.cgi?id=1779">1779</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Packet segments do not get freed in mprq_buf_to_pkt() upon encountering MLX5_RXQ_CODE_NOMBUF
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DPDK
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>22.11
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ethdev
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dev@dpdk.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>canary.overflow@gmail.com
          </td>
        </tr>

        <tr>
          <th>Target Milestone</th>
          <td>---
          </td>
        </tr></table>
      <p>
        <div class="bz_comment_block">
          <pre class="bz_comment_text">drivers/net/mlx5/mlx5_rx.h mprq_buf_to_pkt(...):

There are 2 issues: 

- uint32_t seg_len = RTE_MIN(len, (uint32_t)(pkt->buf_len -
RTE_PKTMBUF_HEADROOM)) seems unnecessary as to hit this code, len has to be
greater than (uint32_t)(pkt->buf_len - RTE_PKTMBUF_HEADROOM) due to the if
condition

- If the allocation struct rte_mbuf *next = rte_pktmbuf_alloc(rxq->mp) fails
and packet has more than 2 segs, the segs that were allocated previously do not
get freed 

    mprq_buf_to_pkt(...) {
        ...        
        } else if (rxq->strd_scatter_en) {
            struct rte_mbuf *prev = pkt;
            uint32_t seg_len = RTE_MIN(len, (uint32_t)
            (pkt->buf_len - RTE_PKTMBUF_HEADROOM));
            uint32_t rem_len = len - seg_len;

            rte_memcpy(rte_pktmbuf_mtod(pkt, void *), addr, seg_len);
            DATA_LEN(pkt) = seg_len;
            while (rem_len) {
                struct rte_mbuf *next = rte_pktmbuf_alloc(rxq->mp);

                if (unlikely(next == NULL))
                    return MLX5_RXQ_CODE_NOMBUF;
                ...
            }
            ...
        }
        ...
    }

Should rte_pktmbuf_free() be used instead?
          </pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
      <div itemscope itemtype="http://schema.org/EmailMessage">
        <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
          
          <link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1779">
          <meta itemprop="name" content="View bug">
        </div>
        <meta itemprop="description" content="Bugzilla bug update notification">
      </div>
    </body>
</html>