A new user interface for you! Read more...

File 0001-Backport-alx-to-sp4-interfaces.patch of Package atheros-alx

From 759ac4fac234795d383abc4752a534c72775441c Mon Sep 17 00:00:00 2001
From: Benjamin Poirier <bpoirier@suse.com>
Date: Mon, 24 Oct 2016 11:01:33 +0900
Subject: Backport alx to sp4 interfaces

---
 drivers/net/ethernet/atheros/alx/hw.h   |  1 +
 drivers/net/ethernet/atheros/alx/main.c | 28 +++++++++++++++++-----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/atheros/alx/hw.h b/drivers/net/ethernet/atheros/alx/hw.h
index e42d7e0..0191477 100644
--- a/drivers/net/ethernet/atheros/alx/hw.h
+++ b/drivers/net/ethernet/atheros/alx/hw.h
@@ -351,6 +351,7 @@ struct alx_rrd {
 #define ALX_MAX_JUMBO_PKT_SIZE	(9*1024)
 #define ALX_MAX_TSO_PKT_SIZE	(7*1024)
 #define ALX_MAX_FRAME_SIZE	ALX_MAX_JUMBO_PKT_SIZE
+#define ALX_MIN_FRAME_SIZE	(ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN)
 
 #define ALX_MAX_RX_QUEUES	8
 #define ALX_MAX_TX_QUEUES	4
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index eccbacd..df4d8dc 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -892,9 +892,6 @@ static int alx_init_sw(struct alx_priv *alx)
 	hw->smb_timer = 400;
 	hw->mtu = alx->dev->mtu;
 	alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu);
-	/* MTU range: 34 - 9256 */
-	alx->dev->min_mtu = 34;
-	alx->dev->max_mtu = ALX_MAX_FRAME_LEN(ALX_MAX_FRAME_SIZE);
 	alx->tx_ringsz = 256;
 	alx->rx_ringsz = 512;
 	hw->imt = 200;
@@ -924,8 +921,8 @@ static int alx_init_sw(struct alx_priv *alx)
 }
 
 
-static netdev_features_t alx_fix_features(struct net_device *netdev,
-					  netdev_features_t features)
+static u32 alx_fix_features(struct net_device *netdev,
+					  u32 features)
 {
 	if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE)
 		features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
@@ -935,7 +932,7 @@ static netdev_features_t alx_fix_features(struct net_device *netdev,
 
 static void alx_netif_stop(struct alx_priv *alx)
 {
-	netif_trans_update(alx->dev);
+	alx->dev->trans_start = jiffies;
 	if (netif_carrier_ok(alx->dev)) {
 		netif_carrier_off(alx->dev);
 		netif_tx_disable(alx->dev);
@@ -997,6 +994,13 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
 	struct alx_priv *alx = netdev_priv(netdev);
 	int max_frame = ALX_MAX_FRAME_LEN(mtu);
 
+	if ((max_frame < ALX_MIN_FRAME_SIZE) ||
+	    (max_frame > ALX_MAX_FRAME_SIZE))
+		return -EINVAL;
+
+	if (netdev->mtu == mtu)
+		return 0;
+
 	netdev->mtu = mtu;
 	alx->hw.mtu = mtu;
 	alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);
@@ -1492,7 +1496,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct alx_priv *alx;
 	struct alx_hw *hw;
 	bool phy_configured;
-	int err;
+	int bars, err;
 
 	err = pci_enable_device_mem(pdev);
 	if (err)
@@ -1512,10 +1516,11 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		}
 	}
 
-	err = pci_request_mem_regions(pdev, alx_drv_name);
+	bars = pci_select_bars(pdev, IORESOURCE_MEM);
+	err = pci_request_selected_regions(pdev, bars, alx_drv_name);
 	if (err) {
 		dev_err(&pdev->dev,
-			"pci_request_mem_regions failed\n");
+			"pci_request_selected_regions failed(bars:%d)\n", bars);
 		goto out_pci_disable;
 	}
 
@@ -1644,7 +1649,7 @@ out_unmap:
 out_free_netdev:
 	free_netdev(netdev);
 out_pci_release:
-	pci_release_mem_regions(pdev);
+	pci_release_selected_regions(pdev, bars);
 out_pci_disable:
 	pci_disable_device(pdev);
 	return err;
@@ -1663,7 +1668,8 @@ static void alx_remove(struct pci_dev *pdev)
 
 	unregister_netdev(alx->dev);
 	iounmap(hw->hw_addr);
-	pci_release_mem_regions(pdev);
+	pci_release_selected_regions(pdev,
+				     pci_select_bars(pdev, IORESOURCE_MEM));
 
 	pci_disable_pcie_error_reporting(pdev);
 	pci_disable_device(pdev);
-- 
2.9.3