]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
qede: Honor user request for Tx buffers
authorSudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Sun, 21 May 2017 09:10:53 +0000 (12:10 +0300)
committerChuck Anderson <chuck.anderson@oracle.com>
Tue, 19 Sep 2017 05:32:08 +0000 (22:32 -0700)
Orabug: 26783820

Driver always allocates the maximal number of tx-buffers irrespective of
actual Tx ring config.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ Upstream commit 5a052d62ab01cc95446f47cb1f41c3bd99546051 ]
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
drivers/net/ethernet/qlogic/qede/qede_fp.c
drivers/net/ethernet/qlogic/qede/qede_main.c

index aa36c370f634bea42c5e35ed47951e1454f472ca..04bd267948330a49ce20cf6f2c22c9f9ab862295 100644 (file)
@@ -1207,7 +1207,7 @@ static int qede_selftest_transmit_traffic(struct qede_dev *edev,
        }
 
        /* Fill the entry in the SW ring and the BDs in the FW ring */
-       idx = txq->sw_tx_prod & NUM_TX_BDS_MAX;
+       idx = txq->sw_tx_prod;
        txq->sw_tx_ring[idx].skb = skb;
        first_bd = qed_chain_produce(&txq->tx_pbl);
        memset(first_bd, 0, sizeof(*first_bd));
@@ -1227,7 +1227,7 @@ static int qede_selftest_transmit_traffic(struct qede_dev *edev,
 
        /* update the first BD with the actual num BDs */
        first_bd->data.nbds = 1;
-       txq->sw_tx_prod++;
+       txq->sw_tx_prod = (txq->sw_tx_prod + 1) % txq->num_tx_buffers;
        /* 'next page' entries are counted in the producer value */
        val = cpu_to_le16(qed_chain_get_prod_idx(&txq->tx_pbl));
        txq->tx_db.data.bd_prod = val;
@@ -1261,7 +1261,7 @@ static int qede_selftest_transmit_traffic(struct qede_dev *edev,
        first_bd = (struct eth_tx_1st_bd *)qed_chain_consume(&txq->tx_pbl);
        dma_unmap_single(&edev->pdev->dev, BD_UNMAP_ADDR(first_bd),
                         BD_UNMAP_LEN(first_bd), DMA_TO_DEVICE);
-       txq->sw_tx_cons++;
+       txq->sw_tx_cons = (txq->sw_tx_cons + 1) % txq->num_tx_buffers;
        txq->sw_tx_ring[idx].skb = NULL;
 
        return 0;
index bd5c86de8358bcf61d179b2dbd47dcfe411599ff..a3cc836785b4d60dd5becf8d2f7ed8d27178ea96 100644 (file)
@@ -98,7 +98,7 @@ int qede_alloc_rx_buffer(struct qede_rx_queue *rxq, bool allow_lazy)
 /* Unmap the data and free skb */
 int qede_free_tx_pkt(struct qede_dev *edev, struct qede_tx_queue *txq, int *len)
 {
-       u16 idx = txq->sw_tx_cons & NUM_TX_BDS_MAX;
+       u16 idx = txq->sw_tx_cons;
        struct sk_buff *skb = txq->sw_tx_ring[idx].skb;
        struct eth_tx_1st_bd *first_bd;
        struct eth_tx_bd *tx_data_bd;
@@ -155,7 +155,7 @@ static void qede_free_failed_tx_pkt(struct qede_tx_queue *txq,
                                    struct eth_tx_1st_bd *first_bd,
                                    int nbd, bool data_split)
 {
-       u16 idx = txq->sw_tx_prod & NUM_TX_BDS_MAX;
+       u16 idx = txq->sw_tx_prod;
        struct sk_buff *skb = txq->sw_tx_ring[idx].skb;
        struct eth_tx_bd *tx_data_bd;
        int i, split_bd_len = 0;
@@ -366,7 +366,7 @@ static int qede_tx_int(struct qede_dev *edev, struct qede_tx_queue *txq)
 
                bytes_compl += len;
                pkts_compl++;
-               txq->sw_tx_cons++;
+               txq->sw_tx_cons = (txq->sw_tx_cons + 1) % txq->num_tx_buffers;
                txq->xmit_pkts++;
        }
 
@@ -1301,7 +1301,7 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 #endif
 
        /* Fill the entry in the SW ring and the BDs in the FW ring */
-       idx = txq->sw_tx_prod & NUM_TX_BDS_MAX;
+       idx = txq->sw_tx_prod;
        txq->sw_tx_ring[idx].skb = skb;
        first_bd = (struct eth_tx_1st_bd *)
                   qed_chain_produce(&txq->tx_pbl);
@@ -1485,7 +1485,7 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        /* Advance packet producer only before sending the packet since mapping
         * of pages may fail.
         */
-       txq->sw_tx_prod++;
+       txq->sw_tx_prod = (txq->sw_tx_prod + 1) % txq->num_tx_buffers;
 
        /* 'next page' entries are counted in the producer value */
        txq->tx_db.data.bd_prod =
index e59d854673eadadcc3925bdfc803d180129411ee..8463afa92ab6322ad9974bf3b0b8955c2ced7ea1 100644 (file)
@@ -1351,7 +1351,7 @@ static int qede_alloc_mem_txq(struct qede_dev *edev, struct qede_tx_queue *txq)
                                            QED_CHAIN_USE_TO_CONSUME_PRODUCE,
                                            QED_CHAIN_MODE_PBL,
                                            QED_CHAIN_CNT_TYPE_U16,
-                                           TX_RING_SIZE,
+                                           txq->num_tx_buffers,
                                            sizeof(*p_virt), &txq->tx_pbl);
        if (rc)
                goto err;