Skip to content

Commit dc319c4

Browse files
committed
Merge branch 's390-net-fixes'
Julian Wiedmann says: ==================== s390/net fixes some qeth fixes for -net, the OSM/OSN one being the most crucial. Please also queue these up for stable. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b601616 + ebccc73 commit dc319c4

File tree

7 files changed

+69
-24
lines changed

7 files changed

+69
-24
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ enum qeth_discipline_id {
701701
};
702702

703703
struct qeth_discipline {
704+
const struct device_type *devtype;
704705
void (*start_poll)(struct ccw_device *, int, unsigned long);
705706
qdio_handler_t *input_handler;
706707
qdio_handler_t *output_handler;
@@ -875,6 +876,9 @@ extern struct qeth_discipline qeth_l2_discipline;
875876
extern struct qeth_discipline qeth_l3_discipline;
876877
extern const struct attribute_group *qeth_generic_attr_groups[];
877878
extern const struct attribute_group *qeth_osn_attr_groups[];
879+
extern const struct attribute_group qeth_device_attr_group;
880+
extern const struct attribute_group qeth_device_blkt_group;
881+
extern const struct device_type qeth_generic_devtype;
878882
extern struct workqueue_struct *qeth_wq;
879883

880884
int qeth_card_hw_is_reachable(struct qeth_card *);

drivers/s390/net/qeth_core_main.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5530,10 +5530,12 @@ void qeth_core_free_discipline(struct qeth_card *card)
55305530
card->discipline = NULL;
55315531
}
55325532

5533-
static const struct device_type qeth_generic_devtype = {
5533+
const struct device_type qeth_generic_devtype = {
55345534
.name = "qeth_generic",
55355535
.groups = qeth_generic_attr_groups,
55365536
};
5537+
EXPORT_SYMBOL_GPL(qeth_generic_devtype);
5538+
55375539
static const struct device_type qeth_osn_devtype = {
55385540
.name = "qeth_osn",
55395541
.groups = qeth_osn_attr_groups,
@@ -5659,23 +5661,22 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
56595661
goto err_card;
56605662
}
56615663

5662-
if (card->info.type == QETH_CARD_TYPE_OSN)
5663-
gdev->dev.type = &qeth_osn_devtype;
5664-
else
5665-
gdev->dev.type = &qeth_generic_devtype;
5666-
56675664
switch (card->info.type) {
56685665
case QETH_CARD_TYPE_OSN:
56695666
case QETH_CARD_TYPE_OSM:
56705667
rc = qeth_core_load_discipline(card, QETH_DISCIPLINE_LAYER2);
56715668
if (rc)
56725669
goto err_card;
5670+
5671+
gdev->dev.type = (card->info.type != QETH_CARD_TYPE_OSN)
5672+
? card->discipline->devtype
5673+
: &qeth_osn_devtype;
56735674
rc = card->discipline->setup(card->gdev);
56745675
if (rc)
56755676
goto err_disc;
5676-
case QETH_CARD_TYPE_OSD:
5677-
case QETH_CARD_TYPE_OSX:
5677+
break;
56785678
default:
5679+
gdev->dev.type = &qeth_generic_devtype;
56795680
break;
56805681
}
56815682

@@ -5731,8 +5732,10 @@ static int qeth_core_set_online(struct ccwgroup_device *gdev)
57315732
if (rc)
57325733
goto err;
57335734
rc = card->discipline->setup(card->gdev);
5734-
if (rc)
5735+
if (rc) {
5736+
qeth_core_free_discipline(card);
57355737
goto err;
5738+
}
57365739
}
57375740
rc = card->discipline->set_online(gdev);
57385741
err:

drivers/s390/net/qeth_core_sys.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,19 +413,25 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
413413

414414
if (card->options.layer2 == newdis)
415415
goto out;
416-
else {
417-
card->info.mac_bits = 0;
418-
if (card->discipline) {
419-
card->discipline->remove(card->gdev);
420-
qeth_core_free_discipline(card);
421-
}
416+
if (card->info.type == QETH_CARD_TYPE_OSM) {
417+
/* fixed layer, can't switch */
418+
rc = -EOPNOTSUPP;
419+
goto out;
420+
}
421+
422+
card->info.mac_bits = 0;
423+
if (card->discipline) {
424+
card->discipline->remove(card->gdev);
425+
qeth_core_free_discipline(card);
422426
}
423427

424428
rc = qeth_core_load_discipline(card, newdis);
425429
if (rc)
426430
goto out;
427431

428432
rc = card->discipline->setup(card->gdev);
433+
if (rc)
434+
qeth_core_free_discipline(card);
429435
out:
430436
mutex_unlock(&card->discipline_mutex);
431437
return rc ? rc : count;
@@ -703,10 +709,11 @@ static struct attribute *qeth_blkt_device_attrs[] = {
703709
&dev_attr_inter_jumbo.attr,
704710
NULL,
705711
};
706-
static struct attribute_group qeth_device_blkt_group = {
712+
const struct attribute_group qeth_device_blkt_group = {
707713
.name = "blkt",
708714
.attrs = qeth_blkt_device_attrs,
709715
};
716+
EXPORT_SYMBOL_GPL(qeth_device_blkt_group);
710717

711718
static struct attribute *qeth_device_attrs[] = {
712719
&dev_attr_state.attr,
@@ -726,9 +733,10 @@ static struct attribute *qeth_device_attrs[] = {
726733
&dev_attr_switch_attrs.attr,
727734
NULL,
728735
};
729-
static struct attribute_group qeth_device_attr_group = {
736+
const struct attribute_group qeth_device_attr_group = {
730737
.attrs = qeth_device_attrs,
731738
};
739+
EXPORT_SYMBOL_GPL(qeth_device_attr_group);
732740

733741
const struct attribute_group *qeth_generic_attr_groups[] = {
734742
&qeth_device_attr_group,

drivers/s390/net/qeth_l2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include "qeth_core.h"
1010

11+
extern const struct attribute_group *qeth_l2_attr_groups[];
12+
1113
int qeth_l2_create_device_attributes(struct device *);
1214
void qeth_l2_remove_device_attributes(struct device *);
1315
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card);

drivers/s390/net/qeth_l2_main.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,21 @@ static int qeth_l2_stop(struct net_device *dev)
880880
return 0;
881881
}
882882

883+
static const struct device_type qeth_l2_devtype = {
884+
.name = "qeth_layer2",
885+
.groups = qeth_l2_attr_groups,
886+
};
887+
883888
static int qeth_l2_probe_device(struct ccwgroup_device *gdev)
884889
{
885890
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
891+
int rc;
886892

887-
qeth_l2_create_device_attributes(&gdev->dev);
893+
if (gdev->dev.type == &qeth_generic_devtype) {
894+
rc = qeth_l2_create_device_attributes(&gdev->dev);
895+
if (rc)
896+
return rc;
897+
}
888898
INIT_LIST_HEAD(&card->vid_list);
889899
hash_init(card->mac_htable);
890900
card->options.layer2 = 1;
@@ -896,7 +906,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev)
896906
{
897907
struct qeth_card *card = dev_get_drvdata(&cgdev->dev);
898908

899-
qeth_l2_remove_device_attributes(&cgdev->dev);
909+
if (cgdev->dev.type == &qeth_generic_devtype)
910+
qeth_l2_remove_device_attributes(&cgdev->dev);
900911
qeth_set_allowed_threads(card, 0, 1);
901912
wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);
902913

@@ -954,7 +965,6 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
954965
case QETH_CARD_TYPE_OSN:
955966
card->dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN,
956967
ether_setup);
957-
card->dev->flags |= IFF_NOARP;
958968
break;
959969
default:
960970
card->dev = alloc_etherdev(0);
@@ -969,9 +979,12 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
969979
card->dev->min_mtu = 64;
970980
card->dev->max_mtu = ETH_MAX_MTU;
971981
card->dev->netdev_ops = &qeth_l2_netdev_ops;
972-
card->dev->ethtool_ops =
973-
(card->info.type != QETH_CARD_TYPE_OSN) ?
974-
&qeth_l2_ethtool_ops : &qeth_l2_osn_ops;
982+
if (card->info.type == QETH_CARD_TYPE_OSN) {
983+
card->dev->ethtool_ops = &qeth_l2_osn_ops;
984+
card->dev->flags |= IFF_NOARP;
985+
} else {
986+
card->dev->ethtool_ops = &qeth_l2_ethtool_ops;
987+
}
975988
card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
976989
if (card->info.type == QETH_CARD_TYPE_OSD && !card->info.guestlan) {
977990
card->dev->hw_features = NETIF_F_SG;
@@ -1269,6 +1282,7 @@ static int qeth_l2_control_event(struct qeth_card *card,
12691282
}
12701283

12711284
struct qeth_discipline qeth_l2_discipline = {
1285+
.devtype = &qeth_l2_devtype,
12721286
.start_poll = qeth_qdio_start_poll,
12731287
.input_handler = (qdio_handler_t *) qeth_qdio_input_handler,
12741288
.output_handler = (qdio_handler_t *) qeth_qdio_output_handler,

drivers/s390/net/qeth_l2_sys.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,11 @@ void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
269269
} else
270270
qeth_bridgeport_an_set(card, 0);
271271
}
272+
273+
const struct attribute_group *qeth_l2_attr_groups[] = {
274+
&qeth_device_attr_group,
275+
&qeth_device_blkt_group,
276+
/* l2 specific, see l2_{create,remove}_device_attributes(): */
277+
&qeth_l2_bridgeport_attr_group,
278+
NULL,
279+
};

drivers/s390/net/qeth_l3_main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3039,8 +3039,13 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
30393039
static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
30403040
{
30413041
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
3042+
int rc;
30423043

3043-
qeth_l3_create_device_attributes(&gdev->dev);
3044+
rc = qeth_l3_create_device_attributes(&gdev->dev);
3045+
if (rc)
3046+
return rc;
3047+
hash_init(card->ip_htable);
3048+
hash_init(card->ip_mc_htable);
30443049
card->options.layer2 = 0;
30453050
card->info.hwtrap = 0;
30463051
return 0;
@@ -3306,6 +3311,7 @@ static int qeth_l3_control_event(struct qeth_card *card,
33063311
}
33073312

33083313
struct qeth_discipline qeth_l3_discipline = {
3314+
.devtype = &qeth_generic_devtype,
33093315
.start_poll = qeth_qdio_start_poll,
33103316
.input_handler = (qdio_handler_t *) qeth_qdio_input_handler,
33113317
.output_handler = (qdio_handler_t *) qeth_qdio_output_handler,

0 commit comments

Comments
 (0)