Commit c9475369 authored by Thomas Richter's avatar Thomas Richter Committed by David S. Miller

s390/qeth: rework RX/TX checksum offload

Rework the RX/TX checksum offloading command sequence to use
the provided function call back mechanims to return card
data to the device driver.
Signed-off-by: default avatarThomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fcefa42f
...@@ -674,8 +674,6 @@ struct qeth_card_info { ...@@ -674,8 +674,6 @@ struct qeth_card_info {
int broadcast_capable; int broadcast_capable;
int unique_id; int unique_id;
struct qeth_card_blkt blkt; struct qeth_card_blkt blkt;
__u32 csum_mask;
__u32 tx_csum_mask;
enum qeth_ipa_promisc_modes promisc_mode; enum qeth_ipa_promisc_modes promisc_mode;
__u32 diagass_support; __u32 diagass_support;
__u32 hwtrap; __u32 hwtrap;
......
...@@ -5289,18 +5289,6 @@ int qeth_setassparms_cb(struct qeth_card *card, ...@@ -5289,18 +5289,6 @@ int qeth_setassparms_cb(struct qeth_card *card,
if (cmd->hdr.prot_version == QETH_PROT_IPV6) if (cmd->hdr.prot_version == QETH_PROT_IPV6)
card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
} }
if (cmd->data.setassparms.hdr.assist_no == IPA_INBOUND_CHECKSUM &&
cmd->data.setassparms.hdr.command_code == IPA_CMD_ASS_START) {
card->info.csum_mask = cmd->data.setassparms.data.flags_32bit;
QETH_CARD_TEXT_(card, 3, "csum:%d", card->info.csum_mask);
}
if (cmd->data.setassparms.hdr.assist_no == IPA_OUTBOUND_CHECKSUM &&
cmd->data.setassparms.hdr.command_code == IPA_CMD_ASS_START) {
card->info.tx_csum_mask =
cmd->data.setassparms.data.flags_32bit;
QETH_CARD_TEXT_(card, 3, "tcsu:%d", card->info.tx_csum_mask);
}
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(qeth_setassparms_cb); EXPORT_SYMBOL_GPL(qeth_setassparms_cb);
...@@ -6060,23 +6048,78 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, ...@@ -6060,23 +6048,78 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev,
} }
EXPORT_SYMBOL_GPL(qeth_core_ethtool_get_settings); EXPORT_SYMBOL_GPL(qeth_core_ethtool_get_settings);
/* Callback to handle checksum offload command reply from OSA card.
* Verify that required features have been enabled on the card.
* Return error in hdr->return_code as this value is checked by caller.
*
* Always returns zero to indicate no further messages from the OSA card.
*/
static int qeth_ipa_checksum_run_cmd_cb(struct qeth_card *card,
struct qeth_reply *reply,
unsigned long data)
{
struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
struct qeth_checksum_cmd *chksum_cb =
(struct qeth_checksum_cmd *)reply->param;
QETH_CARD_TEXT(card, 4, "chkdoccb");
if (cmd->hdr.return_code)
return 0;
memset(chksum_cb, 0, sizeof(*chksum_cb));
if (cmd->data.setassparms.hdr.command_code == IPA_CMD_ASS_START) {
chksum_cb->supported =
cmd->data.setassparms.data.chksum.supported;
QETH_CARD_TEXT_(card, 3, "strt:%x", chksum_cb->supported);
}
if (cmd->data.setassparms.hdr.command_code == IPA_CMD_ASS_ENABLE) {
chksum_cb->supported =
cmd->data.setassparms.data.chksum.supported;
chksum_cb->enabled =
cmd->data.setassparms.data.chksum.enabled;
QETH_CARD_TEXT_(card, 3, "supp:%x", chksum_cb->supported);
QETH_CARD_TEXT_(card, 3, "enab:%x", chksum_cb->enabled);
}
return 0;
}
/* Send command to OSA card and check results. */
static int qeth_ipa_checksum_run_cmd(struct qeth_card *card,
enum qeth_ipa_funcs ipa_func,
__u16 cmd_code, long data,
struct qeth_checksum_cmd *chksum_cb)
{
struct qeth_cmd_buffer *iob;
int rc = -ENOMEM;
QETH_CARD_TEXT(card, 4, "chkdocmd");
iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code,
sizeof(__u32), QETH_PROT_IPV4);
if (iob)
rc = qeth_send_setassparms(card, iob, sizeof(__u32), data,
qeth_ipa_checksum_run_cmd_cb,
chksum_cb);
return rc;
}
static int qeth_send_checksum_on(struct qeth_card *card, int cstype) static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
{ {
long rxtx_arg; struct qeth_checksum_cmd chksum_cb;
int rc; int rc;
rc = qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_START, 0); rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_START, 0,
&chksum_cb);
if (rc) { if (rc) {
qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_STOP, 0);
dev_warn(&card->gdev->dev, dev_warn(&card->gdev->dev,
"Starting HW checksumming for %s failed, using SW checksumming\n", "Starting HW checksumming for %s failed, using SW checksumming\n",
QETH_CARD_IFNAME(card)); QETH_CARD_IFNAME(card));
return rc; return rc;
} }
rxtx_arg = (cstype == IPA_OUTBOUND_CHECKSUM) ? card->info.tx_csum_mask rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_ENABLE,
: card->info.csum_mask; chksum_cb.supported, &chksum_cb);
rc = qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_ENABLE,
rxtx_arg);
if (rc) { if (rc) {
qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_STOP, 0);
dev_warn(&card->gdev->dev, dev_warn(&card->gdev->dev,
"Enabling HW checksumming for %s failed, using SW checksumming\n", "Enabling HW checksumming for %s failed, using SW checksumming\n",
QETH_CARD_IFNAME(card)); QETH_CARD_IFNAME(card));
...@@ -6090,19 +6133,10 @@ static int qeth_send_checksum_on(struct qeth_card *card, int cstype) ...@@ -6090,19 +6133,10 @@ static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
static int qeth_set_ipa_csum(struct qeth_card *card, int on, int cstype) static int qeth_set_ipa_csum(struct qeth_card *card, int on, int cstype)
{ {
int rc; int rc = (on) ? qeth_send_checksum_on(card, cstype)
: qeth_send_simple_setassparms(card, cstype,
if (on) {
rc = qeth_send_checksum_on(card, cstype);
if (rc)
return -EIO;
} else {
rc = qeth_send_simple_setassparms(card, cstype,
IPA_CMD_ASS_STOP, 0); IPA_CMD_ASS_STOP, 0);
if (rc) return rc ? -EIO : 0;
return -EIO;
}
return 0;
} }
static int qeth_set_ipa_tso(struct qeth_card *card, int on) static int qeth_set_ipa_tso(struct qeth_card *card, int on)
......
...@@ -352,11 +352,18 @@ struct qeth_arp_query_info { ...@@ -352,11 +352,18 @@ struct qeth_arp_query_info {
char *udata; char *udata;
}; };
/* IPA Assist checksum offload reply layout. */
struct qeth_checksum_cmd {
__u32 supported;
__u32 enabled;
} __packed;
/* SETASSPARMS IPA Command: */ /* SETASSPARMS IPA Command: */
struct qeth_ipacmd_setassparms { struct qeth_ipacmd_setassparms {
struct qeth_ipacmd_setassparms_hdr hdr; struct qeth_ipacmd_setassparms_hdr hdr;
union { union {
__u32 flags_32bit; __u32 flags_32bit;
struct qeth_checksum_cmd chksum;
struct qeth_arp_cache_entry add_arp_entry; struct qeth_arp_cache_entry add_arp_entry;
struct qeth_arp_query_data query_arp; struct qeth_arp_query_data query_arp;
__u8 ip[16]; __u8 ip[16];
......
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