lkml.org 
[lkml]   [2018]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH net-next v2 6/6] net/ncsi: Configure multi-package, multi-channel modes with failover
Date
Hi Samuel,

There is one place that we assume the next available TX channel is under the same package.
Please see the comment below.

Thanks,
Justin


+/* Change the active Tx channel in a multi-channel setup */
+int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp,
> + struct ncsi_package *np,
> + struct ncsi_channel *disable,
> + struct ncsi_channel *enable)
> +{
> + struct ncsi_cmd_arg nca;
> + struct ncsi_channel *nc;
> + int ret = 0;
> +
> + if (!np->multi_channel)
> + netdev_warn(ndp->ndev.dev,
> + "NCSI: Trying to update Tx channel in single-channel mode\n");
> + nca.ndp = ndp;
> + nca.package = np->id;

If the channel may be on different package, the package ID here may not be correct
in some cases.

> + nca.req_flags = 0;
> +
> + /* Find current channel with Tx enabled */
> + if (!disable) {
> + NCSI_FOR_EACH_CHANNEL(np, nc)
> + if (nc->modes[NCSI_MODE_TX_ENABLE].enable)
> + disable = nc;
> + }
> +
> + /* Find a suitable channel for Tx */
> + if (!enable) {
> + if (np->preferred_channel &&
> + ncsi_channel_has_link(np->preferred_channel)) {
> + enable = np->preferred_channel;
> + } else {
> + NCSI_FOR_EACH_CHANNEL(np, nc) {
> + if (!(np->channel_whitelist & 0x1 << nc->id))
> + continue;
> + if (nc->state != NCSI_CHANNEL_ACTIVE)
> + continue;
> + if (ncsi_channel_has_link(nc)) {
> + enable = nc;
> + break;
> + }
> + }

When we search, we need to consider the other available channel might be on the
package.

> + }
> + }
> +
> + if (disable == enable)
> + return -1;
> +
> + if (!enable)
> + return -1;
> +
> + if (disable) {
> + nca.channel = disable->id;
> + nca.type = NCSI_PKT_CMD_DCNT;
> + ret = ncsi_xmit_cmd(&nca);
> + if (ret)
> + netdev_err(ndp->ndev.dev,
> + "Error %d sending DCNT\n",
> + ret);
> + }

I remove the cable from ncsi0 and it doesn't failover to ncsi3 as ncsi0 and ncsi3 are not under
the same package.

cat /sys/kernel/debug/ncsi_protocol/ncsi_device_
IFIDX IFNAME NAME PID CID RX TX MP MC WP WC PC CS PS LS RU CR NQ HA
======================================================================
2 eth2 ncsi0 000 000 1 1 1 1 1 1 1 3 0 0 1 1 0 1
2 eth2 ncsi1 000 001 0 0 1 1 1 0 0 1 0 1 1 1 0 1
2 eth2 ncsi2 001 000 0 0 1 1 1 0 0 1 0 1 1 1 0 1
2 eth2 ncsi3 001 001 1 0 1 1 1 1 0 2 1 1 1 1 0 1
======================================================================
MP: Multi-mode Package WP: Whitelist Package
MC: Multi-mode Channel WC: Whitelist Channel
PC: Primary Channel CS: Channel State
PS: Poll Status LS: Link Status
RU: Running CR: Carrier OK
NQ: Queue Stopped HA: Hardware Arbitration

\
 
 \ /
  Last update: 2018-10-26 23:49    [W:0.090 / U:2.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site