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

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

Merge "atlantic forwarding driver v1.1.15"

parents ca57039f 636f35b3
Loading
Loading
Loading
Loading
+23 −7
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ static int __atl2_fw_wait_init(struct atl_hw *hw)
			 "pauseQuanta invalid size");
	BUILD_BUG_ON_MSG(sizeof(struct cable_diag_control_s) != 0x4,
			 "cableDiagControl invalid size");
	BUILD_BUG_ON_MSG(sizeof(struct statistics_s) != 0x70,
	BUILD_BUG_ON_MSG(sizeof(struct statistics_s) != 0x74,
			 "statistics_s invalid size");


@@ -901,19 +901,34 @@ static int atl2_fw_set_mediadetect(struct atl_hw *hw, bool on)
	return  atl2_shared_buffer_finish_ack(hw);
}

static int atl2_fw_set_downshift(struct atl_hw *hw, bool on)
{
	struct link_options_s link_options;

	atl2_shared_buffer_get(hw, link_options, link_options);

	link_options.downshift = on;

	atl2_shared_buffer_write(hw, link_options, link_options);

	return  atl2_shared_buffer_finish_ack(hw);
}

static int atl2_fw_unsupported(struct atl_hw *hw)
{
	return -EOPNOTSUPP;
}

int atl2_get_fw_version(struct atl_hw *hw, u32 *fw_version)
int atl2_get_fw_version(struct atl_hw *hw)
{
	struct mac_version_t mac_version;
	struct atl_mcp *mcp = &hw->mcp;
	struct version_s version;

	atl2_shared_buffer_read(hw, version.mac, mac_version);
	*fw_version = mac_version.major << 24 | mac_version.minor << 16 |
		      mac_version.build;
	atl2_shared_buffer_read_safe(hw, version, &version);
	mcp->fw_rev = version.bundle.major << 24 | version.bundle.minor << 16 |
		      version.bundle.build;

	mcp->interface_ver = version.drv_iface_ver;
	return 0;
}

@@ -927,6 +942,7 @@ static struct atl_fw_ops atl2_fw_ops = {
		.set_default_link = atl2_fw_set_default_link,
		.get_phy_temperature = atl2_fw_get_phy_temperature,
		.set_mediadetect = atl2_fw_set_mediadetect,
		.set_downshift = atl2_fw_set_downshift,
		.send_macsec_req = (void *)atl2_fw_unsupported,
		.set_pad_stripping = atl2_fw_set_pad_stripping,
		.get_mac_addr = atl2_fw_get_mac_addr,
@@ -943,7 +959,7 @@ int atl2_fw_init(struct atl_hw *hw)
	struct atl_mcp *mcp = &hw->mcp;
	int ret;

	atl2_get_fw_version(hw, &mcp->fw_rev);
	atl2_get_fw_version(hw);

	mcp->ops = &atl2_fw_ops;
	atl_dev_dbg("Detect ATL2FW %x\n", mcp->fw_rev);
+33 −4
Original line number Diff line number Diff line
@@ -239,7 +239,8 @@ struct version_s {
		uint32_t minor:8;
		uint32_t build:16;
	} phy;
	uint32_t rsvd:32;
	uint32_t drv_iface_ver:4;
	uint32_t rsvd:28;
};

struct link_status_s {
@@ -444,7 +445,7 @@ struct phy_fw_load_status_s {
	uint32_t rsvd2:2;
};

struct statistics_s {
struct statistics_a0_s {
	struct {
		uint32_t link_up;
		uint32_t link_down;
@@ -477,6 +478,33 @@ struct statistics_s {
	uint32_t reserve_fw_gap;
};

struct statistics_b0_s {
	uint64_t rx_good_octets;
	uint64_t rx_pause_frames;
	uint64_t rx_good_frames;
	uint64_t rx_errors;
	uint64_t rx_unicast_frames;
	uint64_t rx_multicast_frames;
	uint64_t rx_broadcast_frames;

	uint64_t tx_good_octets;
	uint64_t tx_pause_frames;
	uint64_t tx_good_frames;
	uint64_t tx_errors;
	uint64_t tx_unicast_frames;
	uint64_t tx_multicast_frames;
	uint64_t tx_broadcast_frames;

	uint32_t main_loop_cycles;
};

struct statistics_s {
	union {
		struct statistics_a0_s a0;
		struct statistics_b0_s b0;
	};
};

struct filter_caps_s {
	uint8_t l2_filters_base_index:6;
	uint8_t flexible_filter_mask:2;
@@ -590,7 +618,6 @@ struct fw_interface_out {
	struct core_dump_s core_dump;
	uint32_t rsvd11:32;
	struct statistics_s stats;
	uint32_t rsvd12:32;
	struct filter_caps_s filter_caps;
	struct device_caps_s device_caps;
	uint32_t rsvd13:32;
@@ -627,6 +654,9 @@ struct fw_iti_hdr {
#define ATL2_HOST_MODE_LOW_POWER    3
#define ATL2_HOST_MODE_SHUTDOWN     4

#define ATL2_FW_INTERFACE_A0     0
#define ATL2_FW_INTERFACE_B0     1

#define ATL2_FW_CABLE_STATUS_OPEN_CIRCUIT  7
#define ATL2_FW_CABLE_STATUS_HIGH_MISMATCH 6
#define ATL2_FW_CABLE_STATUS_LOW_MISMATCH  5
@@ -683,7 +713,6 @@ enum ATL2_WAKE_REASON {
};

int atl2_fw_init(struct atl_hw *hw);
int atl2_get_fw_version(struct atl_hw *hw, u32 *fw_version);
int atl2_fw_set_filter_policy(struct atl_hw *hw, bool promisc, bool allmulti);


+6 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
#include <linux/netdevice.h>
#include <linux/moduleparam.h>

#define ATL_VERSION "1.1.11"
#define ATL_VERSION "1.1.15"

struct atl_nic;

@@ -315,6 +315,7 @@ enum atl_priv_flags {
	ATL_PF_STATS_RESET,
	ATL_PF_STRIP_PAD,
	ATL_PF_MEDIA_DETECT,
	ATL_PF_DOWNSHIFT,
};

enum atl_priv_flag_bits {
@@ -339,9 +340,11 @@ enum atl_priv_flag_bits {

	ATL_DEF_PF_BIT(STRIP_PAD),
	ATL_DEF_PF_BIT(MEDIA_DETECT),
	ATL_DEF_PF_BIT(DOWNSHIFT),

	ATL_PF_RW_MASK = ATL_PF_LPB_MASK | ATL_PF_BIT(STATS_RESET) |
		ATL_PF_BIT(STRIP_PAD) | ATL_PF_BIT(MEDIA_DETECT),
		ATL_PF_BIT(STRIP_PAD) | ATL_PF_BIT(MEDIA_DETECT) |
		ATL_PF_BIT(DOWNSHIFT),
	ATL_PF_RO_MASK = ATL_PF_LPI_MASK,
};

@@ -397,6 +400,7 @@ void atl_clear_tdm_cache(struct atl_nic *nic);
int atl_alloc_rings(struct atl_nic *nic);
void atl_free_rings(struct atl_nic *nic);
irqreturn_t atl_ring_irq(int irq, void *priv);
irqreturn_t atl_ptp_irq(int irq, void *private);
void atl_ring_work(struct work_struct *work);
void atl_start_hw_global(struct atl_nic *nic);
int atl_intr_init(struct atl_nic *nic);
+15 −0
Original line number Diff line number Diff line
@@ -47,6 +47,21 @@

/* introduced in commit 72bb68721f80a1441e871b6afc9ab0b3793d5031 */
#define ATL_HAVE_IPV6_NTUPLE
#if RHEL_RELEASE_CODE == RHEL_RELEASE_VERSION(7, 3)
static inline void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
						    u32 legacy_u32)
{
	bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
	dst[0] = legacy_u32;
}
#endif
#else
#define __ETHTOOL_DECLARE_LINK_MODE_MASK(VAR) unsigned long VAR[1]
static inline void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
						    u32 legacy_u32)
{
	dst[0] = legacy_u32;
}
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,3)
+29 −6
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ static int atl_set_fixed_speed(struct atl_hw *hw, unsigned int speed,
{
	unsigned int dplx = (duplex == DUPLEX_HALF) ? DUPLEX_HALF : DUPLEX_FULL;
	struct atl_link_state *lstate = &hw->link_state;
	__ETHTOOL_DECLARE_LINK_MODE_MASK(link_modes);
	struct atl_link_type *type;
	unsigned long tmp;
	int i;
@@ -197,9 +198,9 @@ static int atl_set_fixed_speed(struct atl_hw *hw, unsigned int speed,

	if (lstate->eee_enabled) {
		atl_link_to_kernel(lstate->supported >> ATL_EEE_BIT_OFFT,
				   &tmp, false);
				   link_modes, false);
		/* advertize the supported links */
		tmp = atl_kernel_to_link(&tmp, false);
		tmp = atl_kernel_to_link(link_modes, false);
		lstate->advertized |= tmp << ATL_EEE_BIT_OFFT;
	}

@@ -479,6 +480,7 @@ static int atl_set_eee(struct net_device *ndev, struct ethtool_eee *eee)
	struct atl_nic *nic = netdev_priv(ndev);
	struct atl_hw *hw = &nic->hw;
	struct atl_link_state *lstate = &hw->link_state;
	__ETHTOOL_DECLARE_LINK_MODE_MASK(link_modes);
	unsigned long tmp = 0;

	if ((hw->chip_id == ATL_ATLANTIC) && (atl_fw_major(hw) < 2))
@@ -491,14 +493,15 @@ static int atl_set_eee(struct net_device *ndev, struct ethtool_eee *eee)

	if (lstate->eee_enabled) {
		atl_link_to_kernel(lstate->supported >> ATL_EEE_BIT_OFFT,
				   &tmp, false);
		if (eee->advertised & ~tmp)
				   link_modes, false);
		if (eee->advertised & ~link_modes[0])
			return -EINVAL;

		/* advertize the requested link or all supported */
		if (eee->advertised)
			tmp = eee->advertised;
		tmp = atl_kernel_to_link(&tmp, false);
			ethtool_convert_legacy_u32_to_link_mode(link_modes,
								eee->advertised);
		tmp = atl_kernel_to_link(link_modes, false);
	}

	lstate->advertized &= ~ATL_EEE_MASK;
@@ -628,6 +631,8 @@ static const struct atl_stat_desc rx_fwd_stat_descs[] = {

static const struct atl_stat_desc eth_stat_descs[] = {
	ATL_ETH_STAT(tx_pause, tx_pause),
	ATL_ETH_STAT(tx_ether_pkts, tx_ether_pkts),
	ATL_ETH_STAT(tx_ether_octets, tx_ether_octets),
	ATL_ETH_STAT(rx_pause, rx_pause),
	ATL_ETH_STAT(rx_ether_drops, rx_ether_drops),
	ATL_ETH_STAT(rx_ether_octets, rx_ether_octets),
@@ -655,6 +660,7 @@ static const char atl_priv_flags[][ETH_GSTRING_LEN] = {
	ATL_PRIV_FLAG(ResetStatistics, STATS_RESET),
	ATL_PRIV_FLAG(StripEtherPadding, STRIP_PAD),
	ATL_PRIV_FLAG(MediaDetect, MEDIA_DETECT),
	ATL_PRIV_FLAG(Downshift, DOWNSHIFT),
};

#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
@@ -1089,6 +1095,16 @@ int atl_set_media_detect(struct atl_nic *nic, bool on)
	return ret;
}

int atl_set_downshift(struct atl_nic *nic, bool on)
{
	struct atl_hw *hw = &nic->hw;
	int ret;

	ret = hw->mcp.ops->set_downshift(hw, on);

	return ret;
}

static uint32_t atl_get_priv_flags(struct net_device *ndev)
{
	struct atl_nic *nic = netdev_priv(ndev);
@@ -1129,6 +1145,13 @@ static int atl_set_priv_flags(struct net_device *ndev, uint32_t flags)
			return ret;
	}

	if (diff & ATL_PF_BIT(DOWNSHIFT)) {
		ret = atl_set_downshift(nic,
			!!(flags & ATL_PF_BIT(DOWNSHIFT)));
		if (ret)
			return ret;
	}

	if (hweight32(lpb) > 1) {
		atl_nic_err("Can't enable more than one loopback simultaneously\n");
		return -EINVAL;
Loading