From: Divy Le Ray <[email protected]>
Clean up FW version checking.
The supported FW version is now 3.1.
Signed-off-by: Divy Le Ray <[email protected]>
---
drivers/net/cxgb3/cxgb3_main.c | 15 ++++++++-------
drivers/net/cxgb3/firmware_exports.h | 27 +++++++++++++++++++++++++++
drivers/net/cxgb3/t3_hw.c | 17 ++++++++++++-----
3 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 54c49ac..8044146 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -665,11 +665,8 @@ static int cxgb_up(struct adapter *adap)
if (!(adap->flags & FULL_INIT_DONE)) {
err = t3_check_fw_version(adap);
- if (err) {
- dev_err(&adap->pdev->dev,
- "adapter FW is not compatible with driver\n");
+ if (err)
goto out;
- }
err = init_dummy_netdevs(adap);
if (err)
@@ -1002,10 +999,14 @@ static void get_drvinfo(struct net_devic
strcpy(info->bus_info, pci_name(adapter->pdev));
if (!fw_vers)
strcpy(info->fw_version, "N/A");
- else
+ else {
snprintf(info->fw_version, sizeof(info->fw_version),
- "%s %u.%u", (fw_vers >> 24) ? "T" : "N",
- (fw_vers >> 12) & 0xfff, fw_vers & 0xfff);
+ "%s %u.%u.%u",
+ G_FW_VERSION_TYPE(fw_vers) ? "T" : "N",
+ G_FW_VERSION_MAJOR(fw_vers),
+ G_FW_VERSION_MINOR(fw_vers),
+ G_FW_VERSION_MICRO(fw_vers));
+ }
}
static void get_strings(struct net_device *dev, u32 stringset, u8 * data)
diff --git a/drivers/net/cxgb3/firmware_exports.h b/drivers/net/cxgb3/firmware_exports.h
index 3565f48..eea7d89 100644
--- a/drivers/net/cxgb3/firmware_exports.h
+++ b/drivers/net/cxgb3/firmware_exports.h
@@ -141,4 +141,31 @@
#define FW_WRC_NUM \
(65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM)
+/*
+ * FW type and version.
+ */
+#define S_FW_VERSION_TYPE 28
+#define M_FW_VERSION_TYPE 0xF
+#define V_FW_VERSION_TYPE(x) ((x) << S_FW_VERSION_TYPE)
+#define G_FW_VERSION_TYPE(x) \
+ (((x) >> S_FW_VERSION_TYPE) & M_FW_VERSION_TYPE)
+
+#define S_FW_VERSION_MAJOR 16
+#define M_FW_VERSION_MAJOR 0xFFF
+#define V_FW_VERSION_MAJOR(x) ((x) << S_FW_VERSION_MAJOR)
+#define G_FW_VERSION_MAJOR(x) \
+ (((x) >> S_FW_VERSION_MAJOR) & M_FW_VERSION_MAJOR)
+
+#define S_FW_VERSION_MINOR 8
+#define M_FW_VERSION_MINOR 0xFF
+#define V_FW_VERSION_MINOR(x) ((x) << S_FW_VERSION_MINOR)
+#define G_FW_VERSION_MINOR(x) \
+ (((x) >> S_FW_VERSION_MINOR) & M_FW_VERSION_MINOR)
+
+#define S_FW_VERSION_MICRO 0
+#define M_FW_VERSION_MICRO 0xFF
+#define V_FW_VERSION_MICRO(x) ((x) << S_FW_VERSION_MICRO)
+#define G_FW_VERSION_MICRO(x) \
+ (((x) >> S_FW_VERSION_MICRO) & M_FW_VERSION_MICRO)
+
#endif /* _FIRMWARE_EXPORTS_H_ */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index a4e2e57..4545acb 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -826,6 +826,11 @@ static int t3_write_flash(struct adapter
return 0;
}
+enum fw_version_type {
+ FW_VERSION_N3,
+ FW_VERSION_T3
+};
+
/**
* t3_get_fw_version - read the firmware version
* @adapter: the adapter
@@ -849,19 +854,21 @@ int t3_check_fw_version(struct adapter *
{
int ret;
u32 vers;
+ unsigned int type, major, minor;
ret = t3_get_fw_version(adapter, &vers);
if (ret)
return ret;
- /* Minor 0xfff means the FW is an internal development-only version. */
- if ((vers & 0xfff) == 0xfff)
- return 0;
+ type = G_FW_VERSION_TYPE(vers);
+ major = G_FW_VERSION_MAJOR(vers);
+ minor = G_FW_VERSION_MINOR(vers);
- if (vers == 0x1002009)
+ if (type == FW_VERSION_T3 && major == 3 && minor == 1)
return 0;
- CH_ERR(adapter, "found wrong FW version, driver needs version 2.9\n");
+ CH_ERR(adapter, "found wrong FW version(%u.%u), "
+ "driver needs version 3.1\n", major, minor);
return -EINVAL;
}
You need to submit a patch to remove the following ioctls:
CHELSIO_SETREG:
CHELSIO_GETREG:
CHELSIO_SET_QSET_PARAMS: (use ethtool instead)
CHELSIO_GET_QSET_PARAMS: (use ethtool instead)
CHELSIO_SET_QSET_NUM: (use ethtool instead)
CHELSIO_GET_QSET_NUM: (use ethtool instead)
CHELSIO_SETMTUTAB:
CHELSIO_GET_MEM:
CHELSIO_SET_TRACE_FILTER:
CHELSIO_SET_PKTSCHED:
explain and possibly remove
CHELSIO_GET_PM:
CHELSIO_SET_PM:
honestly it looks like just about every ioctl except load-firmware should go
Divy Le Ray wrote:
> From: Divy Le Ray <[email protected]>
>
> Clean up FW version checking.
> The supported FW version is now 3.1.
>
> Signed-off-by: Divy Le Ray <[email protected]>
applies patches 1-7, 9-10 to #upstream
On Wed, Jan 31, 2007 at 05:40:02AM -0500, Jeff Garzik wrote:
> honestly it looks like just about every ioctl except load-firmware should go
And while we're at it a load-firmware sounds like a nice addition for
ethtool aswell. Or we may want to extent the firmware loader to deal with
updating firmware in addition to loading it to rom-less devices.
Christoph Hellwig wrote:
> On Wed, Jan 31, 2007 at 05:40:02AM -0500, Jeff Garzik wrote:
>> honestly it looks like just about every ioctl except load-firmware should go
>
> And while we're at it a load-firmware sounds like a nice addition for
> ethtool aswell. Or we may want to extent the firmware loader to deal with
> updating firmware in addition to loading it to rom-less devices.
Agreed.
Jeff
Hi Jeff,
Please see my replies in line.
> You need to submit a patch to remove the following ioctls:
>
> CHELSIO_SETREG:
> CHELSIO_GETREG:
These will get removed.
> CHELSIO_SET_QSET_PARAMS: (use ethtool instead)
> CHELSIO_GET_QSET_PARAMS: (use ethtool instead)
The T3 adapter supports multiple Tx/Rx queue sets,
each can be can individually configured through these ioctls.
ethtool is not adequate replacement because it can't configure
each queue individually on such a device. We'd love it if ethtool
were to be extended to provide good support for multi queue devices.
> CHELSIO_SET_QSET_NUM: (use ethtool instead)
> CHELSIO_GET_QSET_NUM: (use ethtool instead)
These are used to set the number of queue sets per port.
That also could be integrated in ethtool if extended
to add support for multiple queue devices.
We could alternatively use a sysfs attribute.
> CHELSIO_SETMTUTAB:
This one is needed to setup the device for RDMA.
> CHELSIO_GET_MEM:
This one is used for field diagnostics.
It dumps the state of on-card memory.
> CHELSIO_SET_TRACE_FILTER:
This one is used for RDMA.
It allows to see the ethernet packets the RDMA function
puts on the wire/receives from the wire.
> CHELSIO_SET_PKTSCHED:
This one binds a queue set to a port.
It could be turned to a sysfs attribute.
>
> explain and possibly remove
>
> CHELSIO_GET_PM:
> CHELSIO_SET_PM:
These are used to configure the on-card memory (tx/rx size
and number of pages). They could be turned into sysfs attributes.
Cheers,
Divy