mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 12:06:52 +07:00
2d2ebb3ed0
commitb4d72c08b3
("qeth: bridgeport support - basic control") broke the support for OSM and OSN devices as follows: As OSM and OSN are L2 only, qeth_core_probe_device() does an early setup by loading the l2 discipline and calling qeth_l2_probe_device(). In this context, adding the l2-specific bridgeport sysfs attributes via qeth_l2_create_device_attributes() hits a BUG_ON in fs/sysfs/group.c, since the basic sysfs infrastructure for the device hasn't been established yet. Note that OSN actually has its own unique sysfs attributes (qeth_osn_devtype), so the additional attributes shouldn't be created at all. For OSM, add a new qeth_l2_devtype that contains all the common and l2-specific sysfs attributes. When qeth_core_probe_device() does early setup for OSM or OSN, assign the corresponding devtype so that the ccwgroup probe code creates the full set of sysfs attributes. This allows us to skip qeth_l2_create_device_attributes() in case of an early setup. Any device that can't do early setup will initially have only the generic sysfs attributes, and when it's probed later qeth_l2_probe_device() adds the l2-specific attributes. If an early-setup device is removed (by calling ccwgroup_ungroup()), device_unregister() will - using the devtype - delete the l2-specific attributes before qeth_l2_remove_device() is called. So make sure to not remove them twice. What complicates the issue is that qeth_l2_probe_device() and qeth_l2_remove_device() is also called on a device when its layer2 attribute changes (ie. its layer mode is switched). For early-setup devices this wouldn't work properly - we wouldn't remove the l2-specific attributes when switching to L3. But switching the layer mode doesn't actually make any sense; we already decided that the device can only operate in L2! So just refuse to switch the layer mode on such devices. Note that OSN doesn't have a layer2 attribute, so we only need to special-case OSM. Based on an initial patch by Ursula Braun. Fixes:b4d72c08b3
("qeth: bridgeport support - basic control") Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
25 lines
535 B
C
25 lines
535 B
C
/*
|
|
* Copyright IBM Corp. 2013
|
|
* Author(s): Eugene Crosser <eugene.crosser@ru.ibm.com>
|
|
*/
|
|
|
|
#ifndef __QETH_L2_H__
|
|
#define __QETH_L2_H__
|
|
|
|
#include "qeth_core.h"
|
|
|
|
extern const struct attribute_group *qeth_l2_attr_groups[];
|
|
|
|
int qeth_l2_create_device_attributes(struct device *);
|
|
void qeth_l2_remove_device_attributes(struct device *);
|
|
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card);
|
|
|
|
struct qeth_mac {
|
|
u8 mac_addr[OSA_ADDR_LEN];
|
|
u8 is_uc:1;
|
|
u8 disp_flag:2;
|
|
struct hlist_node hnode;
|
|
};
|
|
|
|
#endif /* __QETH_L2_H__ */
|