mirror of https://gitee.com/openkylin/linux.git
s390/qeth: use correct length field in SNMP cmd callback
qeth_snmp_command_cb() is the only cmd callback that pulls the reply's data length from a low-level transport header field. This requires additional complexity (ie. reply->offset) to make the header accessible to what is supposed to be a pure IPA cmd callback. Adapter cmds have a length field in their sub-cmd header, get the data length from there instead. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
12fc286f84
commit
7c5f8ffb33
|
@ -634,7 +634,6 @@ struct qeth_reply {
|
||||||
int (*callback)(struct qeth_card *, struct qeth_reply *,
|
int (*callback)(struct qeth_card *, struct qeth_reply *,
|
||||||
unsigned long);
|
unsigned long);
|
||||||
u32 seqno;
|
u32 seqno;
|
||||||
unsigned long offset;
|
|
||||||
int rc;
|
int rc;
|
||||||
void *param;
|
void *param;
|
||||||
refcount_t refcnt;
|
refcount_t refcnt;
|
||||||
|
|
|
@ -807,17 +807,12 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&reply->lock, flags);
|
spin_lock_irqsave(&reply->lock, flags);
|
||||||
if (reply->rc) {
|
if (reply->rc)
|
||||||
/* Bail out when the requestor has already left: */
|
/* Bail out when the requestor has already left: */
|
||||||
rc = reply->rc;
|
rc = reply->rc;
|
||||||
} else {
|
else
|
||||||
if (cmd) {
|
rc = reply->callback(card, reply, cmd ? (unsigned long)cmd :
|
||||||
reply->offset = (u16)((char *)cmd - (char *)iob->data);
|
(unsigned long)iob);
|
||||||
rc = reply->callback(card, reply, (unsigned long)cmd);
|
|
||||||
} else {
|
|
||||||
rc = reply->callback(card, reply, (unsigned long)iob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&reply->lock, flags);
|
spin_unlock_irqrestore(&reply->lock, flags);
|
||||||
|
|
||||||
no_callback:
|
no_callback:
|
||||||
|
@ -4335,20 +4330,16 @@ static int qeth_mdio_read(struct net_device *dev, int phy_id, int regnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qeth_snmp_command_cb(struct qeth_card *card,
|
static int qeth_snmp_command_cb(struct qeth_card *card,
|
||||||
struct qeth_reply *reply, unsigned long sdata)
|
struct qeth_reply *reply, unsigned long data)
|
||||||
{
|
{
|
||||||
struct qeth_ipa_cmd *cmd;
|
struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
|
||||||
struct qeth_arp_query_info *qinfo;
|
struct qeth_arp_query_info *qinfo = reply->param;
|
||||||
unsigned char *data;
|
struct qeth_ipacmd_setadpparms *adp_cmd;
|
||||||
|
unsigned int data_len;
|
||||||
void *snmp_data;
|
void *snmp_data;
|
||||||
__u16 data_len;
|
|
||||||
|
|
||||||
QETH_CARD_TEXT(card, 3, "snpcmdcb");
|
QETH_CARD_TEXT(card, 3, "snpcmdcb");
|
||||||
|
|
||||||
cmd = (struct qeth_ipa_cmd *) sdata;
|
|
||||||
data = (unsigned char *)((char *)cmd - reply->offset);
|
|
||||||
qinfo = (struct qeth_arp_query_info *) reply->param;
|
|
||||||
|
|
||||||
if (cmd->hdr.return_code) {
|
if (cmd->hdr.return_code) {
|
||||||
QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code);
|
QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -4359,15 +4350,14 @@ static int qeth_snmp_command_cb(struct qeth_card *card,
|
||||||
QETH_CARD_TEXT_(card, 4, "scer2%x", cmd->hdr.return_code);
|
QETH_CARD_TEXT_(card, 4, "scer2%x", cmd->hdr.return_code);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
data_len = *((__u16 *)QETH_IPA_PDU_LEN_PDU1(data));
|
|
||||||
if (cmd->data.setadapterparms.hdr.seq_no == 1) {
|
adp_cmd = &cmd->data.setadapterparms;
|
||||||
snmp_data = &cmd->data.setadapterparms.data.snmp;
|
data_len = adp_cmd->hdr.cmdlength - sizeof(adp_cmd->hdr);
|
||||||
data_len -= offsetof(struct qeth_ipa_cmd,
|
if (adp_cmd->hdr.seq_no == 1) {
|
||||||
data.setadapterparms.data.snmp);
|
snmp_data = &adp_cmd->data.snmp;
|
||||||
} else {
|
} else {
|
||||||
snmp_data = &cmd->data.setadapterparms.data.snmp.request;
|
snmp_data = &adp_cmd->data.snmp.request;
|
||||||
data_len -= offsetof(struct qeth_ipa_cmd,
|
data_len -= offsetof(struct qeth_snmp_cmd, request);
|
||||||
data.setadapterparms.data.snmp.request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if there is enough room in userspace */
|
/* check if there is enough room in userspace */
|
||||||
|
|
Loading…
Reference in New Issue