Skip to contentSkip to conversation

cxgb4/cxgbvf: Handle 32-bit fw port capabilities

PATCH Applied Ganesh Goudar 2 participants 3 messages Aug 18, 2017 – Aug 20, 2017

Subsystems (4)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4/cxgbvf: Handle 32-bit fw port capabilities

Implement new 32-bit Firmware Port Capabilities in order to handle new speeds which couldn't be represented in the old 16-bit Firmware Port Capabilities values.

Based on the original work of Casey Leedom <[email protected]>

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h         |  43 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c |  98 ++--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c    |  88 ++--
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c         | 580 ++++++++++++++++-----
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h      | 175 ++++++-
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c    |  50 +-
 drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h |  86 +--
 drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c     | 456 +++++++++++++---
 8 files changed, 1220 insertions(+), 356 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +31 -12
index b9bff1d..ea72d2d 100644
@@ -104,13 +104,13 @@ enum dev_state {
 	DEV_STATE_ERR
 };
 
-enum {
+enum cc_pause {
 	PAUSE_RX      = 1 << 0,
 	PAUSE_TX      = 1 << 1,
 	PAUSE_AUTONEG = 1 << 2
 };
 
-enum {
+enum cc_fec {
 	FEC_AUTO      = 1 << 0,	 /* IEEE 802.3 "automatic" */
 	FEC_RS        = 1 << 1,  /* Reed-Solomon */
 	FEC_BASER_RS  = 1 << 2   /* BaseR/Reed-Solomon */
@@ -366,6 +366,7 @@ struct adapter_params {
 	unsigned int max_ordird_qp;       /* Max read depth per RDMA QP */
 	unsigned int max_ird_adapter;     /* Max read depth per adapter */
 	bool fr_nsmr_tpte_wr_support;	  /* FW support for FR_NSMR_TPTE_WR */
+	u8 fw_caps_support;		/* 32-bit Port Capabilities */
 
 	/* MPS Buffer Group Map[per Port].  Bit i is set if buffer group i is
 	 * used by the Port
@@ -439,18 +440,34 @@ struct trace_params {
 	unsigned char port;
 };
 
+/* Firmware Port Capabilities types. */
+
+typedef u16 fw_port_cap16_t;	/* 16-bit Port Capabilities integral value */
+typedef u32 fw_port_cap32_t;	/* 32-bit Port Capabilities integral value */
+
+enum fw_caps {
+	FW_CAPS_UNKNOWN	= 0,	/* 0'ed out initial state */
+	FW_CAPS16	= 1,	/* old Firmware: 16-bit Port Capabilities */
+	FW_CAPS32	= 2,	/* new Firmware: 32-bit Port Capabilities */
+};
+
 struct link_config {
-	unsigned short supported;        /* link capabilities */
-	unsigned short advertising;      /* advertised capabilities */
-	unsigned short lp_advertising;   /* peer advertised capabilities */
-	unsigned int   requested_speed;  /* speed user has requested */
-	unsigned int   speed;            /* actual link speed */
-	unsigned char  requested_fc;     /* flow control user has requested */
-	unsigned char  fc;               /* actual link flow control */
-	unsigned char  auto_fec;	 /* Forward Error Correction: */
-	unsigned char  requested_fec;	 /* "automatic" (IEEE 802.3), */
-	unsigned char  fec;		 /* requested, and actual in use */
+	fw_port_cap32_t pcaps;           /* link capabilities */
+	fw_port_cap32_t def_acaps;       /* default advertised capabilities */
+	fw_port_cap32_t acaps;           /* advertised capabilities */
+	fw_port_cap32_t lpacaps;         /* peer advertised capabilities */
+
+	fw_port_cap32_t speed_caps;      /* speed(s) user has requested */
+	unsigned int   speed;            /* actual link speed (Mb/s) */
+
+	enum cc_pause  requested_fc;     /* flow control user has requested */
+	enum cc_pause  fc;               /* actual link flow control */
+
+	enum cc_fec    requested_fec;	 /* Forward Error Correction: */
+	enum cc_fec    fec;		 /* requested and actual in use */
+
 	unsigned char  autoneg;          /* autonegotiating? */
+
 	unsigned char  link_ok;          /* link up? */
 	unsigned char  link_down_rc;     /* link down reason */
 };
@@ -1580,6 +1597,8 @@ int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
 int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
 void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl);
 int t4_update_port_info(struct port_info *pi);
+int t4_get_link_params(struct port_info *pi, unsigned int *link_okp,
+		       unsigned int *speedp, unsigned int *mtup);
 int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
 void t4_db_full(struct adapter *adapter);
 void t4_db_dropped(struct adapter *adapter);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +61 -37

214 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +40 -48

157 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +453 -127

762 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +174 -1

211 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +37 -13

112 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +54 -32

114 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +370 -86

523 lines not on this page · raw message

Signature · 1 line
2.1.0
maintainer
#2 lore raw

From: David Miller <[email protected]>
Date: Sat, 19 Aug 2017 21:32:40 -0700 (PDT)

Quoted 7 lines

From: Ganesh Goudar <[email protected]>
Date: Fri, 18 Aug 2017 21:21:32 +0530

Quoted 4 lines

Implement new 32-bit Firmware Port Capabilities in order to handle new speeds which couldn't be represented in the old 16-bit Firmware Port Capabilities values.

Quoted 5 lines
Quoted 3 lines

Based on the original work of Casey Leedom <[email protected]>

Applied.

Reverted, this doesn't even build!

[davem@localhost net-next]$ make -s -j8 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: In function ‘fwevtq_handler’:
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:534:50: error: expected ‘)’ before ‘{’ token

        action == FW_PORT_ACTION_GET_PORT_INFO32) {
                                                  ^

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:560:2: error: expected expression before ‘}’ token
} else if (opcode == CPL_L2T_WRITE_RPL) {
^
At top level:
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:463:13: warning: ‘dcb_rpl’ defined but not used [-Wunused-function]
static void dcb_rpl(struct adapter *adap, const struct fw_port_cmd *pcmd)

             ^~~~~~~

make[5]: *** [scripts/Makefile.build:303: drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.o] Error 1 make[5]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:561: drivers/net/ethernet/chelsio/cxgb4] Error 2 make[3]: *** [scripts/Makefile.build:561: drivers/net/ethernet/chelsio] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:561: drivers/net/ethernet] Error 2
make[1]: *** [scripts/Makefile.build:561: drivers/net] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1019: drivers] Error 2