Message ID | 1440608435-12039-1-git-send-email-hariprasad@chelsio.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Hariprasad Shenai <hariprasad@chelsio.com> Date: Wed, 26 Aug 2015 22:30:35 +0530 > If adapter is flashed with incorrect firmware, probe can fail. > If probe fails, continue in debug mode, so one can also use the debug > interface to update the firmware via ethtool. > > Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> If the init fails, there are all of these software datastructure that have not been allocated at all which ->open() blindly assumes it can dereference. Sorry, you're going to have to do a lot more work than this to allow this situation to proceed. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 26, 2015 at 10:30:35PM +0530, Hariprasad Shenai wrote: > If adapter is flashed with incorrect firmware, probe can fail. > If probe fails, continue in debug mode, so one can also use the debug > interface to update the firmware via ethtool. > > Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> What do you mean by incorrect firmware? I know the driver can cope with older firmware if force_old_init is used, for example. Isn't it possible to detect those old firmware versions and do the same as force_old_init does? Cascardo. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Aug 27, 2015 at 16:14:34 -0300, Thadeu Lima de Souza Cascardo wrote: > On Wed, Aug 26, 2015 at 10:30:35PM +0530, Hariprasad Shenai wrote: > > If adapter is flashed with incorrect firmware, probe can fail. > > If probe fails, continue in debug mode, so one can also use the debug > > interface to update the firmware via ethtool. > > > > Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> > > What do you mean by incorrect firmware? I know the driver can cope with older > firmware if force_old_init is used, for example. Isn't it possible to detect > those old firmware versions and do the same as force_old_init does? > > Cascardo. Will add a code to check and upgrade for older FW which are not supported anymore. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index f35dd22..422765d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -4726,12 +4726,13 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) setup_memwin(adapter); err = adap_init0(adapter); + if (err) + dev_err(&pdev->dev, "Adapter initialization failed, error %d. " + "Continuing in debug mode\n", -err); #ifdef CONFIG_DEBUG_FS bitmap_zero(adapter->sge.blocked_fl, adapter->sge.egr_sz); #endif setup_memwin_rdma(adapter); - if (err) - goto out_unmap_bar; for_each_port(adapter, i) { struct net_device *netdev; @@ -4799,6 +4800,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * soon as the first register_netdev completes. */ cfg_queues(adapter); + if (!(adapter->flags & FW_OK)) + goto fw_attach_fail; adapter->l2t = t4_init_l2t(adapter->l2t_start, adapter->l2t_end); if (!adapter->l2t) { @@ -4851,6 +4854,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto out_free_dev; +fw_attach_fail: /* * The card is now ready to go. If any errors occur during device * registration we do not fail the whole card but rather proceed only @@ -4901,7 +4905,6 @@ sriov: out_free_dev: free_some_resources(adapter); - out_unmap_bar: if (!is_t4(adapter->params.chip)) iounmap(adapter->bar2); out_free_adapter:
If adapter is flashed with incorrect firmware, probe can fail. If probe fails, continue in debug mode, so one can also use the debug interface to update the firmware via ethtool. Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)