<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 11/19/20 3:43 AM, ljp wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1a4e7b1ef1fb101cbb26fb9d5867ee46@linux.vnet.ibm.com">On
      2020-11-18 19:12, Thomas Falcon wrote:
      <br>
      <blockquote type="cite">From: "Dwip N. Banerjee"
        <a class="moz-txt-link-rfc2396E" href="mailto:dnbanerg@us.ibm.com"><dnbanerg@us.ibm.com></a>
        <br>
        <br>
        Reduce the amount of time spent replenishing RX buffers by
        <br>
        only doing so once available buffers has fallen under a certain
        <br>
        threshold, in this case half of the total number of buffers, or
        <br>
        if the polling loop exits before the packets processed is less
        <br>
        than its budget.
        <br>
        <br>
        Signed-off-by: Dwip N. Banerjee <a class="moz-txt-link-rfc2396E" href="mailto:dnbanerg@us.ibm.com"><dnbanerg@us.ibm.com></a>
        <br>
        ---
        <br>
         drivers/net/ethernet/ibm/ibmvnic.c | 5 ++++-
        <br>
         1 file changed, 4 insertions(+), 1 deletion(-)
        <br>
        <br>
        diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
        <br>
        b/drivers/net/ethernet/ibm/ibmvnic.c
        <br>
        index 96df6d8fa277..9fe43ab0496d 100644
        <br>
        --- a/drivers/net/ethernet/ibm/ibmvnic.c
        <br>
        +++ b/drivers/net/ethernet/ibm/ibmvnic.c
        <br>
        @@ -2537,7 +2537,10 @@ static int ibmvnic_poll(struct
        napi_struct
        <br>
        *napi, int budget)
        <br>
                 frames_processed++;
        <br>
             }
        <br>
        <br>
        -    if (adapter->state != VNIC_CLOSING)
        <br>
        +    if (adapter->state != VNIC_CLOSING &&
        <br>
        +       
        ((atomic_read(&adapter->rx_pool[scrq_num].available) <
        <br>
        +          adapter->req_rx_add_entries_per_subcrq / 2) ||
        <br>
        +          frames_processed < budget))
        <br>
      </blockquote>
      <br>
      1/2 seems a simple and good algorithm.
      <br>
      Explaining why "frames_process < budget" is necessary in the
      commit message
      <br>
      or source code also helps.
      <br>
      <br>
    </blockquote>
    <p>Hello, Lijun. The patch author, Dwip Banerjee, suggested the
      modified commit message below:</p>
    <p><font size="2">Reduce the amount of time spent replenishing RX
        buffers by<br>
        only doing so once available buffers has fallen under a certain<br>
        threshold, in this case half of the total number of buffers, or<br>
        if the polling loop exits before the packets processed is less<br>
        than its budget. Non-exhaustion of NAPI budget implies lower<br>
        incoming packet pressure, allowing the leeway to refill the
        buffers<br>
        in preparation for any impending burst.<br>
      </font></p>
    <p>Would such an update require a v3?<br>
    </p>
    <blockquote type="cite"
      cite="mid:1a4e7b1ef1fb101cbb26fb9d5867ee46@linux.vnet.ibm.com">
      <br>
      <blockquote type="cite">         replenish_rx_pool(adapter,
        &adapter->rx_pool[scrq_num]);
        <br>
             if (frames_processed < budget) {
        <br>
                 if (napi_complete_done(napi, frames_processed)) {
        <br>
      </blockquote>
    </blockquote>
  </body>
</html>