@@ -1414,29 +1414,22 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
1414
1414
ret = NETDEV_TX_OK ;
1415
1415
goto out ;
1416
1416
}
1417
+ if (skb_is_gso (skb ))
1418
+ tx_pool = & adapter -> tso_pool [queue_num ];
1419
+ else
1420
+ tx_pool = & adapter -> tx_pool [queue_num ];
1417
1421
1418
- tx_pool = & adapter -> tx_pool [queue_num ];
1419
1422
tx_scrq = adapter -> tx_scrq [queue_num ];
1420
1423
txq = netdev_get_tx_queue (netdev , skb_get_queue_mapping (skb ));
1421
1424
handle_array = (u64 * )((u8 * )(adapter -> login_rsp_buf ) +
1422
1425
be32_to_cpu (adapter -> login_rsp_buf -> off_txsubm_subcrqs ));
1423
1426
1424
1427
index = tx_pool -> free_map [tx_pool -> consumer_index ];
1425
1428
1426
- if (skb_is_gso (skb )) {
1427
- offset = tx_pool -> tso_index * IBMVNIC_TSO_BUF_SZ ;
1428
- dst = tx_pool -> tso_ltb .buff + offset ;
1429
- memset (dst , 0 , IBMVNIC_TSO_BUF_SZ );
1430
- data_dma_addr = tx_pool -> tso_ltb .addr + offset ;
1431
- tx_pool -> tso_index ++ ;
1432
- if (tx_pool -> tso_index == IBMVNIC_TSO_BUFS )
1433
- tx_pool -> tso_index = 0 ;
1434
- } else {
1435
- offset = index * (adapter -> req_mtu + VLAN_HLEN );
1436
- dst = tx_pool -> long_term_buff .buff + offset ;
1437
- memset (dst , 0 , adapter -> req_mtu + VLAN_HLEN );
1438
- data_dma_addr = tx_pool -> long_term_buff .addr + offset ;
1439
- }
1429
+ offset = index * tx_pool -> buf_size ;
1430
+ dst = tx_pool -> long_term_buff .buff + offset ;
1431
+ memset (dst , 0 , tx_pool -> buf_size );
1432
+ data_dma_addr = tx_pool -> long_term_buff .addr + offset ;
1440
1433
1441
1434
if (skb_shinfo (skb )-> nr_frags ) {
1442
1435
int cur , i ;
@@ -1459,8 +1452,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
1459
1452
}
1460
1453
1461
1454
tx_pool -> consumer_index =
1462
- (tx_pool -> consumer_index + 1 ) %
1463
- adapter -> req_tx_entries_per_subcrq ;
1455
+ (tx_pool -> consumer_index + 1 ) % tx_pool -> num_buffers ;
1464
1456
1465
1457
tx_buff = & tx_pool -> tx_buff [index ];
1466
1458
tx_buff -> skb = skb ;
@@ -1476,11 +1468,13 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
1476
1468
tx_crq .v1 .n_crq_elem = 1 ;
1477
1469
tx_crq .v1 .n_sge = 1 ;
1478
1470
tx_crq .v1 .flags1 = IBMVNIC_TX_COMP_NEEDED ;
1479
- tx_crq . v1 . correlator = cpu_to_be32 ( index );
1471
+
1480
1472
if (skb_is_gso (skb ))
1481
- tx_crq .v1 .dma_reg = cpu_to_be16 (tx_pool -> tso_ltb .map_id );
1473
+ tx_crq .v1 .correlator =
1474
+ cpu_to_be32 (index | IBMVNIC_TSO_POOL_MASK );
1482
1475
else
1483
- tx_crq .v1 .dma_reg = cpu_to_be16 (tx_pool -> long_term_buff .map_id );
1476
+ tx_crq .v1 .correlator = cpu_to_be32 (index );
1477
+ tx_crq .v1 .dma_reg = cpu_to_be16 (tx_pool -> long_term_buff .map_id );
1484
1478
tx_crq .v1 .sge_len = cpu_to_be32 (skb -> len );
1485
1479
tx_crq .v1 .ioba = cpu_to_be64 (data_dma_addr );
1486
1480
@@ -1543,7 +1537,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
1543
1537
1544
1538
if (tx_pool -> consumer_index == 0 )
1545
1539
tx_pool -> consumer_index =
1546
- adapter -> req_tx_entries_per_subcrq - 1 ;
1540
+ tx_pool -> num_buffers - 1 ;
1547
1541
else
1548
1542
tx_pool -> consumer_index -- ;
1549
1543
@@ -2547,6 +2541,7 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
2547
2541
struct ibmvnic_sub_crq_queue * scrq )
2548
2542
{
2549
2543
struct device * dev = & adapter -> vdev -> dev ;
2544
+ struct ibmvnic_tx_pool * tx_pool ;
2550
2545
struct ibmvnic_tx_buff * txbuff ;
2551
2546
union sub_crq * next ;
2552
2547
int index ;
@@ -2566,7 +2561,14 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
2566
2561
continue ;
2567
2562
}
2568
2563
index = be32_to_cpu (next -> tx_comp .correlators [i ]);
2569
- txbuff = & adapter -> tx_pool [pool ].tx_buff [index ];
2564
+ if (index & IBMVNIC_TSO_POOL_MASK ) {
2565
+ tx_pool = & adapter -> tso_pool [pool ];
2566
+ index &= ~IBMVNIC_TSO_POOL_MASK ;
2567
+ } else {
2568
+ tx_pool = & adapter -> tx_pool [pool ];
2569
+ }
2570
+
2571
+ txbuff = & tx_pool -> tx_buff [index ];
2570
2572
2571
2573
for (j = 0 ; j < IBMVNIC_MAX_FRAGS_PER_CRQ ; j ++ ) {
2572
2574
if (!txbuff -> data_dma [j ])
@@ -2589,11 +2591,10 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
2589
2591
2590
2592
num_entries += txbuff -> num_entries ;
2591
2593
2592
- adapter -> tx_pool [pool ].free_map [adapter -> tx_pool [pool ].
2593
- producer_index ] = index ;
2594
- adapter -> tx_pool [pool ].producer_index =
2595
- (adapter -> tx_pool [pool ].producer_index + 1 ) %
2596
- adapter -> req_tx_entries_per_subcrq ;
2594
+ tx_pool -> free_map [tx_pool -> producer_index ] = index ;
2595
+ tx_pool -> producer_index =
2596
+ (tx_pool -> producer_index + 1 ) %
2597
+ tx_pool -> num_buffers ;
2597
2598
}
2598
2599
/* remove tx_comp scrq*/
2599
2600
next -> tx_comp .first = 0 ;
0 commit comments