netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ameen.rahman@qlogic.com,
	Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Subject: [PATCH NEXT 7/9] qlcnic: check device class
Date: Thu, 13 May 2010 06:07:48 -0700	[thread overview]
Message-ID: <1273756070-7205-8-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1273756070-7205-1-git-send-email-amit.salecha@qlogic.com>

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

pci-func class can be other than ethernet in Qlogic CNA device.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h      |    2 +-
 drivers/net/qlcnic/qlcnic_init.c |   16 +++++++++++++++-
 drivers/net/qlcnic/qlcnic_main.c |    8 ++------
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 8a9412f..5c89f4e 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -1037,7 +1037,7 @@ int qlcnic_need_fw_reset(struct qlcnic_adapter *adapter);
 void qlcnic_request_firmware(struct qlcnic_adapter *adapter);
 void qlcnic_release_firmware(struct qlcnic_adapter *adapter);
 int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter);
-void qlcnic_setup_idc_param(struct qlcnic_adapter *adapter);
+int qlcnic_setup_idc_param(struct qlcnic_adapter *adapter);
 
 int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, int addr, int *valp);
 int qlcnic_rom_fast_read_words(struct qlcnic_adapter *adapter, int addr,
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index c4bef57..77bfdab 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -514,10 +514,22 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter)
 	return 0;
 }
 
-void
+int
 qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
 
 	int timeo;
+	u32 val;
+
+	val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
+	val = (val >> (adapter->portnum * 4)) & 0xf;
+
+	if ((val & 0x3) != 1) {
+		dev_err(&adapter->pdev->dev, "Not an Ethernet NIC func=%u\n",
+									val);
+		return -EIO;
+	}
+
+	adapter->physical_port = (val >> 2);
 
 	if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
 		timeo = 30;
@@ -528,6 +540,8 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
 		timeo = 10;
 
 	adapter->reset_ack_timeo = timeo;
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index e94a96d..ce57229 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -1081,17 +1081,13 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto err_out_iounmap;
 	}
 
-	qlcnic_setup_idc_param(adapter);
+	if (qlcnic_setup_idc_param(adapter))
+		goto err_out_iounmap;
 
 	err = qlcnic_start_firmware(adapter);
 	if (err)
 		goto err_out_decr_ref;
 
-	/*
-	 * See if the firmware gave us a virtual-physical port mapping.
-	 */
-	adapter->physical_port = adapter->portnum;
-
 	qlcnic_clear_stats(adapter);
 
 	qlcnic_setup_intr(adapter);
-- 
1.6.0.2


  parent reply	other threads:[~2010-05-13 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 13:07 [PATCH 0/9]qlcnic: cleanup Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 1/9] qlcnic: fix context cleanup Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 2/9] qlcnic: remove obsolete register Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 3/9] qlcnic: fix caching window register Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 4/9] qlcnic: cleanup dma mask setting Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 5/9] qlcnic: cleanup unused code Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 6/9] qlcnic: check IDC version Amit Kumar Salecha
2010-05-13 13:07 ` Amit Kumar Salecha [this message]
2010-05-13 13:07 ` [PATCH NEXT 8/9] qlcnic: support quisce mode Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 9/9] qlcnic: add idc debug registers Amit Kumar Salecha
2010-05-14 10:15 ` [PATCH 0/9]qlcnic: cleanup David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273756070-7205-8-git-send-email-amit.salecha@qlogic.com \
    --to=amit.salecha@qlogic.com \
    --cc=ameen.rahman@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sucheta.chakraborty@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).