提交 e08d88cc 编写于 作者: F Frank Pavlic 提交者: Jeff Garzik

[PATCH] s390: fix recovery failure of non-guestLAN devices

[patch 5/7] s390: fix recovery failure of non-guestLAN devices

From: Frank Pavlic <fpavlic@de.ibm.com>
	- Recovery of non-guestLAN Layer 2 device failed due to
	  trying to register the real MAC address we got from
	  the READ_MAC adapter parameters command.
	  We have to keep the "old" MAC address when we process
	  the reply of a READ_MAC.
Signed-off-by: NFrank Pavlic <fpavlic@de.ibm.com>

diffstat:
 qeth.h      |   12 ++++++------
 qeth_main.c |   27 ++++++++++++++++-----------
 2 files changed, 22 insertions(+), 17 deletions(-)
Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
上级 d805d7c6
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "qeth_mpc.h" #include "qeth_mpc.h"
#define VERSION_QETH_H "$Revision: 1.151 $" #define VERSION_QETH_H "$Revision: 1.152 $"
#ifdef CONFIG_QETH_IPV6 #ifdef CONFIG_QETH_IPV6
#define QETH_VERSION_IPV6 ":IPv6" #define QETH_VERSION_IPV6 ":IPv6"
...@@ -719,8 +719,6 @@ struct qeth_reply { ...@@ -719,8 +719,6 @@ struct qeth_reply {
atomic_t refcnt; atomic_t refcnt;
}; };
#define QETH_BROADCAST_WITH_ECHO 1
#define QETH_BROADCAST_WITHOUT_ECHO 2
struct qeth_card_blkt { struct qeth_card_blkt {
int time_total; int time_total;
...@@ -728,8 +726,10 @@ struct qeth_card_blkt { ...@@ -728,8 +726,10 @@ struct qeth_card_blkt {
int inter_packet_jumbo; int inter_packet_jumbo;
}; };
#define QETH_BROADCAST_WITH_ECHO 0x01
#define QETH_BROADCAST_WITHOUT_ECHO 0x02
#define QETH_LAYER2_MAC_READ 0x01
#define QETH_LAYER2_MAC_REGISTERED 0x02
struct qeth_card_info { struct qeth_card_info {
unsigned short unit_addr2; unsigned short unit_addr2;
unsigned short cula; unsigned short cula;
...@@ -737,7 +737,7 @@ struct qeth_card_info { ...@@ -737,7 +737,7 @@ struct qeth_card_info {
__u16 func_level; __u16 func_level;
char mcl_level[QETH_MCL_LENGTH + 1]; char mcl_level[QETH_MCL_LENGTH + 1];
int guestlan; int guestlan;
int layer2_mac_registered; int mac_bits;
int portname_required; int portname_required;
int portno; int portno;
char portname[9]; char portname[9];
......
/* /*
* *
* linux/drivers/s390/net/qeth_main.c ($Revision: 1.238 $) * linux/drivers/s390/net/qeth_main.c ($Revision: 1.242 $)
* *
* Linux on zSeries OSA Express and HiperSockets support * Linux on zSeries OSA Express and HiperSockets support
* *
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Frank Pavlic (pavlic@de.ibm.com) and * Frank Pavlic (pavlic@de.ibm.com) and
* Thomas Spatzier <tspat@de.ibm.com> * Thomas Spatzier <tspat@de.ibm.com>
* *
* $Revision: 1.238 $ $Date: 2005/05/04 20:19:18 $ * $Revision: 1.242 $ $Date: 2005/05/04 20:19:18 $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
#include "qeth_eddp.h" #include "qeth_eddp.h"
#include "qeth_tso.h" #include "qeth_tso.h"
#define VERSION_QETH_C "$Revision: 1.238 $" #define VERSION_QETH_C "$Revision: 1.242 $"
static const char *version = "qeth S/390 OSA-Express driver"; static const char *version = "qeth S/390 OSA-Express driver";
/** /**
...@@ -3775,7 +3775,7 @@ qeth_open(struct net_device *dev) ...@@ -3775,7 +3775,7 @@ qeth_open(struct net_device *dev)
if ( (card->info.type != QETH_CARD_TYPE_OSN) && if ( (card->info.type != QETH_CARD_TYPE_OSN) &&
(card->options.layer2) && (card->options.layer2) &&
(!card->info.layer2_mac_registered)) { (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))) {
QETH_DBF_TEXT(trace,4,"nomacadr"); QETH_DBF_TEXT(trace,4,"nomacadr");
return -EPERM; return -EPERM;
} }
...@@ -5894,10 +5894,10 @@ qeth_layer2_send_setmac_cb(struct qeth_card *card, ...@@ -5894,10 +5894,10 @@ qeth_layer2_send_setmac_cb(struct qeth_card *card,
PRINT_WARN("Error in registering MAC address on " \ PRINT_WARN("Error in registering MAC address on " \
"device %s: x%x\n", CARD_BUS_ID(card), "device %s: x%x\n", CARD_BUS_ID(card),
cmd->hdr.return_code); cmd->hdr.return_code);
card->info.layer2_mac_registered = 0; card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
cmd->hdr.return_code = -EIO; cmd->hdr.return_code = -EIO;
} else { } else {
card->info.layer2_mac_registered = 1; card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED;
memcpy(card->dev->dev_addr,cmd->data.setdelmac.mac, memcpy(card->dev->dev_addr,cmd->data.setdelmac.mac,
OSA_ADDR_LEN); OSA_ADDR_LEN);
PRINT_INFO("MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " PRINT_INFO("MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x "
...@@ -5935,7 +5935,7 @@ qeth_layer2_send_delmac_cb(struct qeth_card *card, ...@@ -5935,7 +5935,7 @@ qeth_layer2_send_delmac_cb(struct qeth_card *card,
cmd->hdr.return_code = -EIO; cmd->hdr.return_code = -EIO;
return 0; return 0;
} }
card->info.layer2_mac_registered = 0; card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
return 0; return 0;
} }
...@@ -5943,7 +5943,7 @@ static int ...@@ -5943,7 +5943,7 @@ static int
qeth_layer2_send_delmac(struct qeth_card *card, __u8 *mac) qeth_layer2_send_delmac(struct qeth_card *card, __u8 *mac)
{ {
QETH_DBF_TEXT(trace, 2, "L2Delmac"); QETH_DBF_TEXT(trace, 2, "L2Delmac");
if (!card->info.layer2_mac_registered) if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))
return 0; return 0;
return qeth_layer2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, return qeth_layer2_send_setdelmac(card, mac, IPA_CMD_DELVMAC,
qeth_layer2_send_delmac_cb); qeth_layer2_send_delmac_cb);
...@@ -5965,7 +5965,7 @@ qeth_layer2_set_mac_address(struct net_device *dev, void *p) ...@@ -5965,7 +5965,7 @@ qeth_layer2_set_mac_address(struct net_device *dev, void *p)
card = (struct qeth_card *) dev->priv; card = (struct qeth_card *) dev->priv;
if (!card->options.layer2) { if (!card->options.layer2) {
PRINT_WARN("Setting MAC address on %s is not supported" PRINT_WARN("Setting MAC address on %s is not supported "
"in Layer 3 mode.\n", dev->name); "in Layer 3 mode.\n", dev->name);
QETH_DBF_TEXT(trace, 3, "setmcLY3"); QETH_DBF_TEXT(trace, 3, "setmcLY3");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -6550,8 +6550,13 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, ...@@ -6550,8 +6550,13 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
QETH_DBF_TEXT(trace,4,"chgmaccb"); QETH_DBF_TEXT(trace,4,"chgmaccb");
cmd = (struct qeth_ipa_cmd *) data; cmd = (struct qeth_ipa_cmd *) data;
memcpy(card->dev->dev_addr, if (!card->options.layer2 || card->info.guestlan ||
&cmd->data.setadapterparms.data.change_addr.addr,OSA_ADDR_LEN); !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) {
memcpy(card->dev->dev_addr,
&cmd->data.setadapterparms.data.change_addr.addr,
OSA_ADDR_LEN);
card->info.mac_bits |= QETH_LAYER2_MAC_READ;
}
qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册