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

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

Merge "atlantic-forwarding driver v1.0.19"

parents c8a6ee6c 698c0659
Loading
Loading
Loading
Loading
+1 −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.18"
#define ATL_VERSION "1.0.19"

struct atl_nic;

+11 −7
Original line number Diff line number Diff line
@@ -413,8 +413,7 @@ static int atl_set_pauseparam(struct net_device *ndev,
	if (pause->autoneg && !lstate->autoneg)
		return -EINVAL;

	fc->req = pause->autoneg ? atl_fc_full :
		(!!pause->rx_pause << atl_fc_rx_shift) |
	fc->req = (!!pause->rx_pause << atl_fc_rx_shift) |
		(!!pause->tx_pause << atl_fc_tx_shift);

	hw->mcp.ops->set_link(hw, false);
@@ -2016,8 +2015,8 @@ static void atl_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
{
	struct atl_nic *nic = netdev_priv(ndev);

	wol->supported = WAKE_MAGIC;
	wol->wolopts = nic->flags & ATL_FL_WOL ? WAKE_MAGIC : 0;
	wol->supported = ATL_WAKE_SUPPORTED;
	wol->wolopts = nic->hw.wol_mode;
}

static int atl_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
@@ -2025,22 +2024,27 @@ static int atl_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
	int ret;
	struct atl_nic *nic = netdev_priv(ndev);

	if (wol->wolopts & ~WAKE_MAGIC) {
	if (wol->wolopts & ~ATL_WAKE_SUPPORTED) {
		atl_nic_err("%s: unsupported WoL mode %x\n", __func__,
			wol->wolopts);
		return -EINVAL;
	}

	if (wol->wolopts & WAKE_MAGIC)
	if (wol->wolopts)
		nic->flags |= ATL_FL_WOL;
	else
		nic->flags &= ~ATL_FL_WOL;

	nic->hw.wol_mode = wol->wolopts;

	ret = device_set_wakeup_enable(&nic->hw.pdev->dev,
		!!(nic->flags & ATL_FL_WOL));

	if (ret)
	if (ret) {
		atl_nic_err("device_set_wakeup_enable failed: %d\n", -ret);
		nic->flags &= ~ATL_FL_WOL;
		nic->hw.wol_mode = 0;
	}

	return ret;
}
+27 −20
Original line number Diff line number Diff line
@@ -294,12 +294,11 @@ static void atl_fw2_set_link(struct atl_hw *hw, bool force)
		hi_bits ^= atl_fw2_asym_pause;

	bits = atl_set_fw_bits(hw, 1);
	hi_bits |= bits >> 32;

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

	hi_bits |= bits >> 32;
		hi_bits = atl_fw2_link_drop;

	atl_write(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_LOW), bits);
	atl_write(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_HIGH), hi_bits);
@@ -341,26 +340,34 @@ static int atl_fw2_enable_wol(struct atl_hw *hw)
{
	int ret;
	struct offloadInfo *info;
	struct drvIface *msg;
	uint32_t val, wol_bits = atl_fw2_nic_proxy | atl_fw2_wol;
	struct drvIface *msg = NULL;
	uint32_t val, wol_bits = 0;

	atl_lock_fw(hw);

	if (hw->wol_mode & WAKE_PHY)
		wol_bits |= atl_fw2_wake_on_link;

	if (hw->wol_mode & WAKE_MAGIC) {
		wol_bits |= atl_fw2_nic_proxy | atl_fw2_wol;

		ret = -ENOMEM;
		msg = kzalloc(sizeof(*msg), GFP_KERNEL);
		if (!msg)
		return -ENOMEM;
			goto unlock_free;

		info = &msg->fw2xOffloads;
		info->version = 0;
		info->len = sizeof(*info);
		memcpy(info->macAddr, hw->mac_addr, ETH_ALEN);

	atl_lock_fw(hw);

		ret = atl_write_mcp_mem(hw, 0, msg,
		(info->len + offsetof(struct drvIface, fw2xOffloads) + 3) & ~3,
		MCP_AREA_CONFIG);
			(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;
			goto unlock_free;
		}
	}

	atl_write(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_LOW), 0);
@@ -373,7 +380,7 @@ static int atl_fw2_enable_wol(struct atl_hw *hw)
	if (ret)
		atl_dev_err("Timeout waiting for WoL enable\n");

free:
unlock_free:
	atl_unlock_fw(hw);
	kfree(msg);
	return ret;
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ enum atl_fw2_opts {
	atl_define_bit(atl_fw2_pause, 3)
	atl_define_bit(atl_fw2_asym_pause, 4)
	atl_fw2_pause_mask = atl_fw2_pause | atl_fw2_asym_pause,
	atl_define_bit(atl_fw2_wake_on_link, 16)
	atl_define_bit(atl_fw2_phy_temp, 18)
	atl_define_bit(atl_fw2_link_drop, 22)
	atl_define_bit(atl_fw2_nic_proxy, 0x17)
+25 −8
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ static int atl_fwd_get_frag(struct atl_fwd_ring *ring, int idx)

	if (ops->alloc_buf) {
		void *buf = ops->alloc_buf(dev, bufs->frag_size,
			&daddr, GFP_KERNEL);
			&daddr, GFP_KERNEL, ops);

		if (!IS_ERR_OR_NULL(buf)) {
			frag->buf = buf;
@@ -89,7 +89,7 @@ static void atl_fwd_free_bufs(struct atl_fwd_ring *ring)
		dma_free_coherent(dev, ring_size * sizeof(dma_addr_t),
			bufs->daddr_vec, bufs->daddr_vec_base);

	if (bufs->vaddr_vec)
	if (ring->flags & ATL_FWR_WANT_VIRT_BUF_VEC)
		kfree(bufs->vaddr_vec);

	for (i = 0; i < bufs->num_pages; i++) {
@@ -98,7 +98,7 @@ static void atl_fwd_free_bufs(struct atl_fwd_ring *ring)
		if (ops->free_buf) {
			if (frag->buf)
				ops->free_buf(frag->buf, dev, frag_size,
					frag->daddr);
					frag->daddr, ops);
			continue;
		}

@@ -141,6 +141,7 @@ static int atl_fwd_alloc_bufs(struct atl_fwd_ring *ring, int order)
		num_pages = 1;
	} else {
		int bufs_per_page;

		frag_size = PAGE_SIZE << order;
		bufs_per_page = frag_size / buf_size;
		num_pages = ring_size / bufs_per_page +
@@ -305,7 +306,8 @@ void atl_fwd_release_ring(struct atl_fwd_ring *ring)
	atl_fwd_free_bufs(ring);
	if (ops->free_descs)
		ops->free_descs(hwring->descs, dev,
			hwring->size * sizeof(*hwring->descs), hwring->daddr);
			hwring->size * sizeof(*hwring->descs), hwring->daddr,
			ops);
	else
		atl_free_descs(nic, &ring->hw);
	kfree(ring);
@@ -397,7 +399,8 @@ struct atl_fwd_ring *atl_fwd_request_ring(struct net_device *ndev,
		dma_addr_t daddr;

		descs = ops->alloc_descs(dev,
			ring_size * sizeof(*hwring->descs), &daddr, GFP_KERNEL);
			ring_size * sizeof(*hwring->descs), &daddr, GFP_KERNEL,
			ops);
		if (!IS_ERR_OR_NULL(descs)) {
			hwring->descs = descs;
			hwring->daddr = daddr;
@@ -435,7 +438,8 @@ struct atl_fwd_ring *atl_fwd_request_ring(struct net_device *ndev,
free_descs:
	if (ops->free_descs)
		ops->free_descs(hwring->descs, dev,
			hwring->size * sizeof(*hwring->descs), hwring->daddr);
			hwring->size * sizeof(*hwring->descs), hwring->daddr,
			ops);
	else
		atl_free_descs(nic, hwring);

@@ -447,6 +451,7 @@ EXPORT_SYMBOL(atl_fwd_request_ring);

int atl_fwd_set_ring_intr_mod(struct atl_fwd_ring *ring, int min, int max)
{
	struct atl_nic *nic = ring->nic;
	if (atl_fwd_ring_tx(ring) && ring->evt &&
		ring->evt->flags & ATL_FWD_EVT_TXWB) {
		struct atl_nic *nic = ring->nic;
@@ -456,11 +461,23 @@ int atl_fwd_set_ring_intr_mod(struct atl_fwd_ring *ring, int min, int max)
		return -EINVAL;
	}

	if (min >= 0)
	if (min >= 0) {
		if (min > 511) {
			atl_nic_err("%s: min delay out of range (0..511): %d\n",
				__func__, min);
			return -EINVAL;
		}
		ring->intr_mod_min = min;
	}

	if (max >= 0)
	if (max >= 0) {
		if (max > 1023) {
			atl_nic_err("%s: max delay out of range (0..1023): %d\n",
				__func__, max);
			return -EINVAL;
		}
		ring->intr_mod_max = max;
	}

	atl_fwd_update_im(ring);
	return 0;
Loading