Skip to content

Commit

Permalink
net/ncsi: Disable HWA mode when no channels are found
Browse files Browse the repository at this point in the history
When there are no NCSI channels probed, HWA (Hardware Arbitration)
mode is enabled. It's not correct because HWA depends on the fact:
NCSI channels exist and all of them support HWA mode. This disables
HWA when no channels are probed.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gavin Shan authored and David S. Miller committed Oct 21, 2017
1 parent 0795fb2 commit 100ef01
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions net/ncsi/ncsi-manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,12 +1005,15 @@ static bool ncsi_check_hwa(struct ncsi_dev_priv *ndp)
struct ncsi_package *np;
struct ncsi_channel *nc;
unsigned int cap;
bool has_channel = false;

/* The hardware arbitration is disabled if any one channel
* doesn't support explicitly.
*/
NCSI_FOR_EACH_PACKAGE(ndp, np) {
NCSI_FOR_EACH_CHANNEL(np, nc) {
has_channel = true;

cap = nc->caps[NCSI_CAP_GENERIC].cap;
if (!(cap & NCSI_CAP_GENERIC_HWA) ||
(cap & NCSI_CAP_GENERIC_HWA_MASK) !=
Expand All @@ -1021,8 +1024,13 @@ static bool ncsi_check_hwa(struct ncsi_dev_priv *ndp)
}
}

ndp->flags |= NCSI_DEV_HWA;
return true;
if (has_channel) {
ndp->flags |= NCSI_DEV_HWA;
return true;
}

ndp->flags &= ~NCSI_DEV_HWA;
return false;
}

static int ncsi_enable_hwa(struct ncsi_dev_priv *ndp)
Expand Down

0 comments on commit 100ef01

Please sign in to comment.