aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-01-27 19:59:56 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-27 19:59:56 -0500
commit95f873f2fff96c592c5d863e2a39825bd8bf0500 (patch)
tree0d2dd664964ba2c701aefea5b4d1e85b481045e1 /drivers/s390
parent8ea65f4a2dfaaf494ef42a16cbf2fea39b07450f (diff)
parent59343cd7c4809cf7598789e1cd14563780ae4239 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: arch/arm/boot/dts/imx6sx-sdb.dts net/sched/cls_bpf.c Two simple sets of overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/qeth_core_main.c117
-rw-r--r--drivers/s390/net/qeth_l2_main.c220
-rw-r--r--drivers/s390/net/qeth_l3_main.c50
3 files changed, 248 insertions, 139 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index f407e3763432..642c77c76b84 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -1784,6 +1784,8 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel,
1784 QETH_DBF_TEXT(SETUP, 2, "idxanswr"); 1784 QETH_DBF_TEXT(SETUP, 2, "idxanswr");
1785 card = CARD_FROM_CDEV(channel->ccwdev); 1785 card = CARD_FROM_CDEV(channel->ccwdev);
1786 iob = qeth_get_buffer(channel); 1786 iob = qeth_get_buffer(channel);
1787 if (!iob)
1788 return -ENOMEM;
1787 iob->callback = idx_reply_cb; 1789 iob->callback = idx_reply_cb;
1788 memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1)); 1790 memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1));
1789 channel->ccw.count = QETH_BUFSIZE; 1791 channel->ccw.count = QETH_BUFSIZE;
@@ -1834,6 +1836,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel,
1834 QETH_DBF_TEXT(SETUP, 2, "idxactch"); 1836 QETH_DBF_TEXT(SETUP, 2, "idxactch");
1835 1837
1836 iob = qeth_get_buffer(channel); 1838 iob = qeth_get_buffer(channel);
1839 if (!iob)
1840 return -ENOMEM;
1837 iob->callback = idx_reply_cb; 1841 iob->callback = idx_reply_cb;
1838 memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1)); 1842 memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1));
1839 channel->ccw.count = IDX_ACTIVATE_SIZE; 1843 channel->ccw.count = IDX_ACTIVATE_SIZE;
@@ -2021,10 +2025,36 @@ void qeth_prepare_control_data(struct qeth_card *card, int len,
2021} 2025}
2022EXPORT_SYMBOL_GPL(qeth_prepare_control_data); 2026EXPORT_SYMBOL_GPL(qeth_prepare_control_data);
2023 2027
2028/**
2029 * qeth_send_control_data() - send control command to the card
2030 * @card: qeth_card structure pointer
2031 * @len: size of the command buffer
2032 * @iob: qeth_cmd_buffer pointer
2033 * @reply_cb: callback function pointer
2034 * @cb_card: pointer to the qeth_card structure
2035 * @cb_reply: pointer to the qeth_reply structure
2036 * @cb_cmd: pointer to the original iob for non-IPA
2037 * commands, or to the qeth_ipa_cmd structure
2038 * for the IPA commands.
2039 * @reply_param: private pointer passed to the callback
2040 *
2041 * Returns the value of the `return_code' field of the response
2042 * block returned from the hardware, or other error indication.
2043 * Value of zero indicates successful execution of the command.
2044 *
2045 * Callback function gets called one or more times, with cb_cmd
2046 * pointing to the response returned by the hardware. Callback
2047 * function must return non-zero if more reply blocks are expected,
2048 * and zero if the last or only reply block is received. Callback
2049 * function can get the value of the reply_param pointer from the
2050 * field 'param' of the structure qeth_reply.
2051 */
2052
2024int qeth_send_control_data(struct qeth_card *card, int len, 2053int qeth_send_control_data(struct qeth_card *card, int len,
2025 struct qeth_cmd_buffer *iob, 2054 struct qeth_cmd_buffer *iob,
2026 int (*reply_cb)(struct qeth_card *, struct qeth_reply *, 2055 int (*reply_cb)(struct qeth_card *cb_card,
2027 unsigned long), 2056 struct qeth_reply *cb_reply,
2057 unsigned long cb_cmd),
2028 void *reply_param) 2058 void *reply_param)
2029{ 2059{
2030 int rc; 2060 int rc;
@@ -2914,9 +2944,16 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *card,
2914 struct qeth_cmd_buffer *iob; 2944 struct qeth_cmd_buffer *iob;
2915 struct qeth_ipa_cmd *cmd; 2945 struct qeth_ipa_cmd *cmd;
2916 2946
2917 iob = qeth_wait_for_buffer(&card->write); 2947 iob = qeth_get_buffer(&card->write);
2918 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 2948 if (iob) {
2919 qeth_fill_ipacmd_header(card, cmd, ipacmd, prot); 2949 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
2950 qeth_fill_ipacmd_header(card, cmd, ipacmd, prot);
2951 } else {
2952 dev_warn(&card->gdev->dev,
2953 "The qeth driver ran out of channel command buffers\n");
2954 QETH_DBF_MESSAGE(1, "%s The qeth driver ran out of channel command buffers",
2955 dev_name(&card->gdev->dev));
2956 }
2920 2957
2921 return iob; 2958 return iob;
2922} 2959}
@@ -2932,6 +2969,12 @@ void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
2932} 2969}
2933EXPORT_SYMBOL_GPL(qeth_prepare_ipa_cmd); 2970EXPORT_SYMBOL_GPL(qeth_prepare_ipa_cmd);
2934 2971
2972/**
2973 * qeth_send_ipa_cmd() - send an IPA command
2974 *
2975 * See qeth_send_control_data() for explanation of the arguments.
2976 */
2977
2935int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, 2978int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
2936 int (*reply_cb)(struct qeth_card *, struct qeth_reply*, 2979 int (*reply_cb)(struct qeth_card *, struct qeth_reply*,
2937 unsigned long), 2980 unsigned long),
@@ -2968,6 +3011,8 @@ int qeth_send_startlan(struct qeth_card *card)
2968 QETH_DBF_TEXT(SETUP, 2, "strtlan"); 3011 QETH_DBF_TEXT(SETUP, 2, "strtlan");
2969 3012
2970 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_STARTLAN, 0); 3013 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_STARTLAN, 0);
3014 if (!iob)
3015 return -ENOMEM;
2971 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); 3016 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL);
2972 return rc; 3017 return rc;
2973} 3018}
@@ -3013,11 +3058,13 @@ static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card,
3013 3058
3014 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETADAPTERPARMS, 3059 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETADAPTERPARMS,
3015 QETH_PROT_IPV4); 3060 QETH_PROT_IPV4);
3016 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 3061 if (iob) {
3017 cmd->data.setadapterparms.hdr.cmdlength = cmdlen; 3062 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
3018 cmd->data.setadapterparms.hdr.command_code = command; 3063 cmd->data.setadapterparms.hdr.cmdlength = cmdlen;
3019 cmd->data.setadapterparms.hdr.used_total = 1; 3064 cmd->data.setadapterparms.hdr.command_code = command;
3020 cmd->data.setadapterparms.hdr.seq_no = 1; 3065 cmd->data.setadapterparms.hdr.used_total = 1;
3066 cmd->data.setadapterparms.hdr.seq_no = 1;
3067 }
3021 3068
3022 return iob; 3069 return iob;
3023} 3070}
@@ -3030,6 +3077,8 @@ int qeth_query_setadapterparms(struct qeth_card *card)
3030 QETH_CARD_TEXT(card, 3, "queryadp"); 3077 QETH_CARD_TEXT(card, 3, "queryadp");
3031 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED, 3078 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED,
3032 sizeof(struct qeth_ipacmd_setadpparms)); 3079 sizeof(struct qeth_ipacmd_setadpparms));
3080 if (!iob)
3081 return -ENOMEM;
3033 rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL); 3082 rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL);
3034 return rc; 3083 return rc;
3035} 3084}
@@ -3080,6 +3129,8 @@ int qeth_query_ipassists(struct qeth_card *card, enum qeth_prot_versions prot)
3080 3129
3081 QETH_DBF_TEXT_(SETUP, 2, "qipassi%i", prot); 3130 QETH_DBF_TEXT_(SETUP, 2, "qipassi%i", prot);
3082 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_QIPASSIST, prot); 3131 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_QIPASSIST, prot);
3132 if (!iob)
3133 return -ENOMEM;
3083 rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL); 3134 rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL);
3084 return rc; 3135 return rc;
3085} 3136}
@@ -3119,6 +3170,8 @@ int qeth_query_switch_attributes(struct qeth_card *card,
3119 return -ENOMEDIUM; 3170 return -ENOMEDIUM;
3120 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES, 3171 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES,
3121 sizeof(struct qeth_ipacmd_setadpparms_hdr)); 3172 sizeof(struct qeth_ipacmd_setadpparms_hdr));
3173 if (!iob)
3174 return -ENOMEM;
3122 return qeth_send_ipa_cmd(card, iob, 3175 return qeth_send_ipa_cmd(card, iob,
3123 qeth_query_switch_attributes_cb, sw_info); 3176 qeth_query_switch_attributes_cb, sw_info);
3124} 3177}
@@ -3146,6 +3199,8 @@ static int qeth_query_setdiagass(struct qeth_card *card)
3146 3199
3147 QETH_DBF_TEXT(SETUP, 2, "qdiagass"); 3200 QETH_DBF_TEXT(SETUP, 2, "qdiagass");
3148 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); 3201 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0);
3202 if (!iob)
3203 return -ENOMEM;
3149 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 3204 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
3150 cmd->data.diagass.subcmd_len = 16; 3205 cmd->data.diagass.subcmd_len = 16;
3151 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_QUERY; 3206 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_QUERY;
@@ -3197,6 +3252,8 @@ int qeth_hw_trap(struct qeth_card *card, enum qeth_diags_trap_action action)
3197 3252
3198 QETH_DBF_TEXT(SETUP, 2, "diagtrap"); 3253 QETH_DBF_TEXT(SETUP, 2, "diagtrap");
3199 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); 3254 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0);
3255 if (!iob)
3256 return -ENOMEM;
3200 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 3257 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
3201 cmd->data.diagass.subcmd_len = 80; 3258 cmd->data.diagass.subcmd_len = 80;
3202 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRAP; 3259 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRAP;
@@ -4162,6 +4219,8 @@ void qeth_setadp_promisc_mode(struct qeth_card *card)
4162 4219
4163 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, 4220 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE,
4164 sizeof(struct qeth_ipacmd_setadpparms)); 4221 sizeof(struct qeth_ipacmd_setadpparms));
4222 if (!iob)
4223 return;
4165 cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); 4224 cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE);
4166 cmd->data.setadapterparms.data.mode = mode; 4225 cmd->data.setadapterparms.data.mode = mode;
4167 qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); 4226 qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL);
@@ -4232,6 +4291,8 @@ int qeth_setadpparms_change_macaddr(struct qeth_card *card)
4232 4291
4233 iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS, 4292 iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS,
4234 sizeof(struct qeth_ipacmd_setadpparms)); 4293 sizeof(struct qeth_ipacmd_setadpparms));
4294 if (!iob)
4295 return -ENOMEM;
4235 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 4296 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
4236 cmd->data.setadapterparms.data.change_addr.cmd = CHANGE_ADDR_READ_MAC; 4297 cmd->data.setadapterparms.data.change_addr.cmd = CHANGE_ADDR_READ_MAC;
4237 cmd->data.setadapterparms.data.change_addr.addr_size = OSA_ADDR_LEN; 4298 cmd->data.setadapterparms.data.change_addr.addr_size = OSA_ADDR_LEN;
@@ -4345,6 +4406,8 @@ static int qeth_setadpparms_set_access_ctrl(struct qeth_card *card,
4345 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL, 4406 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL,
4346 sizeof(struct qeth_ipacmd_setadpparms_hdr) + 4407 sizeof(struct qeth_ipacmd_setadpparms_hdr) +
4347 sizeof(struct qeth_set_access_ctrl)); 4408 sizeof(struct qeth_set_access_ctrl));
4409 if (!iob)
4410 return -ENOMEM;
4348 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 4411 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
4349 access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl; 4412 access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl;
4350 access_ctrl_req->subcmd_code = isolation; 4413 access_ctrl_req->subcmd_code = isolation;
@@ -4588,6 +4651,10 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata)
4588 4651
4589 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, 4652 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL,
4590 QETH_SNMP_SETADP_CMDLENGTH + req_len); 4653 QETH_SNMP_SETADP_CMDLENGTH + req_len);
4654 if (!iob) {
4655 rc = -ENOMEM;
4656 goto out;
4657 }
4591 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 4658 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
4592 memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len); 4659 memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len);
4593 rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len, 4660 rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len,
@@ -4599,7 +4666,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata)
4599 if (copy_to_user(udata, qinfo.udata, qinfo.udata_len)) 4666 if (copy_to_user(udata, qinfo.udata, qinfo.udata_len))
4600 rc = -EFAULT; 4667 rc = -EFAULT;
4601 } 4668 }
4602 4669out:
4603 kfree(ureq); 4670 kfree(ureq);
4604 kfree(qinfo.udata); 4671 kfree(qinfo.udata);
4605 return rc; 4672 return rc;
@@ -4670,6 +4737,10 @@ int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
4670 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, 4737 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT,
4671 sizeof(struct qeth_ipacmd_setadpparms_hdr) + 4738 sizeof(struct qeth_ipacmd_setadpparms_hdr) +
4672 sizeof(struct qeth_query_oat)); 4739 sizeof(struct qeth_query_oat));
4740 if (!iob) {
4741 rc = -ENOMEM;
4742 goto out_free;
4743 }
4673 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 4744 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
4674 oat_req = &cmd->data.setadapterparms.data.query_oat; 4745 oat_req = &cmd->data.setadapterparms.data.query_oat;
4675 oat_req->subcmd_code = oat_data.command; 4746 oat_req->subcmd_code = oat_data.command;
@@ -4735,6 +4806,8 @@ static int qeth_query_card_info(struct qeth_card *card,
4735 return -EOPNOTSUPP; 4806 return -EOPNOTSUPP;
4736 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_CARD_INFO, 4807 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_CARD_INFO,
4737 sizeof(struct qeth_ipacmd_setadpparms_hdr)); 4808 sizeof(struct qeth_ipacmd_setadpparms_hdr));
4809 if (!iob)
4810 return -ENOMEM;
4738 return qeth_send_ipa_cmd(card, iob, qeth_query_card_info_cb, 4811 return qeth_send_ipa_cmd(card, iob, qeth_query_card_info_cb,
4739 (void *)carrier_info); 4812 (void *)carrier_info);
4740} 4813}
@@ -5060,11 +5133,23 @@ retriable:
5060 card->options.adp.supported_funcs = 0; 5133 card->options.adp.supported_funcs = 0;
5061 card->options.sbp.supported_funcs = 0; 5134 card->options.sbp.supported_funcs = 0;
5062 card->info.diagass_support = 0; 5135 card->info.diagass_support = 0;
5063 qeth_query_ipassists(card, QETH_PROT_IPV4); 5136 rc = qeth_query_ipassists(card, QETH_PROT_IPV4);
5064 if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) 5137 if (rc == -ENOMEM)
5065 qeth_query_setadapterparms(card); 5138 goto out;
5066 if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) 5139 if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
5067 qeth_query_setdiagass(card); 5140 rc = qeth_query_setadapterparms(card);
5141 if (rc < 0) {
5142 QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
5143 goto out;
5144 }
5145 }
5146 if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) {
5147 rc = qeth_query_setdiagass(card);
5148 if (rc < 0) {
5149 QETH_DBF_TEXT_(SETUP, 2, "7err%d", rc);
5150 goto out;
5151 }
5152 }
5068 return 0; 5153 return 0;
5069out: 5154out:
5070 dev_warn(&card->gdev->dev, "The qeth device driver failed to recover " 5155 dev_warn(&card->gdev->dev, "The qeth device driver failed to recover "
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index f5f409d85295..0ea0869120cf 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -27,10 +27,7 @@ static int qeth_l2_set_offline(struct ccwgroup_device *);
27static int qeth_l2_stop(struct net_device *); 27static int qeth_l2_stop(struct net_device *);
28static int qeth_l2_send_delmac(struct qeth_card *, __u8 *); 28static int qeth_l2_send_delmac(struct qeth_card *, __u8 *);
29static int qeth_l2_send_setdelmac(struct qeth_card *, __u8 *, 29static int qeth_l2_send_setdelmac(struct qeth_card *, __u8 *,
30 enum qeth_ipa_cmds, 30 enum qeth_ipa_cmds);
31 int (*reply_cb) (struct qeth_card *,
32 struct qeth_reply*,
33 unsigned long));
34static void qeth_l2_set_multicast_list(struct net_device *); 31static void qeth_l2_set_multicast_list(struct net_device *);
35static int qeth_l2_recover(void *); 32static int qeth_l2_recover(void *);
36static void qeth_bridgeport_query_support(struct qeth_card *card); 33static void qeth_bridgeport_query_support(struct qeth_card *card);
@@ -129,56 +126,71 @@ static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no)
129 return ndev; 126 return ndev;
130} 127}
131 128
132static int qeth_l2_send_setgroupmac_cb(struct qeth_card *card, 129static int qeth_setdel_makerc(struct qeth_card *card, int retcode)
133 struct qeth_reply *reply,
134 unsigned long data)
135{ 130{
136 struct qeth_ipa_cmd *cmd; 131 int rc;
137 __u8 *mac;
138 132
139 QETH_CARD_TEXT(card, 2, "L2Sgmacb"); 133 if (retcode)
140 cmd = (struct qeth_ipa_cmd *) data; 134 QETH_CARD_TEXT_(card, 2, "err%04x", retcode);
141 mac = &cmd->data.setdelmac.mac[0]; 135 switch (retcode) {
142 /* MAC already registered, needed in couple/uncouple case */ 136 case IPA_RC_SUCCESS:
143 if (cmd->hdr.return_code == IPA_RC_L2_DUP_MAC) { 137 rc = 0;
144 QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s \n", 138 break;
145 mac, QETH_CARD_IFNAME(card)); 139 case IPA_RC_L2_UNSUPPORTED_CMD:
146 cmd->hdr.return_code = 0; 140 rc = -ENOSYS;
141 break;
142 case IPA_RC_L2_ADDR_TABLE_FULL:
143 rc = -ENOSPC;
144 break;
145 case IPA_RC_L2_DUP_MAC:
146 case IPA_RC_L2_DUP_LAYER3_MAC:
147 rc = -EEXIST;
148 break;
149 case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP:
150 case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP:
151 rc = -EPERM;
152 break;
153 case IPA_RC_L2_MAC_NOT_FOUND:
154 rc = -ENOENT;
155 break;
156 case -ENOMEM:
157 rc = -ENOMEM;
158 break;
159 default:
160 rc = -EIO;
161 break;
147 } 162 }
148 if (cmd->hdr.return_code) 163 return rc;
149 QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %x\n",
150 mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code);
151 return 0;
152} 164}
153 165
154static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac) 166static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac)
155{ 167{
156 QETH_CARD_TEXT(card, 2, "L2Sgmac"); 168 int rc;
157 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETGMAC,
158 qeth_l2_send_setgroupmac_cb);
159}
160
161static int qeth_l2_send_delgroupmac_cb(struct qeth_card *card,
162 struct qeth_reply *reply,
163 unsigned long data)
164{
165 struct qeth_ipa_cmd *cmd;
166 __u8 *mac;
167 169
168 QETH_CARD_TEXT(card, 2, "L2Dgmacb"); 170 QETH_CARD_TEXT(card, 2, "L2Sgmac");
169 cmd = (struct qeth_ipa_cmd *) data; 171 rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
170 mac = &cmd->data.setdelmac.mac[0]; 172 IPA_CMD_SETGMAC));
171 if (cmd->hdr.return_code) 173 if (rc == -EEXIST)
172 QETH_DBF_MESSAGE(2, "Could not delete group MAC %pM on %s: %x\n", 174 QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s\n",
173 mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code); 175 mac, QETH_CARD_IFNAME(card));
174 return 0; 176 else if (rc)
177 QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %d\n",
178 mac, QETH_CARD_IFNAME(card), rc);
179 return rc;
175} 180}
176 181
177static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) 182static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac)
178{ 183{
184 int rc;
185
179 QETH_CARD_TEXT(card, 2, "L2Dgmac"); 186 QETH_CARD_TEXT(card, 2, "L2Dgmac");
180 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELGMAC, 187 rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
181 qeth_l2_send_delgroupmac_cb); 188 IPA_CMD_DELGMAC));
189 if (rc)
190 QETH_DBF_MESSAGE(2,
191 "Could not delete group MAC %pM on %s: %d\n",
192 mac, QETH_CARD_IFNAME(card), rc);
193 return rc;
182} 194}
183 195
184static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) 196static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac)
@@ -196,10 +208,11 @@ static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac)
196 mc->is_vmac = vmac; 208 mc->is_vmac = vmac;
197 209
198 if (vmac) { 210 if (vmac) {
199 rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, 211 rc = qeth_setdel_makerc(card,
200 NULL); 212 qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC));
201 } else { 213 } else {
202 rc = qeth_l2_send_setgroupmac(card, mac); 214 rc = qeth_setdel_makerc(card,
215 qeth_l2_send_setgroupmac(card, mac));
203 } 216 }
204 217
205 if (!rc) 218 if (!rc)
@@ -217,7 +230,7 @@ static void qeth_l2_del_all_mc(struct qeth_card *card, int del)
217 if (del) { 230 if (del) {
218 if (mc->is_vmac) 231 if (mc->is_vmac)
219 qeth_l2_send_setdelmac(card, mc->mc_addr, 232 qeth_l2_send_setdelmac(card, mc->mc_addr,
220 IPA_CMD_DELVMAC, NULL); 233 IPA_CMD_DELVMAC);
221 else 234 else
222 qeth_l2_send_delgroupmac(card, mc->mc_addr); 235 qeth_l2_send_delgroupmac(card, mc->mc_addr);
223 } 236 }
@@ -290,6 +303,8 @@ static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i,
290 303
291 QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd); 304 QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd);
292 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); 305 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4);
306 if (!iob)
307 return -ENOMEM;
293 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 308 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
294 cmd->data.setdelvlan.vlan_id = i; 309 cmd->data.setdelvlan.vlan_id = i;
295 return qeth_send_ipa_cmd(card, iob, 310 return qeth_send_ipa_cmd(card, iob,
@@ -312,6 +327,7 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev,
312{ 327{
313 struct qeth_card *card = dev->ml_priv; 328 struct qeth_card *card = dev->ml_priv;
314 struct qeth_vlan_vid *id; 329 struct qeth_vlan_vid *id;
330 int rc;
315 331
316 QETH_CARD_TEXT_(card, 4, "aid:%d", vid); 332 QETH_CARD_TEXT_(card, 4, "aid:%d", vid);
317 if (!vid) 333 if (!vid)
@@ -327,7 +343,11 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev,
327 id = kmalloc(sizeof(struct qeth_vlan_vid), GFP_ATOMIC); 343 id = kmalloc(sizeof(struct qeth_vlan_vid), GFP_ATOMIC);
328 if (id) { 344 if (id) {
329 id->vid = vid; 345 id->vid = vid;
330 qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN); 346 rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN);
347 if (rc) {
348 kfree(id);
349 return rc;
350 }
331 spin_lock_bh(&card->vlanlock); 351 spin_lock_bh(&card->vlanlock);
332 list_add_tail(&id->list, &card->vid_list); 352 list_add_tail(&id->list, &card->vid_list);
333 spin_unlock_bh(&card->vlanlock); 353 spin_unlock_bh(&card->vlanlock);
@@ -342,6 +362,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev,
342{ 362{
343 struct qeth_vlan_vid *id, *tmpid = NULL; 363 struct qeth_vlan_vid *id, *tmpid = NULL;
344 struct qeth_card *card = dev->ml_priv; 364 struct qeth_card *card = dev->ml_priv;
365 int rc = 0;
345 366
346 QETH_CARD_TEXT_(card, 4, "kid:%d", vid); 367 QETH_CARD_TEXT_(card, 4, "kid:%d", vid);
347 if (card->info.type == QETH_CARD_TYPE_OSM) { 368 if (card->info.type == QETH_CARD_TYPE_OSM) {
@@ -362,11 +383,11 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev,
362 } 383 }
363 spin_unlock_bh(&card->vlanlock); 384 spin_unlock_bh(&card->vlanlock);
364 if (tmpid) { 385 if (tmpid) {
365 qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); 386 rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN);
366 kfree(tmpid); 387 kfree(tmpid);
367 } 388 }
368 qeth_l2_set_multicast_list(card->dev); 389 qeth_l2_set_multicast_list(card->dev);
369 return 0; 390 return rc;
370} 391}
371 392
372static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode) 393static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode)
@@ -538,91 +559,62 @@ out:
538} 559}
539 560
540static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac, 561static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac,
541 enum qeth_ipa_cmds ipacmd, 562 enum qeth_ipa_cmds ipacmd)
542 int (*reply_cb) (struct qeth_card *,
543 struct qeth_reply*,
544 unsigned long))
545{ 563{
546 struct qeth_ipa_cmd *cmd; 564 struct qeth_ipa_cmd *cmd;
547 struct qeth_cmd_buffer *iob; 565 struct qeth_cmd_buffer *iob;
548 566
549 QETH_CARD_TEXT(card, 2, "L2sdmac"); 567 QETH_CARD_TEXT(card, 2, "L2sdmac");
550 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); 568 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4);
569 if (!iob)
570 return -ENOMEM;
551 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 571 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
552 cmd->data.setdelmac.mac_length = OSA_ADDR_LEN; 572 cmd->data.setdelmac.mac_length = OSA_ADDR_LEN;
553 memcpy(&cmd->data.setdelmac.mac, mac, OSA_ADDR_LEN); 573 memcpy(&cmd->data.setdelmac.mac, mac, OSA_ADDR_LEN);
554 return qeth_send_ipa_cmd(card, iob, reply_cb, NULL); 574 return qeth_send_ipa_cmd(card, iob, NULL, NULL);
555} 575}
556 576
557static int qeth_l2_send_setmac_cb(struct qeth_card *card, 577static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
558 struct qeth_reply *reply,
559 unsigned long data)
560{ 578{
561 struct qeth_ipa_cmd *cmd; 579 int rc;
562 580
563 QETH_CARD_TEXT(card, 2, "L2Smaccb"); 581 QETH_CARD_TEXT(card, 2, "L2Setmac");
564 cmd = (struct qeth_ipa_cmd *) data; 582 rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
565 if (cmd->hdr.return_code) { 583 IPA_CMD_SETVMAC));
566 QETH_CARD_TEXT_(card, 2, "L2er%x", cmd->hdr.return_code); 584 if (rc == 0) {
585 card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED;
586 memcpy(card->dev->dev_addr, mac, OSA_ADDR_LEN);
587 dev_info(&card->gdev->dev,
588 "MAC address %pM successfully registered on device %s\n",
589 card->dev->dev_addr, card->dev->name);
590 } else {
567 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; 591 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
568 switch (cmd->hdr.return_code) { 592 switch (rc) {
569 case IPA_RC_L2_DUP_MAC: 593 case -EEXIST:
570 case IPA_RC_L2_DUP_LAYER3_MAC:
571 dev_warn(&card->gdev->dev, 594 dev_warn(&card->gdev->dev,
572 "MAC address %pM already exists\n", 595 "MAC address %pM already exists\n", mac);
573 cmd->data.setdelmac.mac);
574 break; 596 break;
575 case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP: 597 case -EPERM:
576 case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP:
577 dev_warn(&card->gdev->dev, 598 dev_warn(&card->gdev->dev,
578 "MAC address %pM is not authorized\n", 599 "MAC address %pM is not authorized\n", mac);
579 cmd->data.setdelmac.mac);
580 break;
581 default:
582 break; 600 break;
583 } 601 }
584 } else {
585 card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED;
586 memcpy(card->dev->dev_addr, cmd->data.setdelmac.mac,
587 OSA_ADDR_LEN);
588 dev_info(&card->gdev->dev,
589 "MAC address %pM successfully registered on device %s\n",
590 card->dev->dev_addr, card->dev->name);
591 }
592 return 0;
593}
594
595static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
596{
597 QETH_CARD_TEXT(card, 2, "L2Setmac");
598 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC,
599 qeth_l2_send_setmac_cb);
600}
601
602static int qeth_l2_send_delmac_cb(struct qeth_card *card,
603 struct qeth_reply *reply,
604 unsigned long data)
605{
606 struct qeth_ipa_cmd *cmd;
607
608 QETH_CARD_TEXT(card, 2, "L2Dmaccb");
609 cmd = (struct qeth_ipa_cmd *) data;
610 if (cmd->hdr.return_code) {
611 QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code);
612 return 0;
613 } 602 }
614 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; 603 return rc;
615
616 return 0;
617} 604}
618 605
619static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac) 606static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac)
620{ 607{
608 int rc;
609
621 QETH_CARD_TEXT(card, 2, "L2Delmac"); 610 QETH_CARD_TEXT(card, 2, "L2Delmac");
622 if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) 611 if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))
623 return 0; 612 return 0;
624 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, 613 rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac,
625 qeth_l2_send_delmac_cb); 614 IPA_CMD_DELVMAC));
615 if (rc == 0)
616 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
617 return rc;
626} 618}
627 619
628static int qeth_l2_request_initial_mac(struct qeth_card *card) 620static int qeth_l2_request_initial_mac(struct qeth_card *card)
@@ -650,7 +642,7 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
650 if (rc) { 642 if (rc) {
651 QETH_DBF_MESSAGE(2, "couldn't get MAC address on " 643 QETH_DBF_MESSAGE(2, "couldn't get MAC address on "
652 "device %s: x%x\n", CARD_BUS_ID(card), rc); 644 "device %s: x%x\n", CARD_BUS_ID(card), rc);
653 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); 645 QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc);
654 return rc; 646 return rc;
655 } 647 }
656 QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, OSA_ADDR_LEN); 648 QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, OSA_ADDR_LEN);
@@ -686,7 +678,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
686 return -ERESTARTSYS; 678 return -ERESTARTSYS;
687 } 679 }
688 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); 680 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]);
689 if (!rc || (rc == IPA_RC_L2_MAC_NOT_FOUND)) 681 if (!rc || (rc == -ENOENT))
690 rc = qeth_l2_send_setmac(card, addr->sa_data); 682 rc = qeth_l2_send_setmac(card, addr->sa_data);
691 return rc ? -EINVAL : 0; 683 return rc ? -EINVAL : 0;
692} 684}
@@ -995,7 +987,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
995 recover_flag = card->state; 987 recover_flag = card->state;
996 rc = qeth_core_hardsetup_card(card); 988 rc = qeth_core_hardsetup_card(card);
997 if (rc) { 989 if (rc) {
998 QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); 990 QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
999 rc = -ENODEV; 991 rc = -ENODEV;
1000 goto out_remove; 992 goto out_remove;
1001 } 993 }
@@ -1728,6 +1720,8 @@ static void qeth_bridgeport_query_support(struct qeth_card *card)
1728 1720
1729 QETH_CARD_TEXT(card, 2, "brqsuppo"); 1721 QETH_CARD_TEXT(card, 2, "brqsuppo");
1730 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); 1722 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0);
1723 if (!iob)
1724 return;
1731 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1725 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1732 cmd->data.sbp.hdr.cmdlength = 1726 cmd->data.sbp.hdr.cmdlength =
1733 sizeof(struct qeth_ipacmd_sbp_hdr) + 1727 sizeof(struct qeth_ipacmd_sbp_hdr) +
@@ -1803,6 +1797,8 @@ int qeth_bridgeport_query_ports(struct qeth_card *card,
1803 if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS)) 1797 if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS))
1804 return -EOPNOTSUPP; 1798 return -EOPNOTSUPP;
1805 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); 1799 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0);
1800 if (!iob)
1801 return -ENOMEM;
1806 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1802 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1807 cmd->data.sbp.hdr.cmdlength = 1803 cmd->data.sbp.hdr.cmdlength =
1808 sizeof(struct qeth_ipacmd_sbp_hdr); 1804 sizeof(struct qeth_ipacmd_sbp_hdr);
@@ -1815,9 +1811,7 @@ int qeth_bridgeport_query_ports(struct qeth_card *card,
1815 if (rc) 1811 if (rc)
1816 return rc; 1812 return rc;
1817 rc = qeth_bridgeport_makerc(card, &cbctl, IPA_SBP_QUERY_BRIDGE_PORTS); 1813 rc = qeth_bridgeport_makerc(card, &cbctl, IPA_SBP_QUERY_BRIDGE_PORTS);
1818 if (rc) 1814 return rc;
1819 return rc;
1820 return 0;
1821} 1815}
1822EXPORT_SYMBOL_GPL(qeth_bridgeport_query_ports); 1816EXPORT_SYMBOL_GPL(qeth_bridgeport_query_ports);
1823 1817
@@ -1871,6 +1865,8 @@ int qeth_bridgeport_setrole(struct qeth_card *card, enum qeth_sbp_roles role)
1871 if (!(card->options.sbp.supported_funcs & setcmd)) 1865 if (!(card->options.sbp.supported_funcs & setcmd))
1872 return -EOPNOTSUPP; 1866 return -EOPNOTSUPP;
1873 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); 1867 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0);
1868 if (!iob)
1869 return -ENOMEM;
1874 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1870 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1875 cmd->data.sbp.hdr.cmdlength = cmdlength; 1871 cmd->data.sbp.hdr.cmdlength = cmdlength;
1876 cmd->data.sbp.hdr.command_code = setcmd; 1872 cmd->data.sbp.hdr.command_code = setcmd;
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 1432b10e95ad..04e42c649134 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -547,6 +547,8 @@ static int qeth_l3_send_setdelmc(struct qeth_card *card,
547 QETH_CARD_TEXT(card, 4, "setdelmc"); 547 QETH_CARD_TEXT(card, 4, "setdelmc");
548 548
549 iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto); 549 iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto);
550 if (!iob)
551 return -ENOMEM;
550 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 552 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
551 memcpy(&cmd->data.setdelipm.mac, addr->mac, OSA_ADDR_LEN); 553 memcpy(&cmd->data.setdelipm.mac, addr->mac, OSA_ADDR_LEN);
552 if (addr->proto == QETH_PROT_IPV6) 554 if (addr->proto == QETH_PROT_IPV6)
@@ -586,6 +588,8 @@ static int qeth_l3_send_setdelip(struct qeth_card *card,
586 QETH_CARD_TEXT_(card, 4, "flags%02X", flags); 588 QETH_CARD_TEXT_(card, 4, "flags%02X", flags);
587 589
588 iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto); 590 iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto);
591 if (!iob)
592 return -ENOMEM;
589 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 593 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
590 if (addr->proto == QETH_PROT_IPV6) { 594 if (addr->proto == QETH_PROT_IPV6) {
591 memcpy(cmd->data.setdelip6.ip_addr, &addr->u.a6.addr, 595 memcpy(cmd->data.setdelip6.ip_addr, &addr->u.a6.addr,
@@ -614,6 +618,8 @@ static int qeth_l3_send_setrouting(struct qeth_card *card,
614 618
615 QETH_CARD_TEXT(card, 4, "setroutg"); 619 QETH_CARD_TEXT(card, 4, "setroutg");
616 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETRTG, prot); 620 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETRTG, prot);
621 if (!iob)
622 return -ENOMEM;
617 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 623 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
618 cmd->data.setrtg.type = (type); 624 cmd->data.setrtg.type = (type);
619 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); 625 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL);
@@ -1047,12 +1053,14 @@ static struct qeth_cmd_buffer *qeth_l3_get_setassparms_cmd(
1047 QETH_CARD_TEXT(card, 4, "getasscm"); 1053 QETH_CARD_TEXT(card, 4, "getasscm");
1048 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETASSPARMS, prot); 1054 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETASSPARMS, prot);
1049 1055
1050 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1056 if (iob) {
1051 cmd->data.setassparms.hdr.assist_no = ipa_func; 1057 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1052 cmd->data.setassparms.hdr.length = 8 + len; 1058 cmd->data.setassparms.hdr.assist_no = ipa_func;
1053 cmd->data.setassparms.hdr.command_code = cmd_code; 1059 cmd->data.setassparms.hdr.length = 8 + len;
1054 cmd->data.setassparms.hdr.return_code = 0; 1060 cmd->data.setassparms.hdr.command_code = cmd_code;
1055 cmd->data.setassparms.hdr.seq_no = 0; 1061 cmd->data.setassparms.hdr.return_code = 0;
1062 cmd->data.setassparms.hdr.seq_no = 0;
1063 }
1056 1064
1057 return iob; 1065 return iob;
1058} 1066}
@@ -1088,6 +1096,8 @@ static int qeth_l3_send_simple_setassparms_ipv6(struct qeth_card *card,
1088 QETH_CARD_TEXT(card, 4, "simassp6"); 1096 QETH_CARD_TEXT(card, 4, "simassp6");
1089 iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code, 1097 iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code,
1090 0, QETH_PROT_IPV6); 1098 0, QETH_PROT_IPV6);
1099 if (!iob)
1100 return -ENOMEM;
1091 rc = qeth_l3_send_setassparms(card, iob, 0, 0, 1101 rc = qeth_l3_send_setassparms(card, iob, 0, 0,
1092 qeth_l3_default_setassparms_cb, NULL); 1102 qeth_l3_default_setassparms_cb, NULL);
1093 return rc; 1103 return rc;
@@ -1106,6 +1116,8 @@ static int qeth_l3_send_simple_setassparms(struct qeth_card *card,
1106 length = sizeof(__u32); 1116 length = sizeof(__u32);
1107 iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code, 1117 iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code,
1108 length, QETH_PROT_IPV4); 1118 length, QETH_PROT_IPV4);
1119 if (!iob)
1120 return -ENOMEM;
1109 rc = qeth_l3_send_setassparms(card, iob, length, data, 1121 rc = qeth_l3_send_setassparms(card, iob, length, data,
1110 qeth_l3_default_setassparms_cb, NULL); 1122 qeth_l3_default_setassparms_cb, NULL);
1111 return rc; 1123 return rc;
@@ -1492,6 +1504,8 @@ static int qeth_l3_iqd_read_initial_mac(struct qeth_card *card)
1492 1504
1493 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR, 1505 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR,
1494 QETH_PROT_IPV6); 1506 QETH_PROT_IPV6);
1507 if (!iob)
1508 return -ENOMEM;
1495 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1509 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1496 *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) = 1510 *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) =
1497 card->info.unique_id; 1511 card->info.unique_id;
@@ -1535,6 +1549,8 @@ static int qeth_l3_get_unique_id(struct qeth_card *card)
1535 1549
1536 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR, 1550 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR,
1537 QETH_PROT_IPV6); 1551 QETH_PROT_IPV6);
1552 if (!iob)
1553 return -ENOMEM;
1538 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1554 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1539 *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) = 1555 *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) =
1540 card->info.unique_id; 1556 card->info.unique_id;
@@ -1609,6 +1625,8 @@ qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd)
1609 QETH_DBF_TEXT(SETUP, 2, "diagtrac"); 1625 QETH_DBF_TEXT(SETUP, 2, "diagtrac");
1610 1626
1611 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); 1627 iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0);
1628 if (!iob)
1629 return -ENOMEM;
1612 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 1630 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1613 cmd->data.diagass.subcmd_len = 16; 1631 cmd->data.diagass.subcmd_len = 16;
1614 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRACE; 1632 cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRACE;
@@ -2440,6 +2458,8 @@ static int qeth_l3_query_arp_cache_info(struct qeth_card *card,
2440 IPA_CMD_ASS_ARP_QUERY_INFO, 2458 IPA_CMD_ASS_ARP_QUERY_INFO,
2441 sizeof(struct qeth_arp_query_data) - sizeof(char), 2459 sizeof(struct qeth_arp_query_data) - sizeof(char),
2442 prot); 2460 prot);
2461 if (!iob)
2462 return -ENOMEM;
2443 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); 2463 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
2444 cmd->data.setassparms.data.query_arp.request_bits = 0x000F; 2464 cmd->data.setassparms.data.query_arp.request_bits = 0x000F;
2445 cmd->data.setassparms.data.query_arp.reply_bits = 0; 2465 cmd->data.setassparms.data.query_arp.reply_bits = 0;
@@ -2533,6 +2553,8 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
2533 IPA_CMD_ASS_ARP_ADD_ENTRY, 2553 IPA_CMD_ASS_ARP_ADD_ENTRY,
2534 sizeof(struct qeth_arp_cache_entry), 2554 sizeof(struct qeth_arp_cache_entry),
2535 QETH_PROT_IPV4); 2555 QETH_PROT_IPV4);
2556 if (!iob)
2557 return -ENOMEM;
2536 rc = qeth_l3_send_setassparms(card, iob, 2558 rc = qeth_l3_send_setassparms(card, iob,
2537 sizeof(struct qeth_arp_cache_entry), 2559 sizeof(struct qeth_arp_cache_entry),
2538 (unsigned long) entry, 2560 (unsigned long) entry,
@@ -2572,6 +2594,8 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card,
2572 IPA_CMD_ASS_ARP_REMOVE_ENTRY, 2594 IPA_CMD_ASS_ARP_REMOVE_ENTRY,
2573 12, 2595 12,
2574 QETH_PROT_IPV4); 2596 QETH_PROT_IPV4);
2597 if (!iob)
2598 return -ENOMEM;
2575 rc = qeth_l3_send_setassparms(card, iob, 2599 rc = qeth_l3_send_setassparms(card, iob,
2576 12, (unsigned long)buf, 2600 12, (unsigned long)buf,
2577 qeth_l3_default_setassparms_cb, NULL); 2601 qeth_l3_default_setassparms_cb, NULL);
@@ -3259,6 +3283,8 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = {
3259 3283
3260static int qeth_l3_setup_netdev(struct qeth_card *card) 3284static int qeth_l3_setup_netdev(struct qeth_card *card)
3261{ 3285{
3286 int rc;
3287
3262 if (card->info.type == QETH_CARD_TYPE_OSD || 3288 if (card->info.type == QETH_CARD_TYPE_OSD ||
3263 card->info.type == QETH_CARD_TYPE_OSX) { 3289 card->info.type == QETH_CARD_TYPE_OSX) {
3264 if ((card->info.link_type == QETH_LINK_TYPE_LANE_TR) || 3290 if ((card->info.link_type == QETH_LINK_TYPE_LANE_TR) ||
@@ -3290,7 +3316,9 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
3290 return -ENODEV; 3316 return -ENODEV;
3291 card->dev->flags |= IFF_NOARP; 3317 card->dev->flags |= IFF_NOARP;
3292 card->dev->netdev_ops = &qeth_l3_netdev_ops; 3318 card->dev->netdev_ops = &qeth_l3_netdev_ops;
3293 qeth_l3_iqd_read_initial_mac(card); 3319 rc = qeth_l3_iqd_read_initial_mac(card);
3320 if (rc)
3321 return rc;
3294 if (card->options.hsuid[0]) 3322 if (card->options.hsuid[0])
3295 memcpy(card->dev->perm_addr, card->options.hsuid, 9); 3323 memcpy(card->dev->perm_addr, card->options.hsuid, 9);
3296 } else 3324 } else
@@ -3357,7 +3385,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
3357 recover_flag = card->state; 3385 recover_flag = card->state;
3358 rc = qeth_core_hardsetup_card(card); 3386 rc = qeth_core_hardsetup_card(card);
3359 if (rc) { 3387 if (rc) {
3360 QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); 3388 QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
3361 rc = -ENODEV; 3389 rc = -ENODEV;
3362 goto out_remove; 3390 goto out_remove;
3363 } 3391 }
@@ -3398,7 +3426,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
3398contin: 3426contin:
3399 rc = qeth_l3_setadapter_parms(card); 3427 rc = qeth_l3_setadapter_parms(card);
3400 if (rc) 3428 if (rc)
3401 QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); 3429 QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
3402 if (!card->options.sniffer) { 3430 if (!card->options.sniffer) {
3403 rc = qeth_l3_start_ipassists(card); 3431 rc = qeth_l3_start_ipassists(card);
3404 if (rc) { 3432 if (rc) {
@@ -3407,10 +3435,10 @@ contin:
3407 } 3435 }
3408 rc = qeth_l3_setrouting_v4(card); 3436 rc = qeth_l3_setrouting_v4(card);
3409 if (rc) 3437 if (rc)
3410 QETH_DBF_TEXT_(SETUP, 2, "4err%d", rc); 3438 QETH_DBF_TEXT_(SETUP, 2, "4err%04x", rc);
3411 rc = qeth_l3_setrouting_v6(card); 3439 rc = qeth_l3_setrouting_v6(card);
3412 if (rc) 3440 if (rc)
3413 QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc); 3441 QETH_DBF_TEXT_(SETUP, 2, "5err%04x", rc);
3414 } 3442 }
3415 netif_tx_disable(card->dev); 3443 netif_tx_disable(card->dev);
3416 3444