Commit 72d5e850 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: de-magic the QIB parm area

Use a proper struct, and only program the QIB extensions for devices
where they are supported.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bb5ab541
...@@ -278,6 +278,17 @@ struct qeth_hdr { ...@@ -278,6 +278,17 @@ struct qeth_hdr {
} hdr; } hdr;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct qeth_qib_parms {
char pcit_magic[4];
u32 pcit_a;
u32 pcit_b;
u32 pcit_c;
char blkt_magic[4];
u32 blkt_total;
u32 blkt_inter_packet;
u32 blkt_inter_packet_jumbo;
};
/*TCP Segmentation Offload header*/ /*TCP Segmentation Offload header*/
struct qeth_hdr_ext_tso { struct qeth_hdr_ext_tso {
__u16 hdr_tot_len; __u16 hdr_tot_len;
......
...@@ -2743,30 +2743,26 @@ static void qeth_free_qdio_queues(struct qeth_card *card) ...@@ -2743,30 +2743,26 @@ static void qeth_free_qdio_queues(struct qeth_card *card)
} }
} }
static void qeth_create_qib_param_field(struct qeth_card *card, static void qeth_fill_qib_parms(struct qeth_card *card,
char *param_field) struct qeth_qib_parms *parms)
{ {
parms->pcit_magic[0] = 'P';
param_field[0] = _ascebc['P']; parms->pcit_magic[1] = 'C';
param_field[1] = _ascebc['C']; parms->pcit_magic[2] = 'I';
param_field[2] = _ascebc['I']; parms->pcit_magic[3] = 'T';
param_field[3] = _ascebc['T']; ASCEBC(parms->pcit_magic, sizeof(parms->pcit_magic));
*((unsigned int *) (&param_field[4])) = QETH_PCI_THRESHOLD_A(card); parms->pcit_a = QETH_PCI_THRESHOLD_A(card);
*((unsigned int *) (&param_field[8])) = QETH_PCI_THRESHOLD_B(card); parms->pcit_b = QETH_PCI_THRESHOLD_B(card);
*((unsigned int *) (&param_field[12])) = QETH_PCI_TIMER_VALUE(card); parms->pcit_c = QETH_PCI_TIMER_VALUE(card);
}
parms->blkt_magic[0] = 'B';
static void qeth_create_qib_param_field_blkt(struct qeth_card *card, parms->blkt_magic[1] = 'L';
char *param_field) parms->blkt_magic[2] = 'K';
{ parms->blkt_magic[3] = 'T';
param_field[16] = _ascebc['B']; ASCEBC(parms->blkt_magic, sizeof(parms->blkt_magic));
param_field[17] = _ascebc['L']; parms->blkt_total = card->info.blkt.time_total;
param_field[18] = _ascebc['K']; parms->blkt_inter_packet = card->info.blkt.inter_packet;
param_field[19] = _ascebc['T']; parms->blkt_inter_packet_jumbo = card->info.blkt.inter_packet_jumbo;
*((unsigned int *) (&param_field[20])) = card->info.blkt.time_total;
*((unsigned int *) (&param_field[24])) = card->info.blkt.inter_packet;
*((unsigned int *) (&param_field[28])) =
card->info.blkt.inter_packet_jumbo;
} }
static int qeth_qdio_activate(struct qeth_card *card) static int qeth_qdio_activate(struct qeth_card *card)
...@@ -5022,21 +5018,20 @@ static int qeth_qdio_establish(struct qeth_card *card) ...@@ -5022,21 +5018,20 @@ static int qeth_qdio_establish(struct qeth_card *card)
{ {
struct qdio_buffer **out_sbal_ptrs[QETH_MAX_OUT_QUEUES]; struct qdio_buffer **out_sbal_ptrs[QETH_MAX_OUT_QUEUES];
struct qdio_buffer **in_sbal_ptrs[QETH_MAX_IN_QUEUES]; struct qdio_buffer **in_sbal_ptrs[QETH_MAX_IN_QUEUES];
struct qeth_qib_parms *qib_parms = NULL;
struct qdio_initialize init_data; struct qdio_initialize init_data;
char *qib_param_field;
unsigned int i; unsigned int i;
int rc = 0; int rc = 0;
QETH_CARD_TEXT(card, 2, "qdioest"); QETH_CARD_TEXT(card, 2, "qdioest");
qib_param_field = kzalloc(sizeof_field(struct qib, parm), GFP_KERNEL); if (!IS_IQD(card) && !IS_VM_NIC(card)) {
if (!qib_param_field) { qib_parms = kzalloc(sizeof_field(struct qib, parm), GFP_KERNEL);
rc = -ENOMEM; if (!qib_parms)
goto out_free_nothing; return -ENOMEM;
}
qeth_create_qib_param_field(card, qib_param_field); qeth_fill_qib_parms(card, qib_parms);
qeth_create_qib_param_field_blkt(card, qib_param_field); }
in_sbal_ptrs[0] = card->qdio.in_q->qdio_bufs; in_sbal_ptrs[0] = card->qdio.in_q->qdio_bufs;
if (card->options.cq == QETH_CQ_ENABLED) if (card->options.cq == QETH_CQ_ENABLED)
...@@ -5049,7 +5044,7 @@ static int qeth_qdio_establish(struct qeth_card *card) ...@@ -5049,7 +5044,7 @@ static int qeth_qdio_establish(struct qeth_card *card)
init_data.q_format = IS_IQD(card) ? QDIO_IQDIO_QFMT : init_data.q_format = IS_IQD(card) ? QDIO_IQDIO_QFMT :
QDIO_QETH_QFMT; QDIO_QETH_QFMT;
init_data.qib_param_field_format = 0; init_data.qib_param_field_format = 0;
init_data.qib_param_field = qib_param_field; init_data.qib_param_field = (void *)qib_parms;
init_data.no_input_qs = card->qdio.no_in_queues; init_data.no_input_qs = card->qdio.no_in_queues;
init_data.no_output_qs = card->qdio.no_out_queues; init_data.no_output_qs = card->qdio.no_out_queues;
init_data.input_handler = qeth_qdio_input_handler; init_data.input_handler = qeth_qdio_input_handler;
...@@ -5086,9 +5081,9 @@ static int qeth_qdio_establish(struct qeth_card *card) ...@@ -5086,9 +5081,9 @@ static int qeth_qdio_establish(struct qeth_card *card)
default: default:
break; break;
} }
out: out:
kfree(qib_param_field); kfree(qib_parms);
out_free_nothing:
return rc; return rc;
} }
......
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