forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
....@@ -756,7 +756,7 @@
756756 * Allocate the hardware ring and PCI DMA bus address space for said.
757757 */
758758 size_t hwlen = nelem * hwsize + stat_size;
759
- void *hwring = dma_zalloc_coherent(dev, hwlen, busaddrp, GFP_KERNEL);
759
+ void *hwring = dma_alloc_coherent(dev, hwlen, busaddrp, GFP_KERNEL);
760760
761761 if (!hwring)
762762 return NULL;
....@@ -1154,7 +1154,7 @@
11541154 *
11551155 * Add a packet to an SGE Ethernet TX queue. Runs with softirqs disabled.
11561156 */
1157
-int t4vf_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1157
+netdev_tx_t t4vf_eth_xmit(struct sk_buff *skb, struct net_device *dev)
11581158 {
11591159 u32 wr_mid;
11601160 u64 cntrl, *end;
....@@ -1692,7 +1692,7 @@
16921692 * restore_rx_bufs - put back a packet's RX buffers
16931693 * @gl: the packet gather list
16941694 * @fl: the SGE Free List
1695
- * @nfrags: how many fragments in @si
1695
+ * @frags: how many fragments in @si
16961696 *
16971697 * Called when we find out that the current packet, @si, can't be
16981698 * processed right away for some reason. This is a very rare event and
....@@ -2044,8 +2044,9 @@
20442044 */
20452045 irq_handler_t t4vf_intr_handler(struct adapter *adapter)
20462046 {
2047
- BUG_ON((adapter->flags & (USING_MSIX|USING_MSI)) == 0);
2048
- if (adapter->flags & USING_MSIX)
2047
+ BUG_ON((adapter->flags &
2048
+ (CXGB4VF_USING_MSIX | CXGB4VF_USING_MSI)) == 0);
2049
+ if (adapter->flags & CXGB4VF_USING_MSIX)
20492050 return t4vf_sge_intr_msix;
20502051 else
20512052 return t4vf_intr_msi;
....@@ -2053,7 +2054,7 @@
20532054
20542055 /**
20552056 * sge_rx_timer_cb - perform periodic maintenance of SGE RX queues
2056
- * @data: the adapter
2057
+ * @t: Rx timer
20572058 *
20582059 * Runs periodically from a timer to perform maintenance of SGE RX queues.
20592060 *
....@@ -2112,7 +2113,7 @@
21122113
21132114 /**
21142115 * sge_tx_timer_cb - perform periodic maintenance of SGE Tx queues
2115
- * @data: the adapter
2116
+ * @t: Tx timer
21162117 *
21172118 * Runs periodically from a timer to perform maintenance of SGE TX queues.
21182119 *
....@@ -2209,7 +2210,7 @@
22092210 struct port_info *pi = netdev_priv(dev);
22102211 struct fw_iq_cmd cmd, rpl;
22112212 int ret, iqandst, flsz = 0;
2212
- int relaxed = !(adapter->flags & ROOT_NO_RELAXED_ORDERING);
2213
+ int relaxed = !(adapter->flags & CXGB4VF_ROOT_NO_RELAXED_ORDERING);
22132214
22142215 /*
22152216 * If we're using MSI interrupts and we're not initializing the
....@@ -2218,7 +2219,8 @@
22182219 * the Forwarded Interrupt Queue must be set up before any other
22192220 * ingress queue ...
22202221 */
2221
- if ((adapter->flags & USING_MSI) && rspq != &adapter->sge.intrq) {
2222
+ if ((adapter->flags & CXGB4VF_USING_MSI) &&
2223
+ rspq != &adapter->sge.intrq) {
22222224 iqandst = SGE_INTRDST_IQ;
22232225 intr_dest = adapter->sge.intrq.abs_id;
22242226 } else
....@@ -2268,7 +2270,7 @@
22682270 cmd.iqaddr = cpu_to_be64(rspq->phys_addr);
22692271
22702272 if (fl) {
2271
- enum chip_type chip =
2273
+ unsigned int chip_ver =
22722274 CHELSIO_CHIP_VERSION(adapter->params.chip);
22732275 /*
22742276 * Allocate the ring for the hardware free list (with space
....@@ -2319,10 +2321,10 @@
23192321 */
23202322 cmd.fl0dcaen_to_fl0cidxfthresh =
23212323 cpu_to_be16(
2322
- FW_IQ_CMD_FL0FBMIN_V(chip <= CHELSIO_T5 ?
2323
- FETCHBURSTMIN_128B_X :
2324
- FETCHBURSTMIN_64B_X) |
2325
- FW_IQ_CMD_FL0FBMAX_V((chip <= CHELSIO_T5) ?
2324
+ FW_IQ_CMD_FL0FBMIN_V(chip_ver <= CHELSIO_T5
2325
+ ? FETCHBURSTMIN_128B_X
2326
+ : FETCHBURSTMIN_64B_T6_X) |
2327
+ FW_IQ_CMD_FL0FBMAX_V((chip_ver <= CHELSIO_T5) ?
23262328 FETCHBURSTMAX_512B_X :
23272329 FETCHBURSTMAX_256B_X));
23282330 cmd.fl0size = cpu_to_be16(flsz);
....@@ -2403,6 +2405,7 @@
24032405 * t4vf_sge_alloc_eth_txq - allocate an SGE Ethernet TX Queue
24042406 * @adapter: the adapter
24052407 * @txq: pointer to the new txq to be filled in
2408
+ * @dev: the network device
24062409 * @devq: the network TX queue associated with the new txq
24072410 * @iqid: the relative ingress queue ID to which events relating to
24082411 * the new txq should be directed
....@@ -2411,10 +2414,11 @@
24112414 struct net_device *dev, struct netdev_queue *devq,
24122415 unsigned int iqid)
24132416 {
2417
+ unsigned int chip_ver = CHELSIO_CHIP_VERSION(adapter->params.chip);
2418
+ struct port_info *pi = netdev_priv(dev);
2419
+ struct fw_eq_eth_cmd cmd, rpl;
24142420 struct sge *s = &adapter->sge;
24152421 int ret, nentries;
2416
- struct fw_eq_eth_cmd cmd, rpl;
2417
- struct port_info *pi = netdev_priv(dev);
24182422
24192423 /*
24202424 * Calculate the size of the hardware TX Queue (including the Status
....@@ -2448,17 +2452,19 @@
24482452 cmd.alloc_to_len16 = cpu_to_be32(FW_EQ_ETH_CMD_ALLOC_F |
24492453 FW_EQ_ETH_CMD_EQSTART_F |
24502454 FW_LEN16(cmd));
2451
- cmd.viid_pkd = cpu_to_be32(FW_EQ_ETH_CMD_AUTOEQUEQE_F |
2452
- FW_EQ_ETH_CMD_VIID_V(pi->viid));
2455
+ cmd.autoequiqe_to_viid = cpu_to_be32(FW_EQ_ETH_CMD_AUTOEQUEQE_F |
2456
+ FW_EQ_ETH_CMD_VIID_V(pi->viid));
24532457 cmd.fetchszm_to_iqid =
24542458 cpu_to_be32(FW_EQ_ETH_CMD_HOSTFCMODE_V(SGE_HOSTFCMODE_STPG) |
24552459 FW_EQ_ETH_CMD_PCIECHN_V(pi->port_id) |
24562460 FW_EQ_ETH_CMD_IQID_V(iqid));
24572461 cmd.dcaen_to_eqsize =
2458
- cpu_to_be32(FW_EQ_ETH_CMD_FBMIN_V(SGE_FETCHBURSTMIN_64B) |
2459
- FW_EQ_ETH_CMD_FBMAX_V(SGE_FETCHBURSTMAX_512B) |
2462
+ cpu_to_be32(FW_EQ_ETH_CMD_FBMIN_V(chip_ver <= CHELSIO_T5
2463
+ ? FETCHBURSTMIN_64B_X
2464
+ : FETCHBURSTMIN_64B_T6_X) |
2465
+ FW_EQ_ETH_CMD_FBMAX_V(FETCHBURSTMAX_512B_X) |
24602466 FW_EQ_ETH_CMD_CIDXFTHRESH_V(
2461
- SGE_CIDXFLUSHTHRESH_32) |
2467
+ CIDXFLUSHTHRESH_32_X) |
24622468 FW_EQ_ETH_CMD_EQSIZE_V(nentries));
24632469 cmd.eqaddr = cpu_to_be64(txq->q.phys_addr);
24642470