Skip to content

Commit c5e631a

Browse files
Frank Blaschkadavem330
authored andcommitted
qeth: convert to hw_features part 2
Set rx csum default to hw checksumming again. Remove sysfs interface for rx csum (checksumming) and TSO (large_send). With the new hw_features it does not work to keep the old sysfs interface in parallel. Convert options.checksum_type to new hw_features. Signed-off-by: Frank Blaschka <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 32f5469 commit c5e631a

File tree

7 files changed

+49
-178
lines changed

7 files changed

+49
-178
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ struct qeth_card_options {
639639
struct qeth_ipa_info adp; /*Adapter parameters*/
640640
struct qeth_routing_info route6;
641641
struct qeth_ipa_info ipa6;
642-
enum qeth_checksum_types checksum_type;
643642
int broadcast_mode;
644643
int macaddr_mode;
645644
int fake_broadcast;

drivers/s390/net/qeth_core_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,6 @@ static void qeth_set_intial_options(struct qeth_card *card)
10391039
{
10401040
card->options.route4.type = NO_ROUTER;
10411041
card->options.route6.type = NO_ROUTER;
1042-
card->options.checksum_type = QETH_CHECKSUM_DEFAULT;
10431042
card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS;
10441043
card->options.macaddr_mode = QETH_TR_MACADDR_NONCANONICAL;
10451044
card->options.fake_broadcast = 0;

drivers/s390/net/qeth_core_mpc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@ enum qeth_tr_broadcast_modes {
8080
QETH_TR_BROADCAST_LOCAL = 1,
8181
};
8282

83-
/* these values match CHECKSUM_* in include/linux/skbuff.h */
84-
enum qeth_checksum_types {
85-
SW_CHECKSUMMING = 0, /* TODO: set to bit flag used in IPA Command */
86-
HW_CHECKSUMMING = 1,
87-
NO_CHECKSUMMING = 2,
88-
};
89-
#define QETH_CHECKSUM_DEFAULT SW_CHECKSUMMING
90-
9183
/*
9284
* Routing stuff
9385
*/

drivers/s390/net/qeth_l2_main.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
420420
case QETH_HEADER_TYPE_LAYER2:
421421
skb->pkt_type = PACKET_HOST;
422422
skb->protocol = eth_type_trans(skb, skb->dev);
423-
if (card->options.checksum_type == NO_CHECKSUMMING)
424-
skb->ip_summed = CHECKSUM_UNNECESSARY;
425-
else
426-
skb->ip_summed = CHECKSUM_NONE;
423+
skb->ip_summed = CHECKSUM_NONE;
427424
if (skb->protocol == htons(ETH_P_802_2))
428425
*((__u32 *)skb->cb) = ++card->seqno.pkt_seqno;
429426
len = skb->len;

drivers/s390/net/qeth_l3.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ void qeth_l3_del_vipa(struct qeth_card *, enum qeth_prot_versions, const u8 *);
6262
int qeth_l3_add_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *);
6363
void qeth_l3_del_rxip(struct qeth_card *card, enum qeth_prot_versions,
6464
const u8 *);
65-
int qeth_l3_set_large_send(struct qeth_card *, enum qeth_large_send_types);
66-
int qeth_l3_set_rx_csum(struct qeth_card *, enum qeth_checksum_types);
6765
int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *, struct qeth_ipaddr *);
6866

6967
#endif /* __QETH_L3_H__ */

drivers/s390/net/qeth_l3_main.c

Lines changed: 48 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,34 +1445,30 @@ static int qeth_l3_send_checksum_command(struct qeth_card *card)
14451445
return 0;
14461446
}
14471447

1448-
int qeth_l3_set_rx_csum(struct qeth_card *card,
1449-
enum qeth_checksum_types csum_type)
1448+
int qeth_l3_set_rx_csum(struct qeth_card *card, int on)
14501449
{
14511450
int rc = 0;
14521451

1453-
if (card->options.checksum_type == HW_CHECKSUMMING) {
1454-
if ((csum_type != HW_CHECKSUMMING) &&
1455-
(card->state != CARD_STATE_DOWN)) {
1456-
rc = qeth_l3_send_simple_setassparms(card,
1457-
IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0);
1452+
if (on) {
1453+
if (card->state != CARD_STATE_DOWN) {
1454+
if (!qeth_is_supported(card,
1455+
IPA_INBOUND_CHECKSUM))
1456+
return -EPERM;
1457+
rc = qeth_l3_send_checksum_command(card);
14581458
if (rc)
14591459
return -EIO;
14601460
}
14611461
card->dev->features |= NETIF_F_RXCSUM;
14621462
} else {
1463-
if (csum_type == HW_CHECKSUMMING) {
1464-
if (card->state != CARD_STATE_DOWN) {
1465-
if (!qeth_is_supported(card,
1466-
IPA_INBOUND_CHECKSUM))
1467-
return -EPERM;
1468-
rc = qeth_l3_send_checksum_command(card);
1469-
if (rc)
1470-
return -EIO;
1471-
}
1463+
if (card->state != CARD_STATE_DOWN) {
1464+
rc = qeth_l3_send_simple_setassparms(card,
1465+
IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0);
1466+
if (rc)
1467+
return -EIO;
14721468
}
14731469
card->dev->features &= ~NETIF_F_RXCSUM;
14741470
}
1475-
card->options.checksum_type = csum_type;
1471+
14761472
return rc;
14771473
}
14781474

@@ -1482,32 +1478,34 @@ static int qeth_l3_start_ipa_checksum(struct qeth_card *card)
14821478

14831479
QETH_CARD_TEXT(card, 3, "strtcsum");
14841480

1485-
if (card->options.checksum_type == NO_CHECKSUMMING) {
1486-
dev_info(&card->gdev->dev,
1487-
"Using no checksumming on %s.\n",
1488-
QETH_CARD_IFNAME(card));
1489-
return 0;
1490-
}
1491-
if (card->options.checksum_type == SW_CHECKSUMMING) {
1492-
dev_info(&card->gdev->dev,
1493-
"Using SW checksumming on %s.\n",
1494-
QETH_CARD_IFNAME(card));
1495-
return 0;
1496-
}
1497-
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
1498-
dev_info(&card->gdev->dev,
1481+
if (card->dev->features & NETIF_F_RXCSUM) {
1482+
/* hw may have changed during offline or recovery */
1483+
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
1484+
dev_info(&card->gdev->dev,
14991485
"Inbound HW Checksumming not "
15001486
"supported on %s,\ncontinuing "
15011487
"using Inbound SW Checksumming\n",
15021488
QETH_CARD_IFNAME(card));
1503-
card->options.checksum_type = SW_CHECKSUMMING;
1504-
return 0;
1505-
}
1506-
rc = qeth_l3_send_checksum_command(card);
1507-
if (!rc)
1508-
dev_info(&card->gdev->dev,
1489+
goto update_feature;
1490+
}
1491+
1492+
rc = qeth_l3_send_checksum_command(card);
1493+
if (!rc)
1494+
dev_info(&card->gdev->dev,
15091495
"HW Checksumming (inbound) enabled\n");
1496+
else
1497+
goto update_feature;
1498+
} else
1499+
dev_info(&card->gdev->dev,
1500+
"Using SW checksumming on %s.\n",
1501+
QETH_CARD_IFNAME(card));
1502+
return 0;
15101503

1504+
update_feature:
1505+
rtnl_lock();
1506+
card->dev->features &= ~NETIF_F_RXCSUM;
1507+
netdev_update_features(card->dev);
1508+
rtnl_unlock();
15111509
return rc;
15121510
}
15131511

@@ -2037,14 +2035,7 @@ static inline int qeth_l3_rebuild_skb(struct qeth_card *card,
20372035
is_vlan = 1;
20382036
}
20392037

2040-
switch (card->options.checksum_type) {
2041-
case SW_CHECKSUMMING:
2042-
skb->ip_summed = CHECKSUM_NONE;
2043-
break;
2044-
case NO_CHECKSUMMING:
2045-
skb->ip_summed = CHECKSUM_UNNECESSARY;
2046-
break;
2047-
case HW_CHECKSUMMING:
2038+
if (card->dev->features & NETIF_F_RXCSUM) {
20482039
if ((hdr->hdr.l3.ext_flags &
20492040
(QETH_HDR_EXT_CSUM_HDR_REQ |
20502041
QETH_HDR_EXT_CSUM_TRANSP_REQ)) ==
@@ -2053,7 +2044,8 @@ static inline int qeth_l3_rebuild_skb(struct qeth_card *card,
20532044
skb->ip_summed = CHECKSUM_UNNECESSARY;
20542045
else
20552046
skb->ip_summed = CHECKSUM_NONE;
2056-
}
2047+
} else
2048+
skb->ip_summed = CHECKSUM_NONE;
20572049

20582050
return is_vlan;
20592051
}
@@ -3235,20 +3227,19 @@ static u32 qeth_l3_fix_features(struct net_device *dev, u32 features)
32353227

32363228
static int qeth_l3_set_features(struct net_device *dev, u32 features)
32373229
{
3238-
enum qeth_checksum_types csum_type;
32393230
struct qeth_card *card = dev->ml_priv;
32403231
u32 changed = dev->features ^ features;
3232+
int on;
32413233

32423234
if (!(changed & NETIF_F_RXCSUM))
32433235
return 0;
32443236

32453237
if (features & NETIF_F_RXCSUM)
3246-
csum_type = HW_CHECKSUMMING;
3238+
on = 1;
32473239
else
3248-
csum_type = SW_CHECKSUMMING;
3240+
on = 0;
32493241

3250-
dev->features = features ^ NETIF_F_RXCSUM;
3251-
return qeth_l3_set_rx_csum(card, csum_type);
3242+
return qeth_l3_set_rx_csum(card, on);
32523243
}
32533244

32543245
static const struct ethtool_ops qeth_l3_ethtool_ops = {
@@ -3342,6 +3333,12 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
33423333
if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD))
33433334
card->dev->dev_id = card->info.unique_id &
33443335
0xffff;
3336+
if (!card->info.guestlan) {
3337+
card->dev->hw_features = NETIF_F_SG |
3338+
NETIF_F_RXCSUM | NETIF_F_IP_CSUM |
3339+
NETIF_F_TSO;
3340+
card->dev->features = NETIF_F_RXCSUM;
3341+
}
33453342
}
33463343
} else if (card->info.type == QETH_CARD_TYPE_IQD) {
33473344
card->dev = alloc_netdev(0, "hsi%d", ether_setup);
@@ -3357,8 +3354,6 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
33573354
card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
33583355
card->dev->mtu = card->info.initial_mtu;
33593356
SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops);
3360-
card->dev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
3361-
NETIF_F_IP_CSUM | NETIF_F_TSO;
33623357
card->dev->features |= NETIF_F_HW_VLAN_TX |
33633358
NETIF_F_HW_VLAN_RX |
33643359
NETIF_F_HW_VLAN_FILTER;
@@ -3382,9 +3377,6 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
33823377
card->discipline.output_handler = (qdio_handler_t *)
33833378
qeth_qdio_output_handler;
33843379
card->discipline.recover = qeth_l3_recover;
3385-
if ((card->info.type == QETH_CARD_TYPE_OSD) ||
3386-
(card->info.type == QETH_CARD_TYPE_OSX))
3387-
card->options.checksum_type = HW_CHECKSUMMING;
33883380
return 0;
33893381
}
33903382

drivers/s390/net/qeth_l3_sys.c

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@
1515
#define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \
1616
struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store)
1717

18-
static const char *qeth_l3_get_checksum_str(struct qeth_card *card)
19-
{
20-
if (card->options.checksum_type == SW_CHECKSUMMING)
21-
return "sw";
22-
else if (card->options.checksum_type == HW_CHECKSUMMING)
23-
return "hw";
24-
else
25-
return "no";
26-
}
27-
2818
static ssize_t qeth_l3_dev_route_show(struct qeth_card *card,
2919
struct qeth_routing_info *route, char *buf)
3020
{
@@ -295,51 +285,6 @@ static ssize_t qeth_l3_dev_canonical_macaddr_store(struct device *dev,
295285
static DEVICE_ATTR(canonical_macaddr, 0644, qeth_l3_dev_canonical_macaddr_show,
296286
qeth_l3_dev_canonical_macaddr_store);
297287

298-
static ssize_t qeth_l3_dev_checksum_show(struct device *dev,
299-
struct device_attribute *attr, char *buf)
300-
{
301-
struct qeth_card *card = dev_get_drvdata(dev);
302-
303-
if (!card)
304-
return -EINVAL;
305-
306-
return sprintf(buf, "%s checksumming\n",
307-
qeth_l3_get_checksum_str(card));
308-
}
309-
310-
static ssize_t qeth_l3_dev_checksum_store(struct device *dev,
311-
struct device_attribute *attr, const char *buf, size_t count)
312-
{
313-
struct qeth_card *card = dev_get_drvdata(dev);
314-
enum qeth_checksum_types csum_type;
315-
char *tmp;
316-
int rc = 0;
317-
318-
if (!card)
319-
return -EINVAL;
320-
321-
mutex_lock(&card->conf_mutex);
322-
tmp = strsep((char **) &buf, "\n");
323-
if (!strcmp(tmp, "sw_checksumming"))
324-
csum_type = SW_CHECKSUMMING;
325-
else if (!strcmp(tmp, "hw_checksumming"))
326-
csum_type = HW_CHECKSUMMING;
327-
else if (!strcmp(tmp, "no_checksumming"))
328-
csum_type = NO_CHECKSUMMING;
329-
else {
330-
rc = -EINVAL;
331-
goto out;
332-
}
333-
334-
rc = qeth_l3_set_rx_csum(card, csum_type);
335-
out:
336-
mutex_unlock(&card->conf_mutex);
337-
return rc ? rc : count;
338-
}
339-
340-
static DEVICE_ATTR(checksumming, 0644, qeth_l3_dev_checksum_show,
341-
qeth_l3_dev_checksum_store);
342-
343288
static ssize_t qeth_l3_dev_sniffer_show(struct device *dev,
344289
struct device_attribute *attr, char *buf)
345290
{
@@ -402,64 +347,13 @@ static ssize_t qeth_l3_dev_sniffer_store(struct device *dev,
402347
static DEVICE_ATTR(sniffer, 0644, qeth_l3_dev_sniffer_show,
403348
qeth_l3_dev_sniffer_store);
404349

405-
static ssize_t qeth_l3_dev_large_send_show(struct device *dev,
406-
struct device_attribute *attr, char *buf)
407-
{
408-
struct qeth_card *card = dev_get_drvdata(dev);
409-
410-
if (!card)
411-
return -EINVAL;
412-
413-
if (!(card->dev->features & NETIF_F_TSO))
414-
return sprintf(buf, "%s\n", "no");
415-
else
416-
return sprintf(buf, "%s\n", "TSO");
417-
}
418-
419-
static ssize_t qeth_l3_dev_large_send_store(struct device *dev,
420-
struct device_attribute *attr, const char *buf, size_t count)
421-
{
422-
struct qeth_card *card;
423-
char *tmp;
424-
int enable;
425-
426-
if (!card)
427-
return -EINVAL;
428-
tmp = strsep((char **) &buf, "\n");
429-
if (!strcmp(tmp, "no"))
430-
enable = 0;
431-
else if (!strcmp(tmp, "TSO"))
432-
enable = 1;
433-
else
434-
return -EINVAL;
435-
436-
rtnl_lock();
437-
438-
card = dev_get_drvdata(dev);
439-
440-
if (enable)
441-
card->dev->wanted_features |= NETIF_F_TSO;
442-
else
443-
card->dev->wanted_features &= ~NETIF_F_TSO;
444-
netdev_update_features(card->dev);
445-
446-
rtnl_unlock();
447-
448-
return count;
449-
}
450-
451-
static DEVICE_ATTR(large_send, 0644, qeth_l3_dev_large_send_show,
452-
qeth_l3_dev_large_send_store);
453-
454350
static struct attribute *qeth_l3_device_attrs[] = {
455351
&dev_attr_route4.attr,
456352
&dev_attr_route6.attr,
457353
&dev_attr_fake_broadcast.attr,
458354
&dev_attr_broadcast_mode.attr,
459355
&dev_attr_canonical_macaddr.attr,
460-
&dev_attr_checksumming.attr,
461356
&dev_attr_sniffer.attr,
462-
&dev_attr_large_send.attr,
463357
NULL,
464358
};
465359

0 commit comments

Comments
 (0)