Skip to content

Commit d52aec9

Browse files
Eugene Crosserdavem330
authored andcommitted
qeth: enable scatter/gather in layer 2 mode
The patch enables NETIF_F_SG flag for OSA in layer 2 mode. It also adds performance accounting for fragmented sends, adds a conditional skb_linearize() attempt if the skb had too many fragments for QDIO SBAL, and fills netdevice->gso_* attributes. Signed-off-by: Eugene Crosser <[email protected]> Signed-off-by: Ursula Braun <[email protected]> Reviewed-by: Lakhvich Dmitriy <[email protected]> Reviewed-by: Thomas Richter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8bad55f commit d52aec9

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

drivers/s390/net/qeth_l2_main.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
869869
int data_offset = -1;
870870
int elements_needed = 0;
871871
int hd_len = 0;
872+
int nr_frags;
872873

873874
if (card->qdio.do_prio_queueing || (cast_type &&
874875
card->info.is_multicast_different))
@@ -892,6 +893,17 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
892893
}
893894
netif_stop_queue(dev);
894895

896+
/* fix hardware limitation: as long as we do not have sbal
897+
* chaining we can not send long frag lists
898+
*/
899+
if ((card->info.type != QETH_CARD_TYPE_IQD) &&
900+
!qeth_get_elements_no(card, new_skb, 0)) {
901+
if (skb_linearize(new_skb))
902+
goto tx_drop;
903+
if (card->options.performance_stats)
904+
card->perf_stats.tx_lin++;
905+
}
906+
895907
if (card->info.type == QETH_CARD_TYPE_OSN)
896908
hdr = (struct qeth_hdr *)skb->data;
897909
else {
@@ -943,6 +955,14 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
943955
if (!rc) {
944956
card->stats.tx_packets++;
945957
card->stats.tx_bytes += tx_bytes;
958+
if (card->options.performance_stats) {
959+
nr_frags = skb_shinfo(new_skb)->nr_frags;
960+
if (nr_frags) {
961+
card->perf_stats.sg_skbs_sent++;
962+
/* nr_frags + skb->data */
963+
card->perf_stats.sg_frags_sent += nr_frags + 1;
964+
}
965+
}
946966
if (new_skb != skb)
947967
dev_kfree_skb_any(skb);
948968
rc = NETDEV_TX_OK;
@@ -1118,12 +1138,16 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
11181138
&qeth_l2_ethtool_ops : &qeth_l2_osn_ops;
11191139
card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
11201140
if (card->info.type == QETH_CARD_TYPE_OSD && !card->info.guestlan) {
1121-
card->dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
1141+
card->dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
1142+
NETIF_F_SG;
11221143
/* Turn on RX offloading per default */
11231144
card->dev->features |= NETIF_F_RXCSUM;
11241145
}
11251146
card->info.broadcast_capable = 1;
11261147
qeth_l2_request_initial_mac(card);
1148+
card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) *
1149+
PAGE_SIZE;
1150+
card->dev->gso_max_segs = (QETH_MAX_BUFFER_ELEMENTS(card) - 1);
11271151
SET_NETDEV_DEV(card->dev, &card->gdev->dev);
11281152
netif_napi_add(card->dev, &card->napi, qeth_l2_poll, QETH_NAPI_WEIGHT);
11291153
netif_carrier_off(card->dev);

0 commit comments

Comments
 (0)