Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
#include "be_hw.h"
#include "be_roce.h"

#define DRV_VER			"10.6.0.2"
#define DRV_VER			"10.6.0.3"
#define DRV_NAME		"be2net"
#define BE_NAME			"Emulex BladeEngine2"
#define BE3_NAME		"Emulex BladeEngine3"
+49 −15
Original line number Diff line number Diff line
@@ -88,19 +88,21 @@ static inline void *embedded_payload(struct be_mcc_wrb *wrb)
	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;
	u32 val = 0;

	if (be_check_error(adapter, BE_ERROR_ANY))
		return;
		return -EIO;

	val |= mccq->id & DB_MCCQ_RING_ID_MASK;
	val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;

	wmb();
	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
@@ -170,6 +172,12 @@ static void be_async_cmd_process(struct be_adapter *adapter,
		return;
	}

	if (opcode == OPCODE_LOWLEVEL_SET_LOOPBACK_MODE &&
	    subsystem == CMD_SUBSYSTEM_LOWLEVEL) {
		complete(&adapter->et_cmd_compl);
		return;
	}

	if ((opcode == OPCODE_COMMON_WRITE_FLASHROM ||
	     opcode == OPCODE_COMMON_WRITE_OBJECT) &&
	    subsystem == CMD_SUBSYSTEM_COMMON) {
@@ -541,7 +549,9 @@ static int be_mcc_notify_wait(struct be_adapter *adapter)

	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);
	if (status == -EIO)
@@ -1547,7 +1557,10 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
	else
		hdr->version = 2;

	be_mcc_notify(adapter);
	status = be_mcc_notify(adapter);
	if (status)
		goto err;

	adapter->stats_cmd_sent = true;

err:
@@ -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.reset_stats = 0;

	be_mcc_notify(adapter);
	status = be_mcc_notify(adapter);
	if (status)
		goto err;

	adapter->stats_cmd_sent = true;

err:
@@ -1687,8 +1703,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter)
			       OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES,
			       sizeof(*req), wrb, NULL);

	be_mcc_notify(adapter);

	status = be_mcc_notify(adapter);
err:
	spin_unlock_bh(&adapter->mcc_lock);
	return status;
@@ -1860,7 +1875,7 @@ static int __be_cmd_modify_eqd(struct be_adapter *adapter,
				cpu_to_le32(set_eqd[i].delay_multiplier);
	}

	be_mcc_notify(adapter);
	status = be_mcc_notify(adapter);
err:
	spin_unlock_bh(&adapter->mcc_lock);
	return status;
@@ -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);
	}

	status = be_mcc_notify_wait(adapter);
	status = be_mcc_notify(adapter);
err:
	spin_unlock_bh(&adapter->mcc_lock);
	return status;
@@ -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 +
				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);

	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,
	req->params.op_code = cpu_to_le32(flash_opcode);
	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);

	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,
	wrb = wrb_from_mccq(adapter);
	if (!wrb) {
		status = -EBUSY;
		goto err;
		goto err_unlock;
	}

	req = embedded_payload(wrb);
@@ -2599,8 +2620,19 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
	req->loopback_type = loopback_type;
	req->loopback_state = enable;

	status = be_mcc_notify_wait(adapter);
err:
	status = be_mcc_notify(adapter);
	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);
	return status;
}
@@ -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->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);

+3 −0
Original line number Diff line number Diff line
@@ -1495,6 +1495,8 @@ struct be_cmd_resp_acpi_wol_magic_config_v1 {
#define BE_PME_D3COLD_CAP		0x80

/********************** LoopBack test *********************/
#define SET_LB_MODE_TIMEOUT		12000

struct be_cmd_req_loopback_test {
	struct be_cmd_req_hdr hdr;
	u32 loopback_type;
@@ -1758,6 +1760,7 @@ struct be_cmd_req_set_mac_list {
/*********************** HSW Config ***********************/
#define PORT_FWD_TYPE_VEPA		0x3
#define PORT_FWD_TYPE_VEB		0x2
#define PORT_FWD_TYPE_PASSTHRU		0x1

#define ENABLE_MAC_SPOOFCHK		0x2
#define DISABLE_MAC_SPOOFCHK		0x3
+13 −2
Original line number Diff line number Diff line
@@ -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,
			    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,
				       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;
}

+16 −24
Original line number Diff line number Diff line
@@ -1254,7 +1254,7 @@ static bool be_send_pkt_to_bmc(struct be_adapter *adapter,
	if (is_udp_pkt((*skb))) {
		struct udphdr *udp = udp_hdr((*skb));

		switch (udp->dest) {
		switch (ntohs(udp->dest)) {
		case DHCP_CLIENT_PORT:
			os2bmc = is_dhcp_client_filt_enabled(adapter);
			goto done;
@@ -3529,15 +3529,15 @@ static int be_open(struct net_device *netdev)

static int be_setup_wol(struct be_adapter *adapter, bool enable)
{
	struct device *dev = &adapter->pdev->dev;
	struct be_dma_mem cmd;
	int status = 0;
	u8 mac[ETH_ALEN];
	int status;

	eth_zero_addr(mac);

	cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config);
	cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
				     GFP_KERNEL);
	cmd.va = dma_zalloc_coherent(dev, cmd.size, &cmd.dma, GFP_KERNEL);
	if (!cmd.va)
		return -ENOMEM;

@@ -3546,24 +3546,18 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
						PCICFG_PM_CONTROL_OFFSET,
						PCICFG_PM_CONTROL_MASK);
		if (status) {
			dev_err(&adapter->pdev->dev,
				"Could not enable Wake-on-lan\n");
			dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va,
					  cmd.dma);
			return status;
			dev_err(dev, "Could not enable Wake-on-lan\n");
			goto err;
		}
		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 {
		status = be_cmd_enable_magic_wol(adapter, mac, &cmd);
		pci_enable_wake(adapter->pdev, PCI_D3hot, 0);
		pci_enable_wake(adapter->pdev, PCI_D3cold, 0);
		ether_addr_copy(mac, adapter->netdev->dev_addr);
	}

	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;
}

@@ -4924,7 +4918,7 @@ static bool be_check_ufi_compatibility(struct be_adapter *adapter,
{
	if (!fhdr) {
		dev_err(&adapter->pdev->dev, "Invalid FW UFI file");
		return -1;
		return false;
	}

	/* 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,
	int status = 0;
	u8 hsw_mode;

	if (!sriov_enabled(adapter))
		return 0;

	/* BE and Lancer chips support VEB mode only */
	if (BEx_chip(adapter) || lancer_chip(adapter)) {
		hsw_mode = PORT_FWD_TYPE_VEB;
@@ -5091,6 +5082,9 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
					       NULL);
		if (status)
			return 0;

		if (hsw_mode == PORT_FWD_TYPE_PASSTHRU)
			return 0;
	}

	return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
@@ -5813,7 +5807,6 @@ static int be_pci_resume(struct pci_dev *pdev)
	if (status)
		return status;

	pci_set_power_state(pdev, PCI_D0);
	pci_restore_state(pdev);

	status = be_resume(adapter);
@@ -5893,7 +5886,6 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev)
		return PCI_ERS_RESULT_DISCONNECT;

	pci_set_master(pdev);
	pci_set_power_state(pdev, PCI_D0);
	pci_restore_state(pdev);

	/* Check if card is ok and fw is ready */