Commit e272bbc9 authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge branch 'add-functions-for-txgbe-aml-devices'

Jiawen Wu says:

====================
Support phylink and link/gpio irqs for AML 25G/10G devices, and complete
PTP and SRIOV.
====================

Link: https://patch.msgid.link/


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents e8c35bfc cdae5bcc
Loading
Loading
Loading
Loading
+8 −14
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ int wx_nway_reset(struct net_device *netdev)
{
	struct wx *wx = netdev_priv(netdev);

	if (wx->mac.type == wx_mac_aml)
	if (wx->mac.type == wx_mac_aml40)
		return -EOPNOTSUPP;

	return phylink_ethtool_nway_reset(wx->phylink);
@@ -231,9 +231,6 @@ int wx_get_link_ksettings(struct net_device *netdev,
{
	struct wx *wx = netdev_priv(netdev);

	if (wx->mac.type == wx_mac_aml)
		return -EOPNOTSUPP;

	return phylink_ethtool_ksettings_get(wx->phylink, cmd);
}
EXPORT_SYMBOL(wx_get_link_ksettings);
@@ -243,7 +240,7 @@ int wx_set_link_ksettings(struct net_device *netdev,
{
	struct wx *wx = netdev_priv(netdev);

	if (wx->mac.type == wx_mac_aml)
	if (wx->mac.type == wx_mac_aml40)
		return -EOPNOTSUPP;

	return phylink_ethtool_ksettings_set(wx->phylink, cmd);
@@ -255,7 +252,7 @@ void wx_get_pauseparam(struct net_device *netdev,
{
	struct wx *wx = netdev_priv(netdev);

	if (wx->mac.type == wx_mac_aml)
	if (wx->mac.type == wx_mac_aml40)
		return;

	phylink_ethtool_get_pauseparam(wx->phylink, pause);
@@ -267,7 +264,7 @@ int wx_set_pauseparam(struct net_device *netdev,
{
	struct wx *wx = netdev_priv(netdev);

	if (wx->mac.type == wx_mac_aml)
	if (wx->mac.type == wx_mac_aml40)
		return -EOPNOTSUPP;

	return phylink_ethtool_set_pauseparam(wx->phylink, pause);
@@ -345,6 +342,7 @@ int wx_set_coalesce(struct net_device *netdev,
		max_eitr = WX_SP_MAX_EITR;
		break;
	case wx_mac_aml:
	case wx_mac_aml40:
		max_eitr = WX_AML_MAX_EITR;
		break;
	default:
@@ -375,6 +373,7 @@ int wx_set_coalesce(struct net_device *netdev,
		switch (wx->mac.type) {
		case wx_mac_sp:
		case wx_mac_aml:
		case wx_mac_aml40:
			tx_itr_param = WX_12K_ITR;
			break;
		default:
@@ -413,15 +412,10 @@ static unsigned int wx_max_channels(struct wx *wx)
		max_combined = 1;
	} else {
		/* support up to max allowed queues with RSS */
		switch (wx->mac.type) {
		case wx_mac_sp:
		case wx_mac_aml:
		if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags))
			max_combined = 63;
			break;
		default:
		else
			max_combined = 8;
			break;
		}
	}

	return max_combined;
+17 −31
Original line number Diff line number Diff line
@@ -113,15 +113,10 @@ static void wx_intr_disable(struct wx *wx, u64 qmask)
	if (mask)
		wr32(wx, WX_PX_IMS(0), mask);

	switch (wx->mac.type) {
	case wx_mac_sp:
	case wx_mac_aml:
	if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		mask = (qmask >> 32);
		if (mask)
			wr32(wx, WX_PX_IMS(1), mask);
		break;
	default:
		break;
	}
}

@@ -133,15 +128,10 @@ void wx_intr_enable(struct wx *wx, u64 qmask)
	if (mask)
		wr32(wx, WX_PX_IMC(0), mask);

	switch (wx->mac.type) {
	case wx_mac_sp:
	case wx_mac_aml:
	if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		mask = (qmask >> 32);
		if (mask)
			wr32(wx, WX_PX_IMC(1), mask);
		break;
	default:
		break;
	}
}
EXPORT_SYMBOL(wx_intr_enable);
@@ -705,6 +695,7 @@ void wx_init_eeprom_params(struct wx *wx)
	switch (wx->mac.type) {
	case wx_mac_sp:
	case wx_mac_aml:
	case wx_mac_aml40:
		if (wx_read_ee_hostif(wx, WX_SW_REGION_PTR, &data)) {
			wx_err(wx, "NVM Read Error\n");
			return;
@@ -774,14 +765,8 @@ static int wx_set_rar(struct wx *wx, u32 index, u8 *addr, u64 pools,
	/* setup VMDq pool mapping */
	wr32(wx, WX_PSR_MAC_SWC_VM_L, pools & 0xFFFFFFFF);

	switch (wx->mac.type) {
	case wx_mac_sp:
	case wx_mac_aml:
	if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags))
		wr32(wx, WX_PSR_MAC_SWC_VM_H, pools >> 32);
		break;
	default:
		break;
	}

	/* HW expects these in little endian so we reverse the byte
	 * order from network order (big endian) to little endian
@@ -919,14 +904,9 @@ void wx_init_rx_addrs(struct wx *wx)

		wx_set_rar(wx, 0, wx->mac.addr, 0, WX_PSR_MAC_SWC_AD_H_AV);

		switch (wx->mac.type) {
		case wx_mac_sp:
		case wx_mac_aml:
		if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
			/* clear VMDq pool/queue selection for RAR 0 */
			wx_clear_vmdq(wx, 0, WX_CLEAR_VMDQ_ALL);
			break;
		default:
			break;
		}
	}

@@ -1512,7 +1492,7 @@ static void wx_configure_virtualization(struct wx *wx)
		wr32m(wx, WX_PSR_VM_L2CTL(pool),
		      WX_PSR_VM_L2CTL_AUPE, WX_PSR_VM_L2CTL_AUPE);

	if (wx->mac.type == wx_mac_em) {
	if (!test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		vf_shift = BIT(VMDQ_P(0));
		/* Enable only the PF pools for Tx/Rx */
		wr32(wx, WX_RDM_VF_RE(0), vf_shift);
@@ -1543,7 +1523,7 @@ static void wx_configure_port(struct wx *wx)
{
	u32 value, i;

	if (wx->mac.type == wx_mac_em) {
	if (!test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		value = (wx->num_vfs == 0) ?
			WX_CFG_PORT_CTL_NUM_VT_NONE :
			WX_CFG_PORT_CTL_NUM_VT_8;
@@ -2074,7 +2054,7 @@ static void wx_setup_psrtype(struct wx *wx)
		  WX_RDB_PL_CFG_TUN_OUTL2HDR |
		  WX_RDB_PL_CFG_TUN_TUNHDR;

	if (wx->mac.type == wx_mac_em) {
	if (!test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		for_each_set_bit(pool, &wx->fwd_bitmask, 8)
			wr32(wx, WX_RDB_PL_CFG(VMDQ_P(pool)), psrtype);
	} else {
@@ -2272,10 +2252,8 @@ int wx_stop_adapter(struct wx *wx)
}
EXPORT_SYMBOL(wx_stop_adapter);

void wx_reset_misc(struct wx *wx)
void wx_reset_mac(struct wx *wx)
{
	int i;

	/* receive packets that size > 2048 */
	wr32m(wx, WX_MAC_RX_CFG, WX_MAC_RX_CFG_JE, WX_MAC_RX_CFG_JE);

@@ -2287,6 +2265,14 @@ void wx_reset_misc(struct wx *wx)
	      WX_MAC_RX_FLOW_CTRL_RFE, WX_MAC_RX_FLOW_CTRL_RFE);

	wr32(wx, WX_MAC_PKT_FLT, WX_MAC_PKT_FLT_PR);
}
EXPORT_SYMBOL(wx_reset_mac);

void wx_reset_misc(struct wx *wx)
{
	int i;

	wx_reset_mac(wx);

	wr32m(wx, WX_MIS_RST_ST,
	      WX_MIS_RST_ST_RST_INIT, 0x1E00);
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ void wx_configure(struct wx *wx);
void wx_start_hw(struct wx *wx);
int wx_disable_pcie_master(struct wx *wx);
int wx_stop_adapter(struct wx *wx);
void wx_reset_mac(struct wx *wx);
void wx_reset_misc(struct wx *wx);
int wx_get_pcie_msix_counts(struct wx *wx, u16 *msix_count, u16 max_msix_count);
int wx_sw_init(struct wx *wx);
+38 −5
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include <net/ip6_checksum.h>
#include <net/page_pool/helpers.h>
#include <net/inet_ecn.h>
#include <linux/workqueue.h>
#include <linux/iopoll.h>
#include <linux/sctp.h>
#include <linux/pci.h>
@@ -1633,7 +1634,7 @@ static bool wx_set_vmdq_queues(struct wx *wx)
	/* Add starting offset to total pool count */
	vmdq_i += wx->ring_feature[RING_F_VMDQ].offset;

	if (wx->mac.type == wx_mac_sp) {
	if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		/* double check we are limited to maximum pools */
		vmdq_i = min_t(u16, 64, vmdq_i);

@@ -1693,7 +1694,7 @@ static void wx_set_rss_queues(struct wx *wx)

	/* set mask for 16 queue limit of RSS */
	f = &wx->ring_feature[RING_F_RSS];
	if (wx->mac.type == wx_mac_sp)
	if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags))
		f->mask = WX_RSS_64Q_MASK;
	else
		f->mask = WX_RSS_8Q_MASK;
@@ -1853,7 +1854,7 @@ static bool wx_cache_ring_vmdq(struct wx *wx)
	if (!test_bit(WX_FLAG_VMDQ_ENABLED, wx->flags))
		return false;

	if (wx->mac.type == wx_mac_sp) {
	if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
		/* start at VMDq register offset for SR-IOV enabled setups */
		reg_idx = vmdq->offset * __ALIGN_MASK(1, ~vmdq->mask);
		for (i = 0; i < wx->num_rx_queues; i++, reg_idx++) {
@@ -1959,6 +1960,7 @@ static int wx_alloc_q_vector(struct wx *wx,
	switch (wx->mac.type) {
	case wx_mac_sp:
	case wx_mac_aml:
	case wx_mac_aml40:
		default_itr = WX_12K_ITR;
		break;
	default:
@@ -2327,6 +2329,7 @@ void wx_write_eitr(struct wx_q_vector *q_vector)
		itr_reg = q_vector->itr & WX_SP_MAX_EITR;
		break;
	case wx_mac_aml:
	case wx_mac_aml40:
		itr_reg = (q_vector->itr >> 3) & WX_AML_MAX_EITR;
		break;
	default:
@@ -2354,10 +2357,10 @@ void wx_configure_vectors(struct wx *wx)

	if (pdev->msix_enabled) {
		/* Populate MSIX to EITR Select */
		if (wx->mac.type == wx_mac_sp) {
		if (test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
			if (wx->num_vfs >= 32)
				eitrsel = BIT(wx->num_vfs % 32) - 1;
		} else if (wx->mac.type == wx_mac_em) {
		} else {
			for (i = 0; i < wx->num_vfs; i++)
				eitrsel |= BIT(i);
		}
@@ -3093,5 +3096,35 @@ void wx_set_ring(struct wx *wx, u32 new_tx_count,
}
EXPORT_SYMBOL(wx_set_ring);

void wx_service_event_schedule(struct wx *wx)
{
	if (!test_and_set_bit(WX_STATE_SERVICE_SCHED, wx->state))
		queue_work(system_power_efficient_wq, &wx->service_task);
}
EXPORT_SYMBOL(wx_service_event_schedule);

void wx_service_event_complete(struct wx *wx)
{
	if (WARN_ON(!test_bit(WX_STATE_SERVICE_SCHED, wx->state)))
		return;

	/* flush memory to make sure state is correct before next watchdog */
	smp_mb__before_atomic();
	clear_bit(WX_STATE_SERVICE_SCHED, wx->state);
}
EXPORT_SYMBOL(wx_service_event_complete);

void wx_service_timer(struct timer_list *t)
{
	struct wx *wx = from_timer(wx, t, service_timer);
	unsigned long next_event_offset = HZ * 2;

	/* Reset the timer */
	mod_timer(&wx->service_timer, next_event_offset + jiffies);

	wx_service_event_schedule(wx);
}
EXPORT_SYMBOL(wx_service_timer);

MODULE_DESCRIPTION("Common library for Wangxun(R) Ethernet drivers.");
MODULE_LICENSE("GPL");
+3 −0
Original line number Diff line number Diff line
@@ -38,5 +38,8 @@ netdev_features_t wx_features_check(struct sk_buff *skb,
				    netdev_features_t features);
void wx_set_ring(struct wx *wx, u32 new_tx_count,
		 u32 new_rx_count, struct wx_ring *temp_ring);
void wx_service_event_schedule(struct wx *wx);
void wx_service_event_complete(struct wx *wx);
void wx_service_timer(struct timer_list *t);

#endif /* _WX_LIB_H_ */
Loading