From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: RE: [PATCH net-next v2 6/6] net/ncsi: Configure multi-package, multi-channel modes with failover Date: Fri, 26 Oct 2018 21:48:58 +0000 Message-ID: <93324b3c0a9b4929aa64801b4ed9c25c@AUSX13MPS306.AMER.DELL.COM> References: <20181023215201.27315-1-sam@mendozajonas.com> <20181023215201.27315-7-sam@mendozajonas.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: , , To: , Return-path: In-Reply-To: <20181023215201.27315-7-sam@mendozajonas.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Hi Samuel, There is one place that we assume the next available TX channel is under th= e 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 =3D 0; > + > + if (!np->multi_channel) > + netdev_warn(ndp->ndev.dev, > + "NCSI: Trying to update Tx channel in single-channel mode\n"); > + nca.ndp =3D ndp; > + nca.package =3D np->id; If the channel may be on different package, the package ID here may not be = correct in some cases. > + nca.req_flags =3D 0; > + > + /* Find current channel with Tx enabled */ > + if (!disable) { > + NCSI_FOR_EACH_CHANNEL(np, nc) > + if (nc->modes[NCSI_MODE_TX_ENABLE].enable) > + disable =3D nc; > + } > + > + /* Find a suitable channel for Tx */ > + if (!enable) { > + if (np->preferred_channel && > + ncsi_channel_has_link(np->preferred_channel)) { > + enable =3D np->preferred_channel; > + } else { > + NCSI_FOR_EACH_CHANNEL(np, nc) { > + if (!(np->channel_whitelist & 0x1 << nc->id)) > + continue; > + if (nc->state !=3D NCSI_CHANNEL_ACTIVE) > + continue; > + if (ncsi_channel_has_link(nc)) { > + enable =3D nc; > + break; > + } > + } When we search, we need to consider the other available channel might be on= the package. > + } > + } > + > + if (disable =3D=3D enable) > + return -1; > + > + if (!enable) > + return -1; > + > + if (disable) { > + nca.channel =3D disable->id; > + nca.type =3D NCSI_PKT_CMD_DCNT; > + ret =3D 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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