Commit da48e6c3 authored by Rajesh Borundia's avatar Rajesh Borundia Committed by David S. Miller

qlcnic: fix mac addr read

o Mac addr was read from flash for every fw reset
for Non-priviledge function.It should be read only once.
o Remove unnecessary get_mac_addr callback
Signed-off-by: default avatarRajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2cffcdbf
...@@ -1259,7 +1259,6 @@ int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable); ...@@ -1259,7 +1259,6 @@ int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable);
int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter); int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter);
void qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter, void qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter,
struct qlcnic_host_tx_ring *tx_ring); struct qlcnic_host_tx_ring *tx_ring);
int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u8 *mac);
void qlcnic_clear_ilb_mode(struct qlcnic_adapter *adapter); void qlcnic_clear_ilb_mode(struct qlcnic_adapter *adapter);
int qlcnic_set_ilb_mode(struct qlcnic_adapter *adapter); int qlcnic_set_ilb_mode(struct qlcnic_adapter *adapter);
void qlcnic_fetch_mac(struct qlcnic_adapter *, u32, u32, u8, u8 *); void qlcnic_fetch_mac(struct qlcnic_adapter *, u32, u32, u8, u8 *);
...@@ -1346,7 +1345,6 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring) ...@@ -1346,7 +1345,6 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring)
extern const struct ethtool_ops qlcnic_ethtool_ops; extern const struct ethtool_ops qlcnic_ethtool_ops;
struct qlcnic_nic_template { struct qlcnic_nic_template {
int (*get_mac_addr) (struct qlcnic_adapter *, u8*);
int (*config_bridged_mode) (struct qlcnic_adapter *, u32); int (*config_bridged_mode) (struct qlcnic_adapter *, u32);
int (*config_led) (struct qlcnic_adapter *, u32, u32); int (*config_led) (struct qlcnic_adapter *, u32, u32);
int (*start_firmware) (struct qlcnic_adapter *); int (*start_firmware) (struct qlcnic_adapter *);
......
...@@ -715,19 +715,6 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) ...@@ -715,19 +715,6 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu)
return rc; return rc;
} }
int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u8 *mac)
{
u32 crbaddr;
int pci_func = adapter->ahw.pci_func;
crbaddr = CRB_MAC_BLOCK_START +
(4 * ((pci_func/2) * 3)) + (4 * (pci_func & 1));
qlcnic_fetch_mac(adapter, crbaddr, crbaddr+4, pci_func & 1, mac);
return 0;
}
/* /*
* Changes the CRB window to the specified window. * Changes the CRB window to the specified window.
*/ */
......
...@@ -322,7 +322,7 @@ qlcnic_read_mac_addr(struct qlcnic_adapter *adapter) ...@@ -322,7 +322,7 @@ qlcnic_read_mac_addr(struct qlcnic_adapter *adapter)
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
if (adapter->nic_ops->get_mac_addr(adapter, mac_addr) != 0) if (qlcnic_get_mac_address(adapter, mac_addr) != 0)
return -EIO; return -EIO;
memcpy(netdev->dev_addr, mac_addr, ETH_ALEN); memcpy(netdev->dev_addr, mac_addr, ETH_ALEN);
...@@ -378,14 +378,12 @@ static const struct net_device_ops qlcnic_netdev_ops = { ...@@ -378,14 +378,12 @@ static const struct net_device_ops qlcnic_netdev_ops = {
}; };
static struct qlcnic_nic_template qlcnic_ops = { static struct qlcnic_nic_template qlcnic_ops = {
.get_mac_addr = qlcnic_get_mac_address,
.config_bridged_mode = qlcnic_config_bridged_mode, .config_bridged_mode = qlcnic_config_bridged_mode,
.config_led = qlcnic_config_led, .config_led = qlcnic_config_led,
.start_firmware = qlcnic_start_firmware .start_firmware = qlcnic_start_firmware
}; };
static struct qlcnic_nic_template qlcnic_vf_ops = { static struct qlcnic_nic_template qlcnic_vf_ops = {
.get_mac_addr = qlcnic_get_mac_address,
.config_bridged_mode = qlcnicvf_config_bridged_mode, .config_bridged_mode = qlcnicvf_config_bridged_mode,
.config_led = qlcnicvf_config_led, .config_led = qlcnicvf_config_led,
.start_firmware = qlcnicvf_start_firmware .start_firmware = qlcnicvf_start_firmware
...@@ -668,7 +666,6 @@ static void ...@@ -668,7 +666,6 @@ static void
qlcnic_check_options(struct qlcnic_adapter *adapter) qlcnic_check_options(struct qlcnic_adapter *adapter)
{ {
u32 fw_major, fw_minor, fw_build; u32 fw_major, fw_minor, fw_build;
char brd_name[QLCNIC_MAX_BOARD_NAME_LEN];
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
struct qlcnic_info nic_info; struct qlcnic_info nic_info;
...@@ -678,17 +675,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) ...@@ -678,17 +675,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
adapter->fw_version = QLCNIC_VERSION_CODE(fw_major, fw_minor, fw_build); adapter->fw_version = QLCNIC_VERSION_CODE(fw_major, fw_minor, fw_build);
if (!(adapter->flags & QLCNIC_ADAPTER_INITIALIZED))
if (qlcnic_read_mac_addr(adapter))
dev_warn(&pdev->dev, "failed to read mac addr\n");
if (adapter->portnum == 0) {
get_brd_name(adapter, brd_name);
pr_info("%s: %s Board Chip rev 0x%x\n",
module_name(THIS_MODULE),
brd_name, adapter->ahw.revision_id);
}
dev_info(&pdev->dev, "firmware v%d.%d.%d\n", dev_info(&pdev->dev, "firmware v%d.%d.%d\n",
fw_major, fw_minor, fw_build); fw_major, fw_minor, fw_build);
...@@ -1468,6 +1454,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1468,6 +1454,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int err; int err;
uint8_t revision_id; uint8_t revision_id;
uint8_t pci_using_dac; uint8_t pci_using_dac;
char brd_name[QLCNIC_MAX_BOARD_NAME_LEN];
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) if (err)
...@@ -1535,6 +1522,17 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1535,6 +1522,17 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_decr_ref; goto err_out_decr_ref;
} }
if (qlcnic_read_mac_addr(adapter))
dev_warn(&pdev->dev, "failed to read mac addr\n");
if (adapter->portnum == 0) {
get_brd_name(adapter, brd_name);
pr_info("%s: %s Board Chip rev 0x%x\n",
module_name(THIS_MODULE),
brd_name, adapter->ahw.revision_id);
}
qlcnic_clear_stats(adapter); qlcnic_clear_stats(adapter);
qlcnic_setup_intr(adapter); qlcnic_setup_intr(adapter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment