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

s390/qeth: simplify L3 dev_id logic

The logic that deals with errors from qeth_l3_get_unique_id() is quite
complex: it sets card->unique_id to 0xfffe, additionally flags it as
UNIQUE_ID_NOT_BY_CARD and later takes this flag as cue to not propagate
card->unique_id to dev->dev_id. With dev->dev_id thus holding 0,
addrconf_ifid_eui48() applies its default behaviour.

Get rid of all the special bit masks, and just return the old uid in
case of an error. For the vast majority of cases this will be 0 (and so
we still get the desired default behaviour) - with the rare exception
where qeth_l3_get_unique_id() might have been called earlier but the
initialization then failed at a later point.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a6e6345
...@@ -178,10 +178,6 @@ struct qeth_vnicc_info { ...@@ -178,10 +178,6 @@ struct qeth_vnicc_info {
#define QETH_RECLAIM_WORK_TIME HZ #define QETH_RECLAIM_WORK_TIME HZ
#define QETH_MAX_PORTNO 15 #define QETH_MAX_PORTNO 15
/*IPv6 address autoconfiguration stuff*/
#define UNIQUE_ID_IF_CREATE_ADDR_FAILED 0xfffe
#define UNIQUE_ID_NOT_BY_CARD 0x10000
/*****************************************************************************/ /*****************************************************************************/
/* QDIO queue and buffer handling */ /* QDIO queue and buffer handling */
/*****************************************************************************/ /*****************************************************************************/
...@@ -687,7 +683,6 @@ struct qeth_card_info { ...@@ -687,7 +683,6 @@ struct qeth_card_info {
enum qeth_card_types type; enum qeth_card_types type;
enum qeth_link_types link_type; enum qeth_link_types link_type;
int broadcast_capable; int broadcast_capable;
int unique_id;
bool layer_enforced; bool layer_enforced;
struct qeth_card_blkt blkt; struct qeth_card_blkt blkt;
__u32 diagass_support; __u32 diagass_support;
......
...@@ -949,39 +949,36 @@ static int qeth_l3_get_unique_id_cb(struct qeth_card *card, ...@@ -949,39 +949,36 @@ static int qeth_l3_get_unique_id_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;
u16 *uid = reply->param;
if (cmd->hdr.return_code == 0) { if (cmd->hdr.return_code == 0) {
card->info.unique_id = cmd->data.create_destroy_addr.uid; *uid = cmd->data.create_destroy_addr.uid;
return 0; return 0;
} }
card->info.unique_id = UNIQUE_ID_IF_CREATE_ADDR_FAILED |
UNIQUE_ID_NOT_BY_CARD;
dev_warn(&card->gdev->dev, "The network adapter failed to generate a unique ID\n"); dev_warn(&card->gdev->dev, "The network adapter failed to generate a unique ID\n");
return -EIO; return -EIO;
} }
static int qeth_l3_get_unique_id(struct qeth_card *card) static u16 qeth_l3_get_unique_id(struct qeth_card *card, u16 uid)
{ {
int rc = 0;
struct qeth_cmd_buffer *iob; struct qeth_cmd_buffer *iob;
QETH_CARD_TEXT(card, 2, "guniqeid"); QETH_CARD_TEXT(card, 2, "guniqeid");
if (!qeth_is_supported(card, IPA_IPV6)) { if (!qeth_is_supported(card, IPA_IPV6))
card->info.unique_id = UNIQUE_ID_IF_CREATE_ADDR_FAILED | goto out;
UNIQUE_ID_NOT_BY_CARD;
return 0;
}
iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6, iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6,
IPA_DATA_SIZEOF(create_destroy_addr)); IPA_DATA_SIZEOF(create_destroy_addr));
if (!iob) if (!iob)
return -ENOMEM; goto out;
__ipa_cmd(iob)->data.create_destroy_addr.uid = card->info.unique_id; __ipa_cmd(iob)->data.create_destroy_addr.uid = uid;
rc = qeth_send_ipa_cmd(card, iob, qeth_l3_get_unique_id_cb, NULL); qeth_send_ipa_cmd(card, iob, qeth_l3_get_unique_id_cb, &uid);
return rc;
out:
return uid;
} }
static int static int
...@@ -1920,6 +1917,7 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = { ...@@ -1920,6 +1917,7 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = {
static int qeth_l3_setup_netdev(struct qeth_card *card) static int qeth_l3_setup_netdev(struct qeth_card *card)
{ {
struct net_device *dev = card->dev;
unsigned int headroom; unsigned int headroom;
int rc; int rc;
...@@ -1937,9 +1935,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) ...@@ -1937,9 +1935,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
card->dev->netdev_ops = &qeth_l3_osa_netdev_ops; card->dev->netdev_ops = &qeth_l3_osa_netdev_ops;
/*IPv6 address autoconfiguration stuff*/ /*IPv6 address autoconfiguration stuff*/
qeth_l3_get_unique_id(card); dev->dev_id = qeth_l3_get_unique_id(card, dev->dev_id);
if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD))
card->dev->dev_id = card->info.unique_id & 0xffff;
if (!IS_VM_NIC(card)) { if (!IS_VM_NIC(card)) {
card->dev->features |= NETIF_F_SG; card->dev->features |= NETIF_F_SG;
......
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