[PATCH 2/2] net/ncsi: Query channel parameters during configuration

Samuel Mendoza-Jonas sam at mendozajonas.com
Mon Nov 6 14:13:23 AEDT 2017


Send a Get-Parameters command during configuration to ensure the remote
channel configuration reflects what we expect.

Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
 net/ncsi/internal.h    |  1 +
 net/ncsi/ncsi-manage.c |  4 ++++
 net/ncsi/ncsi-rsp.c    | 21 +++++++++++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
index d30f7bd741d0..d2ccc9a6ced1 100644
--- a/net/ncsi/internal.h
+++ b/net/ncsi/internal.h
@@ -248,6 +248,7 @@ enum {
 	ncsi_dev_state_config_ec,
 	ncsi_dev_state_config_ae,
 	ncsi_dev_state_config_gls,
+	ncsi_dev_state_config_gp,
 	ncsi_dev_state_config_done,
 	ncsi_dev_state_suspend_select	= 0x0401,
 	ncsi_dev_state_suspend_gls,
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 6fd90415b2a2..2b8e3a102c45 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -809,6 +809,7 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
 	case ncsi_dev_state_config_ec:
 	case ncsi_dev_state_config_ae:
 	case ncsi_dev_state_config_gls:
+	case ncsi_dev_state_config_gp:
 		ndp->pending_req_num = 1;
 
 		nca.package = np->id;
@@ -886,6 +887,9 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
 			nd->state = ncsi_dev_state_config_gls;
 		} else if (nd->state == ncsi_dev_state_config_gls) {
 			nca.type = NCSI_PKT_CMD_GLS;
+			nd->state = ncsi_dev_state_config_gp;
+		} else if (nd->state == ncsi_dev_state_config_gp) {
+			nca.type = NCSI_PKT_CMD_GP;
 			nd->state = ncsi_dev_state_config_done;
 		}
 
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index 58186c4102f0..b5446441b195 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -724,6 +724,16 @@ static int ncsi_rsp_handler_gp(struct ncsi_request *nr)
 	if (!nc)
 		return -ENODEV;
 
+	netdev_info(ndp->ndev.dev, "NCSI: Channel %u Parameters:\n", nc->id);
+	netdev_info(ndp->ndev.dev, "NCSI: Channel %s\n",
+		    ntohl(rsp->valid_modes) & 0x2 ? "enabled" : "disabled");
+	netdev_info(ndp->ndev.dev, "NCSI: BPF %s\n",
+		    ntohl(rsp->valid_modes) & 0x1 ? "enabled" : "disabled");
+	netdev_info(ndp->ndev.dev, "NCSI: TX %s\n",
+		    ntohl(rsp->valid_modes) & 0x4 ? "enabled" : "disabled");
+	netdev_info(ndp->ndev.dev, "NCSI: MPF %s\n",
+		    ntohl(rsp->valid_modes) & 0x8 ? "enabled" : "disabled");
+
 	/* Modes with explicit enabled indications */
 	if (ntohl(rsp->valid_modes) & 0x1) {	/* BC filter mode */
 		nc->modes[NCSI_MODE_BC].enable = 1;
@@ -746,6 +756,17 @@ static int ncsi_rsp_handler_gp(struct ncsi_request *nr)
 	nc->modes[NCSI_MODE_AEN].enable = 1;
 	nc->modes[NCSI_MODE_AEN].data[0] = ntohl(rsp->aen_mode);
 
+	netdev_info(ndp->ndev.dev, "NCSI: link settings %08x\n",
+		    ntohl(rsp->link_mode));
+	netdev_info(ndp->ndev.dev, "NCSI: MAC address count %08x\n",
+		    rsp->mac_cnt);
+	netdev_info(ndp->ndev.dev, "NCSI: MAC address 1 %s\n",
+		    rsp->mac_enable & 0x1 ? "enabled" : "disabled");
+	netdev_info(ndp->ndev.dev,
+		    "NCSI: MAC address 1 %02x:%02x:%02x:%02x:%02x:%02x\n",
+		    rsp->mac[0], rsp->mac[1], rsp->mac[2],
+		    rsp->mac[3], rsp->mac[4], rsp->mac[5]);
+
 	/* MAC addresses filter table */
 	pdata = (unsigned char *)rsp + 48;
 	enable = rsp->mac_enable;
-- 
2.14.3



More information about the openbmc mailing list