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

Message ID 20171108003533.13248-3-sam@mendozajonas.com
State New
Headers show
Series
  • Improve NCSI driver logging
Related show

Commit Message

Samuel Mendoza-Jonas Nov. 8, 2017, 12:35 a.m.
Send a Get-Parameters command during configuration to ensure the remote
channel configuration reflects what we expect.

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

Patch

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 97b76f26bde7..faab04625ccb 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -807,6 +807,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;
@@ -884,6 +885,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..a7289c2d3870 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -724,6 +724,17 @@  static int ncsi_rsp_handler_gp(struct ncsi_request *nr)
 	if (!nc)
 		return -ENODEV;
 
+	netdev_printk(KERN_DEBUG, ndp->ndev.dev,
+		      "NCSI: Channel %u Parameters:\n", nc->id);
+	netdev_printk(KERN_DEBUG, ndp->ndev.dev, "NCSI: Channel %s\n",
+		      ntohl(rsp->valid_modes) & 0x2 ? "enabled" : "disabled");
+	netdev_printk(KERN_DEBUG, ndp->ndev.dev, "NCSI: BPF %s\n",
+		      ntohl(rsp->valid_modes) & 0x1 ? "enabled" : "disabled");
+	netdev_printk(KERN_DEBUG, ndp->ndev.dev, "NCSI: TX %s\n",
+		      ntohl(rsp->valid_modes) & 0x4 ? "enabled" : "disabled");
+	netdev_printk(KERN_DEBUG, 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 +757,18 @@  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_printk(KERN_DEBUG, ndp->ndev.dev, "NCSI: link settings %08x\n",
+		      ntohl(rsp->link_mode));
+	netdev_printk(KERN_DEBUG, ndp->ndev.dev,
+		      "NCSI: MAC address count %08x\n",
+		      rsp->mac_cnt);
+	netdev_printk(KERN_DEBUG, ndp->ndev.dev, "NCSI: MAC address 1 %s\n",
+		      rsp->mac_enable & 0x1 ? "enabled" : "disabled");
+	netdev_printk(KERN_DEBUG, 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;