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

Commit d1503063 authored by Dmitry Bogdanov's avatar Dmitry Bogdanov Committed by Jinesh K. Jayakumar
Browse files

atlantic forwarding driver v1.1.3

  [ATLDRV-1185] - Enable stripping of padding doesnt work on Felicity card
  [ATLDRV-1351] - A2: Problem with setting mtu
  [ATLDRV-1352] - A2: Implement stripping of padding
  [ATLDRV-1354] - A2: Incorrect thermal thresholds
  [ATLDRV-1359] - Secure all packets when macsec service ON

Change-Id: I1d1cf5943fd245d0536f6dbf320bcf693c6e7b59
Signed-off: Dmitry Bogdanov <dbogdanov@marvell.com>
Git-commit: 24b77eaf64ca1399208f8e8666410821992a171a
Git-repo: https://github.com/aquantia/linux-4.14-atlantic-forwarding


Signed-off-by: default avatarJinesh K. Jayakumar <jineshk@codeaurora.org>
parent 37f13c1f
Loading
Loading
Loading
Loading
+23 −5
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ static int __atl2_fw_wait_init(struct atl_hw *hw)
	atl2_shared_buffer_write(hw, link_control, link_control);

	atl2_shared_buffer_get(hw, mtu, mtu);
	mtu = ATL_MAX_MTU;
	mtu = ATL_MAX_MTU + ETH_FCS_LEN + ETH_HLEN;
	atl2_shared_buffer_write(hw, mtu, mtu);

	return atl2_shared_buffer_finish_ack(hw);
@@ -683,10 +683,10 @@ static int atl2_fw_update_thermal(struct atl_hw *hw)
	atl_lock_fw(hw);

	atl2_shared_buffer_get(hw, thermal_shutdown, thermal_shutdown);
	thermal_shutdown.enable = enable;
	thermal_shutdown.shutdown_temperature = hw->thermal.crit;
	thermal_shutdown.warning_temperature = hw->thermal.high;
	thermal_shutdown.cold_temperature = hw->thermal.low;
	thermal_shutdown.shutdown_enable = enable;
	thermal_shutdown.shutdown_temp_threshold = hw->thermal.crit;
	thermal_shutdown.warning_hot_tempThreshold = hw->thermal.high;
	thermal_shutdown.warning_cold_temp_threshold = hw->thermal.low;
	atl2_shared_buffer_write(hw, thermal_shutdown, thermal_shutdown);
	ret = atl2_shared_buffer_finish_ack(hw);

@@ -700,6 +700,23 @@ static int atl2_fw_update_thermal(struct atl_hw *hw)
	return ret;
}

static int atl2_fw_set_pad_stripping(struct atl_hw *hw, bool on)
{
	struct link_control_s link_control;
	int err = 0;

	atl_lock_fw(hw);

	atl2_shared_buffer_get(hw, link_control, link_control);
	link_control.enable_frame_padding_removal_rx = on;
	atl2_shared_buffer_write(hw, link_control, link_control);
	err = atl2_shared_buffer_finish_ack(hw);

	atl_unlock_fw(hw);

	return err;
}

static int atl2_fw_unsupported(struct atl_hw *hw)
{
	return -ENOTSUPP;
@@ -727,6 +744,7 @@ static struct atl_fw_ops atl2_fw_ops = {
		.get_phy_temperature = atl2_fw_get_phy_temperature,
		.set_mediadetect = (void *)atl2_fw_unsupported,
		.send_macsec_req = (void *)atl2_fw_unsupported,
		.set_pad_stripping = atl2_fw_set_pad_stripping,
		.get_mac_addr = atl2_fw_get_mac_addr,
		.__get_hbeat = __atl2_fw_get_hbeat,
		.set_phy_loopback = atl2_fw_set_phy_loopback,
+5 −6
Original line number Diff line number Diff line
@@ -66,14 +66,13 @@ struct link_control_s {
};

struct thermal_shutdown_s {
	uint32_t enable:1;
	uint32_t shutdown_enable :1;
	uint32_t warning_enable :1;
	uint32_t rsvd:6;


	uint32_t cold_temperature:8;
	uint32_t warning_temperature:8;
	uint32_t shutdown_temperature:8;
	uint32_t shutdown_temp_threshold :8;
	uint32_t warning_cold_temp_threshold :8;
	uint32_t warning_hot_tempThreshold :8;
};

struct mac_address_s {
+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.1.2"
#define ATL_VERSION "1.1.3"

struct atl_nic;
enum atl_fwd_notify;
+2 −19
Original line number Diff line number Diff line
@@ -1046,27 +1046,10 @@ static int atl_set_pad_stripping(struct atl_nic *nic, bool on)
{
	struct atl_hw *hw = &nic->hw;
	int ret;
	uint32_t msm_opts;

	if (hw->mcp.fw_rev < 0x0300008e)
		return -EOPNOTSUPP;

	ret = atl_read_fwsettings_word(hw, atl_fw2_setings_msm_opts,
		&msm_opts);
	if (ret)
		return ret;
	ret = hw->mcp.ops->set_pad_stripping(hw, on);

	msm_opts &= ~atl_fw2_settings_msm_opts_strip_pad;
	msm_opts |= !!on << atl_fw2_settings_msm_opts_strip_pad_shift;

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

int atl_set_media_detect(struct atl_nic *nic, bool on)
+82 −5
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ static int __atl_fw2_wait_fw_init(struct atl_hw *hw)
	hw->mcp.req_high = atl_read(hw,
				 ATL_MCP_SCRATCH(FW2_LINK_REQ_HIGH));

	hw->mcp.fw_stat_addr = atl_read(hw, ATL_MCP_SCRATCH(FW_STAT_STRUCT));
	hw->mcp.rpc_addr = atl_read(hw, ATL_MCP_SCRATCH(FW2_RPC_DATA));

	ret = atl_read_fwstat_word(hw, atl_fw2_stat_settings_addr,
		&hw->mcp.fw_settings_addr);
	if (ret)
@@ -380,12 +383,18 @@ static int atl_fw1_unsupported(struct atl_hw *hw)
	return -EOPNOTSUPP;
}

static int atl_fw2_restart_aneg(struct atl_hw *hw)
static int __atl_fw2_restart_aneg(struct atl_hw *hw)
{
	atl_lock_fw(hw);
	/* Autoneg restart is self-clearing, no need to track via
	 * mcp->req_high */
	atl_set_bits(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_HIGH), BIT(31));
	return 0;
}

static int atl_fw2_restart_aneg(struct atl_hw *hw)
{
	atl_lock_fw(hw);
	__atl_fw2_restart_aneg(hw);
	atl_unlock_fw(hw);
	return 0;
}
@@ -614,6 +623,70 @@ static int atl_fw2_set_mediadetect(struct atl_hw *hw, bool on)
	return ret;
}

static int __atl_fw2x_apply_msm_settings(struct atl_hw *hw)
{

	uint32_t msg_id = atl_fw2_msm_settings_apply;
	uint32_t high_status, high_req = 0;
	int ret = 0;

	if (hw->mcp.fw_rev < 0x0301006e)
		return __atl_fw2_restart_aneg(hw);

	ret = atl_write_mcp_mem(hw, 0, &msg_id, sizeof(msg_id),
				MCP_AREA_CONFIG);
	if (ret) {
		atl_dev_err("Failed to upload macsec request: %d\n", ret);
		atl_unlock_fw(hw);
		return ret;
	}

	high_req = atl_read(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_HIGH));
	high_req ^= atl_fw2_fw_request;
	atl_write(hw, ATL_MCP_SCRATCH(FW2_LINK_REQ_HIGH), high_req);

	busy_wait(1000, mdelay(1), high_status,
		atl_read(hw, ATL_MCP_SCRATCH(FW2_LINK_RES_HIGH)),
		((high_req ^ high_status) & atl_fw2_fw_request) != 0);
	if (((high_req ^ high_status) & atl_fw2_fw_request) != 0) {
		atl_dev_err("Timeout waiting for fw request\n");
		atl_unlock_fw(hw);
		return -EIO;
	}

	return ret;
}

static int atl_fw2_set_pad_stripping(struct atl_hw *hw, bool on)
{
	uint32_t msm_opts;
	int ret = 0;

	if (hw->mcp.fw_rev < 0x0300008e)
		return -EOPNOTSUPP;

	atl_lock_fw(hw);

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

	msm_opts &= ~atl_fw2_settings_msm_opts_strip_pad;
	if (on)
		msm_opts |= BIT(atl_fw2_settings_msm_opts_strip_pad_shift);

	ret = atl_write_fwsettings_word(hw, atl_fw2_setings_msm_opts,
		msm_opts);
	if (ret)
		goto unlock;

	ret = __atl_fw2x_apply_msm_settings(hw);
unlock:
	atl_unlock_fw(hw);
	return ret;
}

static int atl_fw2_send_macsec_request(struct atl_hw *hw,
				struct macsec_msg_fw_request *req,
				struct macsec_msg_fw_response *response)
@@ -627,11 +700,14 @@ static int atl_fw2_send_macsec_request(struct atl_hw *hw,
	if ((hw->mcp.caps_low & atl_fw2_macsec) == 0)
		return -EOPNOTSUPP;

	atl_lock_fw(hw);

	/* Write macsec request to cfg memory */
	ret = atl_write_mcp_mem(hw, 0, req, (sizeof(*req) + 3) & ~3,
				MCP_AREA_CONFIG);
	if (ret) {
		atl_dev_err("Failed to upload macsec request: %d\n", ret);
		atl_unlock_fw(hw);
		return ret;
	}

@@ -645,6 +721,7 @@ static int atl_fw2_send_macsec_request(struct atl_hw *hw,
		((low_req ^ low_status) & atl_fw2_macsec) != 0);
	if (((low_req ^ low_status) & atl_fw2_macsec) != 0) {
		atl_dev_err("Timeout waiting for macsec request\n");
		atl_unlock_fw(hw);
		return -EIO;
	}

@@ -652,6 +729,7 @@ static int atl_fw2_send_macsec_request(struct atl_hw *hw,
	ret = atl_read_rpc_mem(hw, sizeof(u32), (u32 *)(void *)response,
			       sizeof(*response));

	atl_unlock_fw(hw);
	return ret;
}

@@ -799,6 +877,7 @@ static struct atl_fw_ops atl_fw_ops[2] = {
		.set_phy_loopback = (void *)atl_fw1_unsupported,
		.set_mediadetect =  (void *)atl_fw1_unsupported,
		.send_macsec_req = (void *)atl_fw1_unsupported,
		.set_pad_stripping = (void *)atl_fw1_unsupported,
		.__get_hbeat = (void *)atl_fw1_unsupported,
		.get_mac_addr = atl_fw1_get_mac_addr,
		.update_thermal = atl_fw1_unsupported,
@@ -818,6 +897,7 @@ static struct atl_fw_ops atl_fw_ops[2] = {
		.set_phy_loopback = atl_fw2_set_phy_loopback,
		.set_mediadetect = atl_fw2_set_mediadetect,
		.send_macsec_req = atl_fw2_send_macsec_request,
		.set_pad_stripping = atl_fw2_set_pad_stripping,
		.__get_hbeat = __atl_fw2_get_hbeat,
		.get_mac_addr = atl_fw2_get_mac_addr,
		.update_thermal = atl_fw2_update_thermal,
@@ -981,9 +1061,6 @@ int atl_fw_init(struct atl_hw *hw)
	if (ret)
		return ret;

	mcp->fw_stat_addr = atl_read(hw, ATL_MCP_SCRATCH(FW_STAT_STRUCT));
	mcp->rpc_addr = atl_read(hw, ATL_MCP_SCRATCH(FW2_RPC_DATA));

	ret = mcp->ops->__get_hbeat(hw, &mcp->phy_hbeat);
	if (ret)
		return ret;
Loading