Commit e0a8114c authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller

qeth: meaningful return code for set_mac_address

Setting an invalid mac-address for a qeth layer2 device returns
with a strange error code:
# ip link set hsi1 address 00:00:00:00:00:01
   RTNETLINK answers: Unknown error 18446744073709486085
Problem is caused by wrong usage of the return_code field within
structure qeth_ipa_cmd.
With this patch the ip command above returns
   SIOCSIFHWADDR: Invalid argument
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 205a8b64
...@@ -2945,8 +2945,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card, ...@@ -2945,8 +2945,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
} }
QETH_DBF_TEXT(SETUP, 2, "suppenbl"); QETH_DBF_TEXT(SETUP, 2, "suppenbl");
QETH_DBF_TEXT_(SETUP, 2, "%x", cmd->hdr.ipa_supported); QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_supported);
QETH_DBF_TEXT_(SETUP, 2, "%x", cmd->hdr.ipa_enabled); QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_enabled);
return 0; return 0;
} }
...@@ -4322,7 +4322,7 @@ static int qeth_snmp_command_cb(struct qeth_card *card, ...@@ -4322,7 +4322,7 @@ static int qeth_snmp_command_cb(struct qeth_card *card,
/* check if there is enough room in userspace */ /* check if there is enough room in userspace */
if ((qinfo->udata_len - qinfo->udata_offset) < data_len) { if ((qinfo->udata_len - qinfo->udata_offset) < data_len) {
QETH_CARD_TEXT_(card, 4, "scer3%i", -ENOMEM); QETH_CARD_TEXT_(card, 4, "scer3%i", -ENOMEM);
cmd->hdr.return_code = -ENOMEM; cmd->hdr.return_code = IPA_RC_ENOMEM;
return 0; return 0;
} }
QETH_CARD_TEXT_(card, 4, "snore%i", QETH_CARD_TEXT_(card, 4, "snore%i",
......
...@@ -207,6 +207,7 @@ static struct ipa_rc_msg qeth_ipa_rc_msg[] = { ...@@ -207,6 +207,7 @@ static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
{IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"}, {IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"},
{IPA_RC_LAN_OFFLINE, "STRTLAN_LAN_DISABLED - LAN offline"}, {IPA_RC_LAN_OFFLINE, "STRTLAN_LAN_DISABLED - LAN offline"},
{IPA_RC_INVALID_IP_VERSION2, "Invalid IP version"}, {IPA_RC_INVALID_IP_VERSION2, "Invalid IP version"},
{IPA_RC_ENOMEM, "Memory problem"},
{IPA_RC_FFFF, "Unknown Error"} {IPA_RC_FFFF, "Unknown Error"}
}; };
......
...@@ -190,6 +190,7 @@ enum qeth_ipa_return_codes { ...@@ -190,6 +190,7 @@ enum qeth_ipa_return_codes {
IPA_RC_MC_ADDR_ALREADY_DEFINED = 0xe013, IPA_RC_MC_ADDR_ALREADY_DEFINED = 0xe013,
IPA_RC_LAN_OFFLINE = 0xe080, IPA_RC_LAN_OFFLINE = 0xe080,
IPA_RC_INVALID_IP_VERSION2 = 0xf001, IPA_RC_INVALID_IP_VERSION2 = 0xf001,
IPA_RC_ENOMEM = 0xfffe,
IPA_RC_FFFF = 0xffff IPA_RC_FFFF = 0xffff
}; };
/* for DELIP */ /* for DELIP */
......
...@@ -576,7 +576,6 @@ static int qeth_l2_send_setmac_cb(struct qeth_card *card, ...@@ -576,7 +576,6 @@ static int qeth_l2_send_setmac_cb(struct qeth_card *card,
default: default:
break; break;
} }
cmd->hdr.return_code = -EIO;
} else { } else {
card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; 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,
...@@ -605,7 +604,6 @@ static int qeth_l2_send_delmac_cb(struct qeth_card *card, ...@@ -605,7 +604,6 @@ static int qeth_l2_send_delmac_cb(struct qeth_card *card,
cmd = (struct qeth_ipa_cmd *) data; cmd = (struct qeth_ipa_cmd *) data;
if (cmd->hdr.return_code) { if (cmd->hdr.return_code) {
QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code); QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code);
cmd->hdr.return_code = -EIO;
return 0; return 0;
} }
card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
...@@ -682,7 +680,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) ...@@ -682,7 +680,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]);
if (!rc) if (!rc)
rc = qeth_l2_send_setmac(card, addr->sa_data); rc = qeth_l2_send_setmac(card, addr->sa_data);
return rc; return rc ? -EINVAL : 0;
} }
static void qeth_l2_set_multicast_list(struct net_device *dev) static void qeth_l2_set_multicast_list(struct net_device *dev)
......
...@@ -2430,7 +2430,7 @@ static int qeth_l3_arp_query_cb(struct qeth_card *card, ...@@ -2430,7 +2430,7 @@ static int qeth_l3_arp_query_cb(struct qeth_card *card,
if ((qinfo->udata_len - qinfo->udata_offset) < esize) { if ((qinfo->udata_len - qinfo->udata_offset) < esize) {
QETH_CARD_TEXT_(card, 4, "qaer3%i", -ENOMEM); QETH_CARD_TEXT_(card, 4, "qaer3%i", -ENOMEM);
cmd->hdr.return_code = -ENOMEM; cmd->hdr.return_code = IPA_RC_ENOMEM;
goto out_error; goto out_error;
} }
......
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