Skip to content

Commit 2aa4867

Browse files
julianwiedmanndavem330
authored andcommitted
s390/qeth: translate SETVLAN/DELVLAN errors
Properly return any error encountered during VLAN processing to the the caller. Resulting change in behaviour: if SETVLAN fails while registering a new VLAN ID, the stack no longer creates the corresponding vlan device. Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com> Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ab25a50 commit 2aa4867

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

drivers/s390/net/qeth_core_mpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ enum qeth_ipa_return_codes {
166166
IPA_RC_L2_INVALID_VLAN_ID = 0x2015,
167167
IPA_RC_L2_DUP_VLAN_ID = 0x2016,
168168
IPA_RC_L2_VLAN_ID_NOT_FOUND = 0x2017,
169+
IPA_RC_L2_VLAN_ID_NOT_ALLOWED = 0x2050,
169170
IPA_RC_VNICC_VNICBP = 0x20B0,
170171
IPA_RC_SBP_OSA_NOT_CONFIGURED = 0x2B0C,
171172
IPA_RC_SBP_OSA_OS_MISMATCH = 0x2B10,

drivers/s390/net/qeth_l2_main.c

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no)
7878
return ndev;
7979
}
8080

81-
static int qeth_setdel_makerc(struct qeth_card *card, int retcode)
81+
static int qeth_setdelmac_makerc(struct qeth_card *card, int retcode)
8282
{
8383
int rc;
8484

@@ -128,8 +128,8 @@ static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac,
128128
cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
129129
cmd->data.setdelmac.mac_length = OSA_ADDR_LEN;
130130
memcpy(&cmd->data.setdelmac.mac, mac, OSA_ADDR_LEN);
131-
return qeth_setdel_makerc(card, qeth_send_ipa_cmd(card, iob,
132-
NULL, NULL));
131+
return qeth_setdelmac_makerc(card, qeth_send_ipa_cmd(card, iob,
132+
NULL, NULL));
133133
}
134134

135135
static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
@@ -289,25 +289,48 @@ static void qeth_l2_fill_header(struct qeth_hdr *hdr, struct sk_buff *skb,
289289
}
290290
}
291291

292+
static int qeth_setdelvlan_makerc(struct qeth_card *card, int retcode)
293+
{
294+
if (retcode)
295+
QETH_CARD_TEXT_(card, 2, "err%04x", retcode);
296+
297+
switch (retcode) {
298+
case IPA_RC_SUCCESS:
299+
return 0;
300+
case IPA_RC_L2_INVALID_VLAN_ID:
301+
return -EINVAL;
302+
case IPA_RC_L2_DUP_VLAN_ID:
303+
return -EEXIST;
304+
case IPA_RC_L2_VLAN_ID_NOT_FOUND:
305+
return -ENOENT;
306+
case IPA_RC_L2_VLAN_ID_NOT_ALLOWED:
307+
return -EPERM;
308+
case -ENOMEM:
309+
return -ENOMEM;
310+
default:
311+
return -EIO;
312+
}
313+
}
314+
292315
static int qeth_l2_send_setdelvlan_cb(struct qeth_card *card,
293-
struct qeth_reply *reply, unsigned long data)
316+
struct qeth_reply *reply,
317+
unsigned long data)
294318
{
295-
struct qeth_ipa_cmd *cmd;
319+
struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
296320

297321
QETH_CARD_TEXT(card, 2, "L2sdvcb");
298-
cmd = (struct qeth_ipa_cmd *) data;
299322
if (cmd->hdr.return_code) {
300-
QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on %s: 0x%x. "
301-
"Continuing\n", cmd->data.setdelvlan.vlan_id,
302-
QETH_CARD_IFNAME(card), cmd->hdr.return_code);
323+
QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on %s: 0x%x.\n",
324+
cmd->data.setdelvlan.vlan_id,
325+
QETH_CARD_IFNAME(card), cmd->hdr.return_code);
303326
QETH_CARD_TEXT_(card, 2, "L2VL%4x", cmd->hdr.command);
304327
QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code);
305328
}
306329
return 0;
307330
}
308331

309332
static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i,
310-
enum qeth_ipa_cmds ipacmd)
333+
enum qeth_ipa_cmds ipacmd)
311334
{
312335
struct qeth_ipa_cmd *cmd;
313336
struct qeth_cmd_buffer *iob;
@@ -318,8 +341,8 @@ static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i,
318341
return -ENOMEM;
319342
cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
320343
cmd->data.setdelvlan.vlan_id = i;
321-
return qeth_send_ipa_cmd(card, iob,
322-
qeth_l2_send_setdelvlan_cb, NULL);
344+
return qeth_setdelvlan_makerc(card, qeth_send_ipa_cmd(card, iob,
345+
qeth_l2_send_setdelvlan_cb, NULL));
323346
}
324347

325348
static void qeth_l2_process_vlans(struct qeth_card *card)

0 commit comments

Comments
 (0)