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

Commit e3784546 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "atlantic-forwarding driver v1.0.17"

parents 6ddb28bf 9216ccec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include <linux/netdevice.h>
#include <linux/moduleparam.h>

#define ATL_VERSION "1.0.16"
#define ATL_VERSION "1.0.17"

struct atl_nic;

@@ -307,6 +307,7 @@ extern const struct ethtool_ops atl_ethtool_ops;
extern int atl_max_queues;
extern unsigned atl_rx_linear;
extern unsigned atl_min_intr_delay;
extern int atl_enable_msi;

/* Logging conviniency macros.
 *
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
/* From commit aff171641d181ea573380efc3f559c9de4741fc5 */
int atl_compat_pci_irq_vector(struct pci_dev *dev, unsigned int nr)
{
#ifdef CONFIG_PCI_MSI
	if (dev->msix_enabled) {
		struct msi_desc *entry;
		int i = 0;
@@ -42,6 +43,7 @@ int atl_compat_pci_irq_vector(struct pci_dev *dev, unsigned int nr)
		if (WARN_ON_ONCE(nr > 0))
			return -EINVAL;
	}
#endif

	return dev->irq + nr;
}
+26 −0
Original line number Diff line number Diff line
@@ -143,4 +143,30 @@ static inline void page_ref_inc(struct page *page)

#endif	/* 4.6.0 */

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)

/* introduced in commit c7f5d105495a38ed09e70d825f75d9d7d5407264
 * stub it */
static inline int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
{
	return -ENODEV;
}

#endif	/* 4.5.0 */

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
#define ETHTOOL_RX_FLOW_SPEC_RING      0x00000000FFFFFFFFLL
#define ETHTOOL_RX_FLOW_SPEC_RING_VF   0x000000FF00000000LL
#define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
{
	return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
};
static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
{
	return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
				ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
};
#endif	/* 4.2.0 */

#endif
+23 −16
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ static int atl_ethtool_set_settings(struct net_device *ndev,

	atl_ethtool_set_common(cmd, lstate,
		(unsigned long *)&cmd->advertising, &tmp, true, speed);
	hw->mcp.ops->set_link(hw);
	hw->mcp.ops->set_link(hw, false);
	return 0;
}

@@ -350,8 +350,14 @@ static void atl_get_channels(struct net_device *ndev,
	struct ethtool_channels *chan)
{
	struct atl_nic *nic = netdev_priv(ndev);
	int max_rings;

	if (atl_enable_msi)
		max_rings = min_t(int, ATL_MAX_QUEUES, num_present_cpus());
	else
		max_rings = 1;

	chan->max_combined = ATL_MAX_QUEUES;
	chan->max_combined = max_rings;
	chan->combined_count = nic->nvecs;
	if (nic->flags & ATL_FL_MULTIPLE_VECTORS)
		chan->max_other = chan->other_count = ATL_NUM_NON_RING_IRQS;
@@ -793,26 +799,27 @@ static int atl_set_pad_stripping(struct atl_nic *nic, bool on)
{
	struct atl_hw *hw = &nic->hw;
	int ret;
	uint32_t ctrl;
	uint32_t msm_opts;

	ret = atl_hwsem_get(hw, ATL_MCP_SEM_MSM);
	if (ret)
		return ret;
	if (hw->mcp.fw_rev < 0x0300008e)
		return -EOPNOTSUPP;

	ret = __atl_msm_read(hw, ATL_MSM_GEN_CTRL, &ctrl);
	ret = atl_read_fwsettings_word(hw, atl_fw2_setings_msm_opts,
		&msm_opts);
	if (ret)
		goto unlock;

	if (on)
		ctrl |= BIT(5);
	else
		ctrl &= ~BIT(5);
		return ret;

	ret = __atl_msm_write(hw, ATL_MSM_GEN_CTRL, ctrl);
	msm_opts &= ~atl_fw2_settings_msm_opts_strip_pad;
	msm_opts |= !!on << atl_fw2_settings_msm_opts_strip_pad_shift;

unlock:
	atl_hwsem_put(hw, ATL_MCP_SEM_MSM);
	ret = atl_write_fwsettings_word(hw, atl_fw2_setings_msm_opts,
		msm_opts);
	if (ret)
		return ret;

	/* Restart aneg to make FW apply the new settings */
	hw->mcp.ops->restart_aneg(hw);
	return 0;
}

static uint32_t atl_get_priv_flags(struct net_device *ndev)
+21 −4
Original line number Diff line number Diff line
@@ -295,6 +295,10 @@ static void atl_fw2_set_link(struct atl_hw *hw, bool force)

	bits = atl_set_fw_bits(hw, 1);

	/* If no modes are advertized, put PHY into low-power */
	if (!bits)
		hi_bits |= atl_fw2_link_drop;

	hi_bits |= bits >> 32;

	atl_write(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_LOW), bits);
@@ -352,7 +356,8 @@ static int atl_fw2_enable_wol(struct atl_hw *hw)
	atl_lock_fw(hw);

	ret = atl_write_mcp_mem(hw, 0, msg,
		(info->len + offsetof(struct drvIface, fw2xOffloads) + 3) & ~3);
		(info->len + offsetof(struct drvIface, fw2xOffloads) + 3) & ~3,
		MCP_AREA_CONFIG);
	if (ret) {
		atl_dev_err("Failed to upload sleep proxy info to FW\n");
		goto free;
@@ -374,12 +379,11 @@ static int atl_fw2_enable_wol(struct atl_hw *hw)
	return ret;
}

int atl_read_fwstat_word(struct atl_hw *hw, uint32_t offt, uint32_t *val)
int atl_read_mcp_word(struct atl_hw *hw, uint32_t offt, uint32_t *val)
{
	int ret;
	uint32_t addr = hw->mcp.fw_stat_addr + (offt & ~3);

	ret = atl_read_mcp_mem(hw, addr, val, 4);
	ret = atl_read_mcp_mem(hw, offt & ~3, val, 4);
	if (ret)
		return ret;

@@ -446,6 +450,7 @@ static struct atl_fw_ops atl_fw_ops[2] = {
int atl_fw_init(struct atl_hw *hw)
{
	uint32_t tries, reg, major;
	int ret;

	tries = busy_wait(10000, mdelay(1), reg, atl_read(hw, 0x18), !reg);
	if (!reg) {
@@ -466,5 +471,17 @@ int atl_fw_init(struct atl_hw *hw)
	hw->mcp.fw_rev = reg;
	hw->mcp.fw_stat_addr = atl_read(hw, ATL_MCP_SCRATCH(FW_STAT_STRUCT));

	if (major > 1) {
		ret = atl_read_fwstat_word(hw, atl_fw2_stat_settings_addr,
			&hw->mcp.fw_settings_addr);
		if (ret)
			return ret;

		ret = atl_read_fwstat_word(hw, atl_fw2_stat_settings_len,
			&hw->mcp.fw_settings_len);
		if (ret)
			return ret;
	}

	return hw->mcp.ops->wait_fw_init(hw);
}
Loading