Skip to content

Commit 393159e

Browse files
committed
Merge branch 'xgbe-next'
Tom Lendacky says: ==================== amd-xgbe: AMD XGBE driver updates 2015-09-30 The following patches are included in this driver update series: - Remove unneeded semi-colon - Follow the DT/ACPI precedence used by the device_ APIs - Add ethtool support for getting and setting the msglevel - Add ethtool support error and debug messages - Simplify the hardware FIFO assignment calculations - Add receive buffer unavailable statistic - Use the device workqueue instead of the system workqueue - Remove the use of a link state bit This patch series is based on net-next. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents ac8cfc7 + 5078984 commit 393159e

File tree

6 files changed

+84
-155
lines changed

6 files changed

+84
-155
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-dev.c

Lines changed: 15 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,84 +1940,31 @@ static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata)
19401940
static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size,
19411941
unsigned int queue_count)
19421942
{
1943-
unsigned int q_fifo_size = 0;
1944-
enum xgbe_mtl_fifo_size p_fifo = XGMAC_MTL_FIFO_SIZE_256;
1943+
unsigned int q_fifo_size;
1944+
unsigned int p_fifo;
19451945

1946-
/* Calculate Tx/Rx fifo share per queue */
1947-
switch (fifo_size) {
1948-
case 0:
1949-
q_fifo_size = XGBE_FIFO_SIZE_B(128);
1950-
break;
1951-
case 1:
1952-
q_fifo_size = XGBE_FIFO_SIZE_B(256);
1953-
break;
1954-
case 2:
1955-
q_fifo_size = XGBE_FIFO_SIZE_B(512);
1956-
break;
1957-
case 3:
1958-
q_fifo_size = XGBE_FIFO_SIZE_KB(1);
1959-
break;
1960-
case 4:
1961-
q_fifo_size = XGBE_FIFO_SIZE_KB(2);
1962-
break;
1963-
case 5:
1964-
q_fifo_size = XGBE_FIFO_SIZE_KB(4);
1965-
break;
1966-
case 6:
1967-
q_fifo_size = XGBE_FIFO_SIZE_KB(8);
1968-
break;
1969-
case 7:
1970-
q_fifo_size = XGBE_FIFO_SIZE_KB(16);
1971-
break;
1972-
case 8:
1973-
q_fifo_size = XGBE_FIFO_SIZE_KB(32);
1974-
break;
1975-
case 9:
1976-
q_fifo_size = XGBE_FIFO_SIZE_KB(64);
1977-
break;
1978-
case 10:
1979-
q_fifo_size = XGBE_FIFO_SIZE_KB(128);
1980-
break;
1981-
case 11:
1982-
q_fifo_size = XGBE_FIFO_SIZE_KB(256);
1983-
break;
1984-
}
1946+
/* Calculate the configured fifo size */
1947+
q_fifo_size = 1 << (fifo_size + 7);
19851948

1986-
/* The configured value is not the actual amount of fifo RAM */
1949+
/* The configured value may not be the actual amount of fifo RAM */
19871950
q_fifo_size = min_t(unsigned int, XGBE_FIFO_MAX, q_fifo_size);
19881951

19891952
q_fifo_size = q_fifo_size / queue_count;
19901953

1991-
/* Set the queue fifo size programmable value */
1992-
if (q_fifo_size >= XGBE_FIFO_SIZE_KB(256))
1993-
p_fifo = XGMAC_MTL_FIFO_SIZE_256K;
1994-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(128))
1995-
p_fifo = XGMAC_MTL_FIFO_SIZE_128K;
1996-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(64))
1997-
p_fifo = XGMAC_MTL_FIFO_SIZE_64K;
1998-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(32))
1999-
p_fifo = XGMAC_MTL_FIFO_SIZE_32K;
2000-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(16))
2001-
p_fifo = XGMAC_MTL_FIFO_SIZE_16K;
2002-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(8))
2003-
p_fifo = XGMAC_MTL_FIFO_SIZE_8K;
2004-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(4))
2005-
p_fifo = XGMAC_MTL_FIFO_SIZE_4K;
2006-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(2))
2007-
p_fifo = XGMAC_MTL_FIFO_SIZE_2K;
2008-
else if (q_fifo_size >= XGBE_FIFO_SIZE_KB(1))
2009-
p_fifo = XGMAC_MTL_FIFO_SIZE_1K;
2010-
else if (q_fifo_size >= XGBE_FIFO_SIZE_B(512))
2011-
p_fifo = XGMAC_MTL_FIFO_SIZE_512;
2012-
else if (q_fifo_size >= XGBE_FIFO_SIZE_B(256))
2013-
p_fifo = XGMAC_MTL_FIFO_SIZE_256;
1954+
/* Each increment in the queue fifo size represents 256 bytes of
1955+
* fifo, with 0 representing 256 bytes. Distribute the fifo equally
1956+
* between the queues.
1957+
*/
1958+
p_fifo = q_fifo_size / 256;
1959+
if (p_fifo)
1960+
p_fifo--;
20141961

20151962
return p_fifo;
20161963
}
20171964

20181965
static void xgbe_config_tx_fifo_size(struct xgbe_prv_data *pdata)
20191966
{
2020-
enum xgbe_mtl_fifo_size fifo_size;
1967+
unsigned int fifo_size;
20211968
unsigned int i;
20221969

20231970
fifo_size = xgbe_calculate_per_queue_fifo(pdata->hw_feat.tx_fifo_size,
@@ -2033,7 +1980,7 @@ static void xgbe_config_tx_fifo_size(struct xgbe_prv_data *pdata)
20331980

20341981
static void xgbe_config_rx_fifo_size(struct xgbe_prv_data *pdata)
20351982
{
2036-
enum xgbe_mtl_fifo_size fifo_size;
1983+
unsigned int fifo_size;
20371984
unsigned int i;
20381985

20391986
fifo_size = xgbe_calculate_per_queue_fifo(pdata->hw_feat.rx_fifo_size,
@@ -2224,7 +2171,7 @@ static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo)
22242171

22252172
default:
22262173
read_hi = false;
2227-
};
2174+
}
22282175

22292176
val = XGMAC_IOREAD(pdata, reg_lo);
22302177

drivers/net/ethernet/amd/xgbe/xgbe-drv.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,12 @@ static irqreturn_t xgbe_isr(int irq, void *data)
360360
}
361361
}
362362

363+
if (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RBU))
364+
pdata->ext_stats.rx_buffer_unavailable++;
365+
363366
/* Restart the device on a Fatal Bus Error */
364367
if (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, FBE))
365-
schedule_work(&pdata->restart_work);
368+
queue_work(pdata->dev_workqueue, &pdata->restart_work);
366369

367370
/* Clear all interrupt signals */
368371
XGMAC_DMA_IOWRITE(channel, DMA_CH_SR, dma_ch_isr);
@@ -384,7 +387,8 @@ static irqreturn_t xgbe_isr(int irq, void *data)
384387
/* Read Tx Timestamp to clear interrupt */
385388
pdata->tx_tstamp =
386389
hw_if->get_tx_tstamp(pdata);
387-
schedule_work(&pdata->tx_tstamp_work);
390+
queue_work(pdata->dev_workqueue,
391+
&pdata->tx_tstamp_work);
388392
}
389393
}
390394
}
@@ -450,7 +454,7 @@ static void xgbe_service_timer(unsigned long data)
450454
{
451455
struct xgbe_prv_data *pdata = (struct xgbe_prv_data *)data;
452456

453-
schedule_work(&pdata->service_work);
457+
queue_work(pdata->dev_workqueue, &pdata->service_work);
454458

455459
mod_timer(&pdata->service_timer, jiffies + HZ);
456460
}
@@ -891,7 +895,7 @@ static int xgbe_start(struct xgbe_prv_data *pdata)
891895
netif_tx_start_all_queues(netdev);
892896

893897
xgbe_start_timers(pdata);
894-
schedule_work(&pdata->service_work);
898+
queue_work(pdata->dev_workqueue, &pdata->service_work);
895899

896900
DBGPR("<--xgbe_start\n");
897901

@@ -1533,7 +1537,7 @@ static void xgbe_tx_timeout(struct net_device *netdev)
15331537
struct xgbe_prv_data *pdata = netdev_priv(netdev);
15341538

15351539
netdev_warn(netdev, "tx timeout, device restarting\n");
1536-
schedule_work(&pdata->restart_work);
1540+
queue_work(pdata->dev_workqueue, &pdata->restart_work);
15371541
}
15381542

15391543
static struct rtnl_link_stats64 *xgbe_get_stats64(struct net_device *netdev,

0 commit comments

Comments
 (0)