]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
eth: fbnic: Configure RDE settings for pause frame
authorMohsin Bashir <mohsin.bashr@gmail.com>
Thu, 13 Nov 2025 23:26:10 +0000 (15:26 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 18 Nov 2025 00:57:32 +0000 (16:57 -0800)
fbnic supports pause frames. When pause frames are enabled presumably
user expects lossless operation from the NIC. Make sure we configure
RDE (Rx DMA Engine) to DROP_NEVER mode to avoid discards due to delays
in fetching Rx descriptors from the host.

While at it enable DROP_NEVER when NIC only has a single queue
configured. In this case the NIC acts as a FIFO so there's no risk
of head-of-line blocking other queues by making RDE wait. If pause
is disabled this just moves the packet loss from the DMA engine to
the Rx buffer.

Remove redundant call to fbnic_config_drop_mode_rcq(), introduced by
commit 0cb4c0a13723 ("eth: fbnic: Implement Rx queue
alloc/start/stop/free"). This call does not add value as
fbnic_enable_rcq(), which is called immediately afterward, already
handles this.

Although we do not support autoneg at this time, preserve tx_pause in
.mac_link_up instead of fbnic_phylink_get_pauseparam()

Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20251113232610.1151712-1-mohsin.bashr@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h

index b0a87c57910f261f23d24a8c122c85c153e024e4..e6ca23a9957d9f4f2a3206d2d62365d512347682 100644 (file)
@@ -73,6 +73,8 @@ struct fbnic_net {
 
        /* Time stamping filter config */
        struct kernel_hwtstamp_config hwtstamp_config;
+
+       bool tx_pause;
 };
 
 int __fbnic_open(struct fbnic_net *fbn);
index 7ce3fdd252828dfe8518bf4c82d5a8ae815e8e44..62701923cfe96f82d97c8843d0a34261dce46dc3 100644 (file)
@@ -208,6 +208,9 @@ fbnic_phylink_mac_link_up(struct phylink_config *config,
        struct fbnic_net *fbn = netdev_priv(netdev);
        struct fbnic_dev *fbd = fbn->fbd;
 
+       fbn->tx_pause = tx_pause;
+       fbnic_config_drop_mode(fbn, tx_pause);
+
        fbd->mac->link_up(fbd, tx_pause, rx_pause);
 }
 
index 57e18a68f5d2348f650a72175c44d6796ee5cf96..c2d7b67fec286d4e788761e62e459e58fc405cf0 100644 (file)
@@ -2574,11 +2574,15 @@ write_ctl:
 }
 
 static void fbnic_config_drop_mode_rcq(struct fbnic_napi_vector *nv,
-                                      struct fbnic_ring *rcq)
+                                      struct fbnic_ring *rcq, bool tx_pause)
 {
+       struct fbnic_net *fbn = netdev_priv(nv->napi.dev);
        u32 drop_mode, rcq_ctl;
 
-       drop_mode = FBNIC_QUEUE_RDE_CTL0_DROP_IMMEDIATE;
+       if (!tx_pause && fbn->num_rx_queues > 1)
+               drop_mode = FBNIC_QUEUE_RDE_CTL0_DROP_IMMEDIATE;
+       else
+               drop_mode = FBNIC_QUEUE_RDE_CTL0_DROP_NEVER;
 
        /* Specify packet layout */
        rcq_ctl = FIELD_PREP(FBNIC_QUEUE_RDE_CTL0_DROP_MODE_MASK, drop_mode) |
@@ -2588,6 +2592,21 @@ static void fbnic_config_drop_mode_rcq(struct fbnic_napi_vector *nv,
        fbnic_ring_wr32(rcq, FBNIC_QUEUE_RDE_CTL0, rcq_ctl);
 }
 
+void fbnic_config_drop_mode(struct fbnic_net *fbn, bool tx_pause)
+{
+       int i, t;
+
+       for (i = 0; i < fbn->num_napi; i++) {
+               struct fbnic_napi_vector *nv = fbn->napi[i];
+
+               for (t = 0; t < nv->rxt_count; t++) {
+                       struct fbnic_q_triad *qt = &nv->qt[nv->txt_count + t];
+
+                       fbnic_config_drop_mode_rcq(nv, &qt->cmpl, tx_pause);
+               }
+       }
+}
+
 static void fbnic_config_rim_threshold(struct fbnic_ring *rcq, u16 nv_idx, u32 rx_desc)
 {
        u32 threshold;
@@ -2637,7 +2656,7 @@ static void fbnic_enable_rcq(struct fbnic_napi_vector *nv,
        u32 hds_thresh = fbn->hds_thresh;
        u32 rcq_ctl = 0;
 
-       fbnic_config_drop_mode_rcq(nv, rcq);
+       fbnic_config_drop_mode_rcq(nv, rcq, fbn->tx_pause);
 
        /* Force lower bound on MAX_HEADER_BYTES. Below this, all frames should
         * be split at L4. It would also result in the frames being split at
@@ -2700,7 +2719,6 @@ static void __fbnic_nv_enable(struct fbnic_napi_vector *nv)
                                                  &nv->napi);
 
                fbnic_enable_bdq(&qt->sub0, &qt->sub1);
-               fbnic_config_drop_mode_rcq(nv, &qt->cmpl);
                fbnic_enable_rcq(nv, &qt->cmpl);
        }
 }
index ca37da5a0b1797c17459bd04e418e38eb876c5bc..27776e844e29bfcea9bf20a57e30d2b545a2e366 100644 (file)
@@ -184,6 +184,7 @@ void fbnic_reset_netif_queues(struct fbnic_net *fbn);
 irqreturn_t fbnic_msix_clean_rings(int irq, void *data);
 void fbnic_napi_enable(struct fbnic_net *fbn);
 void fbnic_napi_disable(struct fbnic_net *fbn);
+void fbnic_config_drop_mode(struct fbnic_net *fbn, bool tx_pause);
 void fbnic_enable(struct fbnic_net *fbn);
 void fbnic_disable(struct fbnic_net *fbn);
 void fbnic_flush(struct fbnic_net *fbn);