Merge branch 's390-qeth-fixes'

Julian Wiedmann says:

====================
s390/qeth: fixes 2019-10-08

Alexandra fixes two issues in the initialization code for vnicc cmds.
One is an uninitialized variable when a cmd fails, the other that we
wouldn't recover correctly if the device's supported features changed.
====================

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
This commit is contained in:
Jakub Kicinski 2019-10-09 17:57:36 -07:00
commit 8cd6f4fe8f
1 changed files with 15 additions and 8 deletions

View File

@ -2021,10 +2021,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc,
static void qeth_l2_vnicc_init(struct qeth_card *card) static void qeth_l2_vnicc_init(struct qeth_card *card)
{ {
u32 *timeout = &card->options.vnicc.learning_timeout; u32 *timeout = &card->options.vnicc.learning_timeout;
bool enable, error = false;
unsigned int chars_len, i; unsigned int chars_len, i;
unsigned long chars_tmp; unsigned long chars_tmp;
u32 sup_cmds, vnicc; u32 sup_cmds, vnicc;
bool enable, error;
QETH_CARD_TEXT(card, 2, "vniccini"); QETH_CARD_TEXT(card, 2, "vniccini");
/* reset rx_bcast */ /* reset rx_bcast */
@ -2045,17 +2045,24 @@ static void qeth_l2_vnicc_init(struct qeth_card *card)
chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE; chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE;
for_each_set_bit(i, &chars_tmp, chars_len) { for_each_set_bit(i, &chars_tmp, chars_len) {
vnicc = BIT(i); vnicc = BIT(i);
qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds); if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) {
if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) || sup_cmds = 0;
!(sup_cmds & IPA_VNICC_GET_TIMEOUT)) error = true;
}
if ((sup_cmds & IPA_VNICC_SET_TIMEOUT) &&
(sup_cmds & IPA_VNICC_GET_TIMEOUT))
card->options.vnicc.getset_timeout_sup |= vnicc;
else
card->options.vnicc.getset_timeout_sup &= ~vnicc; card->options.vnicc.getset_timeout_sup &= ~vnicc;
if (!(sup_cmds & IPA_VNICC_ENABLE) || if ((sup_cmds & IPA_VNICC_ENABLE) &&
!(sup_cmds & IPA_VNICC_DISABLE)) (sup_cmds & IPA_VNICC_DISABLE))
card->options.vnicc.set_char_sup |= vnicc;
else
card->options.vnicc.set_char_sup &= ~vnicc; card->options.vnicc.set_char_sup &= ~vnicc;
} }
/* enforce assumed default values and recover settings, if changed */ /* enforce assumed default values and recover settings, if changed */
error = qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING,
timeout); timeout);
chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT; chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT;
chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE; chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE;
chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE; chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE;