Page MenuHomeFreeBSD

D59573.id186387.diff
No OneTemporary

D59573.id186387.diff

Index: sys/dev/bnxt/bnxt_en/if_bnxt.c
===================================================================
--- sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -390,7 +390,11 @@
.isc_magic = IFLIB_MAGIC,
.isc_driver = &bnxt_iflib_driver,
.isc_nfl = 2,
+#ifdef IFLIB_I2C_PAGE_BANK
+ .isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ | IFLIB_NEED_ETHER_PAD | IFLIB_I2C_PAGE_BANK,
+#else
.isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ | IFLIB_NEED_ETHER_PAD,
+#endif
.isc_q_align = PAGE_SIZE,
.isc_tx_maxsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
@@ -419,7 +423,11 @@
.isc_magic = IFLIB_MAGIC,
.isc_driver = &bnxt_iflib_driver,
.isc_nfl = 2,
+#ifdef IFLIB_I2C_PAGE_BANK
+ .isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ | IFLIB_NEED_ETHER_PAD | IFLIB_I2C_PAGE_BANK,
+#else
.isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ | IFLIB_NEED_ETHER_PAD,
+#endif
.isc_q_align = PAGE_SIZE,
.isc_tx_maxsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
@@ -5198,16 +5206,43 @@
*/
if (softc->link_info.module_status >
HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_WARNINGMSG)
- return -EOPNOTSUPP;
+ return EOPNOTSUPP;
/* This feature is not supported in older firmware versions */
if (!BNXT_CHIP_P5_PLUS(softc) ||
(softc->hwrm_spec_code < 0x10202))
- return -EOPNOTSUPP;
+ return EOPNOTSUPP;
- rc = bnxt_read_sfp_module_eeprom_info(softc, i2c->dev_addr, 0, 0, 0,
- i2c->offset, i2c->len, data);
+#ifdef IFLIB_I2C_PAGE_BANK
+ /*
+ * linux/page.h (pulled in transitively via linux/gfp.h above, for
+ * the Linux compat shims still used elsewhere in this file)
+ * #defines page to vm_page, which would otherwise mangle i2c->page
+ * into i2c->vm_page below - a compile error, since struct ifi2creq
+ * has no such member. Undef it only for this statement and restore
+ * it immediately after, rather than leaving it undefined for the
+ * rest of the translation unit.
+ */
+#undef page
+ /*
+ * struct ifi2creq (sys/net/if.h) has no bank_sel_en field, so a
+ * caller requesting bank 0 has no way to ask for bank-select to be
+ * explicitly enabled anyway (some early CMIS implementations
+ * distinguish "bank 0, unselected" from "bank 0, selected"); this
+ * derivation can only express the common case where bank 0 needs
+ * no explicit selection. Pre-existing struct limitation, not
+ * something this driver can address on its own.
+ */
+ rc = bnxt_read_sfp_module_eeprom_info(softc, i2c->dev_addr,
+ i2c->page, i2c->bank, i2c->bank != 0,
+ i2c->offset, i2c->len, data);
+#define page vm_page
+#else
+ rc = bnxt_read_sfp_module_eeprom_info(softc, i2c->dev_addr,
+ 0, 0, 0,
+ i2c->offset, i2c->len, data);
+#endif
return rc;
}

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 14, 9:07 PM (9 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40819629
Default Alt Text
D59573.id186387.diff (2 KB)

Event Timeline