Commit b144b99f authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: utilize virtual MAC for Layer2 OSD devices

By default, READ MAC on a Layer2 OSD device returns the adapter's
burnt-in MAC address. Given the default scenario of many virtual devices
on the same adapter, qeth can't make any use of this address and
therefore skips the READ MAC call for this device type.

But in some configurations, the READ MAC command for a Layer2 OSD device
actually returns a pre-provisioned, virtual MAC address. So enable the
READ MAC code to detect this situation, and let the L2 subdriver
call READ MAC for OSD devices.

This also removes the QETH_LAYER2_MAC_READ flag, which protects L2
devices against calling READ MAC multiple times. Instead protect the
whole call to qeth_l2_request_initial_mac().
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04087d9a
...@@ -665,7 +665,6 @@ struct qeth_card_blkt { ...@@ -665,7 +665,6 @@ struct qeth_card_blkt {
#define QETH_BROADCAST_WITH_ECHO 0x01 #define QETH_BROADCAST_WITH_ECHO 0x01
#define QETH_BROADCAST_WITHOUT_ECHO 0x02 #define QETH_BROADCAST_WITHOUT_ECHO 0x02
#define QETH_LAYER2_MAC_READ 0x01
#define QETH_LAYER2_MAC_REGISTERED 0x02 #define QETH_LAYER2_MAC_REGISTERED 0x02
struct qeth_card_info { struct qeth_card_info {
unsigned short unit_addr2; unsigned short unit_addr2;
......
...@@ -4235,16 +4235,18 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, ...@@ -4235,16 +4235,18 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
struct qeth_reply *reply, unsigned long data) struct qeth_reply *reply, unsigned long data)
{ {
struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
struct qeth_ipacmd_setadpparms *adp_cmd;
QETH_CARD_TEXT(card, 4, "chgmaccb"); QETH_CARD_TEXT(card, 4, "chgmaccb");
if (qeth_setadpparms_inspect_rc(cmd)) if (qeth_setadpparms_inspect_rc(cmd))
return 0; return 0;
if (IS_LAYER3(card) || !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { adp_cmd = &cmd->data.setadapterparms;
ether_addr_copy(card->dev->dev_addr, if (IS_LAYER2(card) && IS_OSD(card) && !IS_VM_NIC(card) &&
cmd->data.setadapterparms.data.change_addr.addr); !(adp_cmd->hdr.flags & QETH_SETADP_FLAGS_VIRTUAL_MAC))
card->info.mac_bits |= QETH_LAYER2_MAC_READ; return 0;
}
ether_addr_copy(card->dev->dev_addr, adp_cmd->data.change_addr.addr);
return 0; return 0;
} }
......
...@@ -80,7 +80,9 @@ enum qeth_card_types { ...@@ -80,7 +80,9 @@ enum qeth_card_types {
}; };
#define IS_IQD(card) ((card)->info.type == QETH_CARD_TYPE_IQD) #define IS_IQD(card) ((card)->info.type == QETH_CARD_TYPE_IQD)
#define IS_OSD(card) ((card)->info.type == QETH_CARD_TYPE_OSD)
#define IS_OSN(card) ((card)->info.type == QETH_CARD_TYPE_OSN) #define IS_OSN(card) ((card)->info.type == QETH_CARD_TYPE_OSN)
#define IS_VM_NIC(card) ((card)->info.guestlan)
#define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
/* only the first two bytes are looked at in qeth_get_cardname_short */ /* only the first two bytes are looked at in qeth_get_cardname_short */
...@@ -529,17 +531,20 @@ struct qeth_query_switch_attributes { ...@@ -529,17 +531,20 @@ struct qeth_query_switch_attributes {
__u8 reserved3[8]; __u8 reserved3[8];
}; };
#define QETH_SETADP_FLAGS_VIRTUAL_MAC 0x80 /* for CHANGE_ADDR_READ_MAC */
struct qeth_ipacmd_setadpparms_hdr { struct qeth_ipacmd_setadpparms_hdr {
__u32 supp_hw_cmds; u32 supp_hw_cmds;
__u32 reserved1; u32 reserved1;
__u16 cmdlength; u16 cmdlength;
__u16 reserved2; u16 reserved2;
__u32 command_code; u32 command_code;
__u16 return_code; u16 return_code;
__u8 used_total; u8 used_total;
__u8 seq_no; u8 seq_no;
__u32 reserved3; u8 flags;
} __attribute__ ((packed)); u8 reserved3[3];
};
struct qeth_ipacmd_setadpparms { struct qeth_ipacmd_setadpparms {
struct qeth_ipacmd_setadpparms_hdr hdr; struct qeth_ipacmd_setadpparms_hdr hdr;
......
...@@ -461,12 +461,9 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) ...@@ -461,12 +461,9 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
/* fall back to alternative mechanism: */ /* fall back to alternative mechanism: */
} }
if (card->info.type == QETH_CARD_TYPE_IQD || if (!IS_OSN(card)) {
card->info.type == QETH_CARD_TYPE_OSM ||
card->info.type == QETH_CARD_TYPE_OSX ||
card->info.guestlan) {
rc = qeth_setadpparms_change_macaddr(card); rc = qeth_setadpparms_change_macaddr(card);
if (!rc) if (!rc && is_valid_ether_addr(card->dev->dev_addr))
goto out; goto out;
QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device %x: %#x\n", QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device %x: %#x\n",
CARD_DEVID(card), rc); CARD_DEVID(card), rc);
...@@ -917,7 +914,8 @@ static int qeth_l2_setup_netdev(struct qeth_card *card, bool carrier_ok) ...@@ -917,7 +914,8 @@ static int qeth_l2_setup_netdev(struct qeth_card *card, bool carrier_ok)
PAGE_SIZE * (QDIO_MAX_ELEMENTS_PER_BUFFER - 1)); PAGE_SIZE * (QDIO_MAX_ELEMENTS_PER_BUFFER - 1));
} }
qeth_l2_request_initial_mac(card); if (!is_valid_ether_addr(card->dev->dev_addr))
qeth_l2_request_initial_mac(card);
netif_napi_add(card->dev, &card->napi, qeth_poll, QETH_NAPI_WEIGHT); netif_napi_add(card->dev, &card->napi, qeth_poll, QETH_NAPI_WEIGHT);
rc = register_netdev(card->dev); rc = register_netdev(card->dev);
if (!rc && carrier_ok) if (!rc && carrier_ok)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment