Commit 9d7b372f authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Sathya Perla says:

====================
be2net: patch set

Hi David, the following patch set has code cleanup patches, minor enhancements
and non-critical fixes. Pls consider applying to the net-next tree. Thanks!

Patch 1 removes duplicate code in be_setup_wol() routine making it simpler
and more readable.

Patch 2 fixes the the bridge mode return value for the ndo_bridge_getlink()
call. Instead of just relying on the SRIOV enabled state, the driver now
queries the FW, for the actual mode of bridge.

Patch 3 removes code for setting D0 power state as it's already done
in pci_enable_device()

Patch 4 fixes a bad return value in be_check_ufi_compatibility() routine
introduced by an earlier commit.

Patch 5 fixes a field in udp header being accessed while in network endian
format.

Patch 6 fixes the be_mcc_notify() routine to return an error status when
the FW/HW is in an error state.

Patch 7 fixes the be_cmd_rx_filter() routine to issue the RX_FILTER cmd
and not wait for a completion from the FW. If the FW/adapter
is in an error state, this change helps in not holding up the rtnl_lock
and keeping bottom halves disabled while the driver timesout waiting for
a response from the FW.

Patch 8 fixes the be_cmd_set_loopback() routine to issue the LOOPBACK cmd
and not wait for the FW completion while spin_lock_bh() is held on the
mcc_lock. As the cmd is always issued from ethtool in a process context,
it can sleep till the FW completion is received.

Patch 9 bumps up the driver version to 10.6.0.3
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9131f3de a78dfcb3
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "be_hw.h" #include "be_hw.h"
#include "be_roce.h" #include "be_roce.h"
#define DRV_VER "10.6.0.2" #define DRV_VER "10.6.0.3"
#define DRV_NAME "be2net" #define DRV_NAME "be2net"
#define BE_NAME "Emulex BladeEngine2" #define BE_NAME "Emulex BladeEngine2"
#define BE3_NAME "Emulex BladeEngine3" #define BE3_NAME "Emulex BladeEngine3"
......
...@@ -88,19 +88,21 @@ static inline void *embedded_payload(struct be_mcc_wrb *wrb) ...@@ -88,19 +88,21 @@ static inline void *embedded_payload(struct be_mcc_wrb *wrb)
return wrb->payload.embedded_payload; return wrb->payload.embedded_payload;
} }
static void be_mcc_notify(struct be_adapter *adapter) static int be_mcc_notify(struct be_adapter *adapter)
{ {
struct be_queue_info *mccq = &adapter->mcc_obj.q; struct be_queue_info *mccq = &adapter->mcc_obj.q;
u32 val = 0; u32 val = 0;
if (be_check_error(adapter, BE_ERROR_ANY)) if (be_check_error(adapter, BE_ERROR_ANY))
return; return -EIO;
val |= mccq->id & DB_MCCQ_RING_ID_MASK; val |= mccq->id & DB_MCCQ_RING_ID_MASK;
val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT; val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
wmb(); wmb();
iowrite32(val, adapter->db + DB_MCCQ_OFFSET); iowrite32(val, adapter->db + DB_MCCQ_OFFSET);
return 0;
} }
/* To check if valid bit is set, check the entire word as we don't know /* To check if valid bit is set, check the entire word as we don't know
...@@ -170,6 +172,12 @@ static void be_async_cmd_process(struct be_adapter *adapter, ...@@ -170,6 +172,12 @@ static void be_async_cmd_process(struct be_adapter *adapter,
return; return;
} }
if (opcode == OPCODE_LOWLEVEL_SET_LOOPBACK_MODE &&
subsystem == CMD_SUBSYSTEM_LOWLEVEL) {
complete(&adapter->et_cmd_compl);
return;
}
if ((opcode == OPCODE_COMMON_WRITE_FLASHROM || if ((opcode == OPCODE_COMMON_WRITE_FLASHROM ||
opcode == OPCODE_COMMON_WRITE_OBJECT) && opcode == OPCODE_COMMON_WRITE_OBJECT) &&
subsystem == CMD_SUBSYSTEM_COMMON) { subsystem == CMD_SUBSYSTEM_COMMON) {
...@@ -541,7 +549,9 @@ static int be_mcc_notify_wait(struct be_adapter *adapter) ...@@ -541,7 +549,9 @@ static int be_mcc_notify_wait(struct be_adapter *adapter)
resp = be_decode_resp_hdr(wrb->tag0, wrb->tag1); resp = be_decode_resp_hdr(wrb->tag0, wrb->tag1);
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
if (status)
goto out;
status = be_mcc_wait_compl(adapter); status = be_mcc_wait_compl(adapter);
if (status == -EIO) if (status == -EIO)
...@@ -1547,7 +1557,10 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) ...@@ -1547,7 +1557,10 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
else else
hdr->version = 2; hdr->version = 2;
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
if (status)
goto err;
adapter->stats_cmd_sent = true; adapter->stats_cmd_sent = true;
err: err:
...@@ -1583,7 +1596,10 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter, ...@@ -1583,7 +1596,10 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
req->cmd_params.params.pport_num = cpu_to_le16(adapter->hba_port_num); req->cmd_params.params.pport_num = cpu_to_le16(adapter->hba_port_num);
req->cmd_params.params.reset_stats = 0; req->cmd_params.params.reset_stats = 0;
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
if (status)
goto err;
adapter->stats_cmd_sent = true; adapter->stats_cmd_sent = true;
err: err:
...@@ -1687,8 +1703,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter) ...@@ -1687,8 +1703,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter)
OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES, OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES,
sizeof(*req), wrb, NULL); sizeof(*req), wrb, NULL);
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
...@@ -1860,7 +1875,7 @@ static int __be_cmd_modify_eqd(struct be_adapter *adapter, ...@@ -1860,7 +1875,7 @@ static int __be_cmd_modify_eqd(struct be_adapter *adapter,
cpu_to_le32(set_eqd[i].delay_multiplier); cpu_to_le32(set_eqd[i].delay_multiplier);
} }
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
...@@ -1953,7 +1968,7 @@ static int __be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) ...@@ -1953,7 +1968,7 @@ static int __be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN); memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
} }
status = be_mcc_notify_wait(adapter); status = be_mcc_notify(adapter);
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
...@@ -2320,7 +2335,10 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2320,7 +2335,10 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma + req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma +
sizeof(struct lancer_cmd_req_write_object))); sizeof(struct lancer_cmd_req_write_object)));
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
if (status)
goto err_unlock;
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
if (!wait_for_completion_timeout(&adapter->et_cmd_compl, if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
...@@ -2491,7 +2509,10 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2491,7 +2509,10 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
req->params.op_code = cpu_to_le32(flash_opcode); req->params.op_code = cpu_to_le32(flash_opcode);
req->params.data_buf_size = cpu_to_le32(buf_size); req->params.data_buf_size = cpu_to_le32(buf_size);
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
if (status)
goto err_unlock;
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
if (!wait_for_completion_timeout(&adapter->et_cmd_compl, if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
...@@ -2585,7 +2606,7 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, ...@@ -2585,7 +2606,7 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
wrb = wrb_from_mccq(adapter); wrb = wrb_from_mccq(adapter);
if (!wrb) { if (!wrb) {
status = -EBUSY; status = -EBUSY;
goto err; goto err_unlock;
} }
req = embedded_payload(wrb); req = embedded_payload(wrb);
...@@ -2599,8 +2620,19 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, ...@@ -2599,8 +2620,19 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
req->loopback_type = loopback_type; req->loopback_type = loopback_type;
req->loopback_state = enable; req->loopback_state = enable;
status = be_mcc_notify_wait(adapter); status = be_mcc_notify(adapter);
err: if (status)
goto err_unlock;
spin_unlock_bh(&adapter->mcc_lock);
if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(SET_LB_MODE_TIMEOUT)))
status = -ETIMEDOUT;
return status;
err_unlock:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
} }
...@@ -2636,7 +2668,9 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, ...@@ -2636,7 +2668,9 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
req->num_pkts = cpu_to_le32(num_pkts); req->num_pkts = cpu_to_le32(num_pkts);
req->loopback_type = cpu_to_le32(loopback_type); req->loopback_type = cpu_to_le32(loopback_type);
be_mcc_notify(adapter); status = be_mcc_notify(adapter);
if (status)
goto err;
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
......
...@@ -1495,6 +1495,8 @@ struct be_cmd_resp_acpi_wol_magic_config_v1 { ...@@ -1495,6 +1495,8 @@ struct be_cmd_resp_acpi_wol_magic_config_v1 {
#define BE_PME_D3COLD_CAP 0x80 #define BE_PME_D3COLD_CAP 0x80
/********************** LoopBack test *********************/ /********************** LoopBack test *********************/
#define SET_LB_MODE_TIMEOUT 12000
struct be_cmd_req_loopback_test { struct be_cmd_req_loopback_test {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
u32 loopback_type; u32 loopback_type;
...@@ -1758,6 +1760,7 @@ struct be_cmd_req_set_mac_list { ...@@ -1758,6 +1760,7 @@ struct be_cmd_req_set_mac_list {
/*********************** HSW Config ***********************/ /*********************** HSW Config ***********************/
#define PORT_FWD_TYPE_VEPA 0x3 #define PORT_FWD_TYPE_VEPA 0x3
#define PORT_FWD_TYPE_VEB 0x2 #define PORT_FWD_TYPE_VEB 0x2
#define PORT_FWD_TYPE_PASSTHRU 0x1
#define ENABLE_MAC_SPOOFCHK 0x2 #define ENABLE_MAC_SPOOFCHK 0x2
#define DISABLE_MAC_SPOOFCHK 0x3 #define DISABLE_MAC_SPOOFCHK 0x3
......
...@@ -847,10 +847,21 @@ static int be_test_ddr_dma(struct be_adapter *adapter) ...@@ -847,10 +847,21 @@ static int be_test_ddr_dma(struct be_adapter *adapter)
static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
u64 *status) u64 *status)
{ {
be_cmd_set_loopback(adapter, adapter->hba_port_num, loopback_type, 1); int ret;
ret = be_cmd_set_loopback(adapter, adapter->hba_port_num,
loopback_type, 1);
if (ret)
return ret;
*status = be_cmd_loopback_test(adapter, adapter->hba_port_num, *status = be_cmd_loopback_test(adapter, adapter->hba_port_num,
loopback_type, 1500, 2, 0xabc); loopback_type, 1500, 2, 0xabc);
be_cmd_set_loopback(adapter, adapter->hba_port_num, BE_NO_LOOPBACK, 1);
ret = be_cmd_set_loopback(adapter, adapter->hba_port_num,
BE_NO_LOOPBACK, 1);
if (ret)
return ret;
return *status; return *status;
} }
......
...@@ -1254,7 +1254,7 @@ static bool be_send_pkt_to_bmc(struct be_adapter *adapter, ...@@ -1254,7 +1254,7 @@ static bool be_send_pkt_to_bmc(struct be_adapter *adapter,
if (is_udp_pkt((*skb))) { if (is_udp_pkt((*skb))) {
struct udphdr *udp = udp_hdr((*skb)); struct udphdr *udp = udp_hdr((*skb));
switch (udp->dest) { switch (ntohs(udp->dest)) {
case DHCP_CLIENT_PORT: case DHCP_CLIENT_PORT:
os2bmc = is_dhcp_client_filt_enabled(adapter); os2bmc = is_dhcp_client_filt_enabled(adapter);
goto done; goto done;
...@@ -3529,15 +3529,15 @@ static int be_open(struct net_device *netdev) ...@@ -3529,15 +3529,15 @@ static int be_open(struct net_device *netdev)
static int be_setup_wol(struct be_adapter *adapter, bool enable) static int be_setup_wol(struct be_adapter *adapter, bool enable)
{ {
struct device *dev = &adapter->pdev->dev;
struct be_dma_mem cmd; struct be_dma_mem cmd;
int status = 0;
u8 mac[ETH_ALEN]; u8 mac[ETH_ALEN];
int status;
eth_zero_addr(mac); eth_zero_addr(mac);
cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config);
cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, cmd.va = dma_zalloc_coherent(dev, cmd.size, &cmd.dma, GFP_KERNEL);
GFP_KERNEL);
if (!cmd.va) if (!cmd.va)
return -ENOMEM; return -ENOMEM;
...@@ -3546,24 +3546,18 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable) ...@@ -3546,24 +3546,18 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
PCICFG_PM_CONTROL_OFFSET, PCICFG_PM_CONTROL_OFFSET,
PCICFG_PM_CONTROL_MASK); PCICFG_PM_CONTROL_MASK);
if (status) { if (status) {
dev_err(&adapter->pdev->dev, dev_err(dev, "Could not enable Wake-on-lan\n");
"Could not enable Wake-on-lan\n"); goto err;
dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va,
cmd.dma);
return status;
} }
status = be_cmd_enable_magic_wol(adapter,
adapter->netdev->dev_addr,
&cmd);
pci_enable_wake(adapter->pdev, PCI_D3hot, 1);
pci_enable_wake(adapter->pdev, PCI_D3cold, 1);
} else { } else {
status = be_cmd_enable_magic_wol(adapter, mac, &cmd); ether_addr_copy(mac, adapter->netdev->dev_addr);
pci_enable_wake(adapter->pdev, PCI_D3hot, 0);
pci_enable_wake(adapter->pdev, PCI_D3cold, 0);
} }
dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); status = be_cmd_enable_magic_wol(adapter, mac, &cmd);
pci_enable_wake(adapter->pdev, PCI_D3hot, enable);
pci_enable_wake(adapter->pdev, PCI_D3cold, enable);
err:
dma_free_coherent(dev, cmd.size, cmd.va, cmd.dma);
return status; return status;
} }
...@@ -4924,7 +4918,7 @@ static bool be_check_ufi_compatibility(struct be_adapter *adapter, ...@@ -4924,7 +4918,7 @@ static bool be_check_ufi_compatibility(struct be_adapter *adapter,
{ {
if (!fhdr) { if (!fhdr) {
dev_err(&adapter->pdev->dev, "Invalid FW UFI file"); dev_err(&adapter->pdev->dev, "Invalid FW UFI file");
return -1; return false;
} }
/* First letter of the build version is used to identify /* First letter of the build version is used to identify
...@@ -5079,9 +5073,6 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -5079,9 +5073,6 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
int status = 0; int status = 0;
u8 hsw_mode; u8 hsw_mode;
if (!sriov_enabled(adapter))
return 0;
/* BE and Lancer chips support VEB mode only */ /* BE and Lancer chips support VEB mode only */
if (BEx_chip(adapter) || lancer_chip(adapter)) { if (BEx_chip(adapter) || lancer_chip(adapter)) {
hsw_mode = PORT_FWD_TYPE_VEB; hsw_mode = PORT_FWD_TYPE_VEB;
...@@ -5091,6 +5082,9 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -5091,6 +5082,9 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
NULL); NULL);
if (status) if (status)
return 0; return 0;
if (hsw_mode == PORT_FWD_TYPE_PASSTHRU)
return 0;
} }
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
...@@ -5813,7 +5807,6 @@ static int be_pci_resume(struct pci_dev *pdev) ...@@ -5813,7 +5807,6 @@ static int be_pci_resume(struct pci_dev *pdev)
if (status) if (status)
return status; return status;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev); pci_restore_state(pdev);
status = be_resume(adapter); status = be_resume(adapter);
...@@ -5893,7 +5886,6 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) ...@@ -5893,7 +5886,6 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev)
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
pci_set_master(pdev); pci_set_master(pdev);
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev); pci_restore_state(pdev);
/* Check if card is ok and fw is ready */ /* Check if card is ok and fw is ready */
......
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