Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
  • Loading branch information
davem330 committed Nov 7, 2014
2 parents 5c91ae0 + 9d01412 commit 4e84b49
Show file tree
Hide file tree
Showing 34 changed files with 244 additions and 166 deletions.
14 changes: 14 additions & 0 deletions Documentation/networking/ip-sysctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ ip_forward_use_pmtu - BOOLEAN
0 - disabled
1 - enabled

fwmark_reflect - BOOLEAN
Controls the fwmark of kernel-generated IPv4 reply packets that are not
associated with a socket for example, TCP RSTs or ICMP echo replies).
If unset, these packets have a fwmark of zero. If set, they have the
fwmark of the packet they are replying to.
Default: 0

route/max_size - INTEGER
Maximum number of routes allowed in the kernel. Increase
this when using large numbers of interfaces and/or routes.
Expand Down Expand Up @@ -1209,6 +1216,13 @@ conf/all/forwarding - BOOLEAN
proxy_ndp - BOOLEAN
Do proxy ndp.

fwmark_reflect - BOOLEAN
Controls the fwmark of kernel-generated IPv6 reply packets that are not
associated with a socket for example, TCP RSTs or ICMPv6 echo replies).
If unset, these packets have a fwmark of zero. If set, they have the
fwmark of the packet they are replying to.
Default: 0

conf/interface/*:
Change special settings per interface.

Expand Down
10 changes: 5 additions & 5 deletions arch/arm64/boot/dts/apm-storm.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
compatible = "apm,xgene-enet";
status = "disabled";
reg = <0x0 0x17020000 0x0 0xd100>,
<0x0 0X17030000 0x0 0X400>,
<0x0 0X17030000 0x0 0Xc300>,
<0x0 0X10000000 0x0 0X200>;
reg-names = "enet_csr", "ring_csr", "ring_cmd";
interrupts = <0x0 0x3c 0x4>;
Expand All @@ -624,9 +624,9 @@
sgenet0: ethernet@1f210000 {
compatible = "apm,xgene-enet";
status = "disabled";
reg = <0x0 0x1f210000 0x0 0x10000>,
<0x0 0x1f200000 0x0 0X10000>,
<0x0 0x1B000000 0x0 0X20000>;
reg = <0x0 0x1f210000 0x0 0xd100>,
<0x0 0x1f200000 0x0 0Xc300>,
<0x0 0x1B000000 0x0 0X200>;
reg-names = "enet_csr", "ring_csr", "ring_cmd";
interrupts = <0x0 0xA0 0x4>;
dma-coherent;
Expand All @@ -639,7 +639,7 @@
compatible = "apm,xgene-enet";
status = "disabled";
reg = <0x0 0x1f610000 0x0 0xd100>,
<0x0 0x1f600000 0x0 0X400>,
<0x0 0x1f600000 0x0 0Xc300>,
<0x0 0x18000000 0x0 0X200>;
reg-names = "enet_csr", "ring_csr", "ring_cmd";
interrupts = <0x0 0x60 0x4>;
Expand Down
18 changes: 17 additions & 1 deletion drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,24 @@ static void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata)
xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN);
}

static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
bool xgene_ring_mgr_init(struct xgene_enet_pdata *p)
{
if (!ioread32(p->ring_csr_addr + CLKEN_ADDR))
return false;

if (ioread32(p->ring_csr_addr + SRST_ADDR))
return false;

return true;
}

static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
{
u32 val;

if (!xgene_ring_mgr_init(pdata))
return -ENODEV;

clk_prepare_enable(pdata->clk);
clk_disable_unprepare(pdata->clk);
clk_prepare_enable(pdata->clk);
Expand All @@ -590,6 +604,8 @@ static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
val |= SCAN_AUTO_INCR;
MGMT_CLOCK_SEL_SET(&val, 1);
xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val);

return 0;
}

static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ enum xgene_enet_rm {
#define BLOCK_ETH_MAC_OFFSET 0x0000
#define BLOCK_ETH_MAC_CSR_OFFSET 0x2800

#define CLKEN_ADDR 0xc208
#define SRST_ADDR 0xc200

#define MAC_ADDR_REG_OFFSET 0x00
#define MAC_COMMAND_REG_OFFSET 0x04
#define MAC_WRITE_REG_OFFSET 0x08
Expand Down Expand Up @@ -318,6 +321,7 @@ void xgene_enet_parse_error(struct xgene_enet_desc_ring *ring,

int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata);
void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata);
bool xgene_ring_mgr_init(struct xgene_enet_pdata *p);

extern struct xgene_mac_ops xgene_gmac_ops;
extern struct xgene_port_ops xgene_gport_ops;
Expand Down
11 changes: 7 additions & 4 deletions drivers/net/ethernet/apm/xgene/xgene_enet_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,9 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev)
struct device *dev = ndev_to_dev(ndev);
struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring;
struct xgene_enet_desc_ring *buf_pool = NULL;
u8 cpu_bufnum = 0, eth_bufnum = 0;
u8 bp_bufnum = 0x20;
u16 ring_id, ring_num = 0;
u8 cpu_bufnum = 0, eth_bufnum = START_ETH_BUFNUM;
u8 bp_bufnum = START_BP_BUFNUM;
u16 ring_id, ring_num = START_RING_NUM;
int ret;

/* allocate rx descriptor ring */
Expand Down Expand Up @@ -840,7 +840,9 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
u16 dst_ring_num;
int ret;

pdata->port_ops->reset(pdata);
ret = pdata->port_ops->reset(pdata);
if (ret)
return ret;

ret = xgene_enet_create_desc_rings(ndev);
if (ret) {
Expand Down Expand Up @@ -942,6 +944,7 @@ static int xgene_enet_probe(struct platform_device *pdev)

return ret;
err:
unregister_netdev(ndev);
free_netdev(ndev);
return ret;
}
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ethernet/apm/xgene/xgene_enet_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN)
#define NUM_PKT_BUF 64
#define NUM_BUFPOOL 32
#define START_ETH_BUFNUM 2
#define START_BP_BUFNUM 0x22
#define START_RING_NUM 8

#define PHY_POLL_LINK_ON (10 * HZ)
#define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5)
Expand Down Expand Up @@ -83,7 +86,7 @@ struct xgene_mac_ops {
};

struct xgene_port_ops {
void (*reset)(struct xgene_enet_pdata *pdata);
int (*reset)(struct xgene_enet_pdata *pdata);
void (*cle_bypass)(struct xgene_enet_pdata *pdata,
u32 dst_ring_num, u16 bufpool_id);
void (*shutdown)(struct xgene_enet_pdata *pdata);
Expand Down
7 changes: 6 additions & 1 deletion drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,19 @@ static void xgene_sgmac_tx_disable(struct xgene_enet_pdata *p)
xgene_sgmac_rxtx(p, TX_EN, false);
}

static void xgene_enet_reset(struct xgene_enet_pdata *p)
static int xgene_enet_reset(struct xgene_enet_pdata *p)
{
if (!xgene_ring_mgr_init(p))
return -ENODEV;

clk_prepare_enable(p->clk);
clk_disable_unprepare(p->clk);
clk_prepare_enable(p->clk);

xgene_enet_ecc_init(p);
xgene_enet_config_ring_if_assoc(p);

return 0;
}

static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
Expand Down
7 changes: 6 additions & 1 deletion drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,19 @@ static void xgene_xgmac_tx_disable(struct xgene_enet_pdata *pdata)
xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN);
}

static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
{
if (!xgene_ring_mgr_init(pdata))
return -ENODEV;

clk_prepare_enable(pdata->clk);
clk_disable_unprepare(pdata->clk);
clk_prepare_enable(pdata->clk);

xgene_enet_ecc_init(pdata);
xgene_enet_config_ring_if_assoc(pdata);

return 0;
}

static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
Expand Down
13 changes: 11 additions & 2 deletions drivers/net/ethernet/broadcom/bcmsysport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,
/* We just need one DMA descriptor which is DMA-able, since writing to
* the port will allocate a new descriptor in its internal linked-list
*/
p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL);
p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma,
GFP_KERNEL);
if (!p) {
netif_err(priv, hw, priv->netdev, "DMA alloc failed\n");
return -ENOMEM;
Expand Down Expand Up @@ -1174,6 +1175,13 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
if (!(reg & TDMA_DISABLED))
netdev_warn(priv->netdev, "TDMA not stopped!\n");

/* ring->cbs is the last part in bcm_sysport_init_tx_ring which could
* fail, so by checking this pointer we know whether the TX ring was
* fully initialized or not.
*/
if (!ring->cbs)
return;

napi_disable(&ring->napi);
netif_napi_del(&ring->napi);

Expand All @@ -1183,7 +1191,8 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
ring->cbs = NULL;

if (ring->desc_dma) {
dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma);
dma_free_coherent(kdev, sizeof(struct dma_desc),
ring->desc_cpu, ring->desc_dma);
ring->desc_dma = 0;
}
ring->size = 0;
Expand Down
20 changes: 8 additions & 12 deletions drivers/net/ethernet/cisco/enic/enic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,18 +940,8 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq)
struct vnic_rq_buf *buf = rq->to_use;

if (buf->os_buf) {
buf = buf->next;
rq->to_use = buf;
rq->ring.desc_avail--;
if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) {
/* Adding write memory barrier prevents compiler and/or
* CPU reordering, thus avoiding descriptor posting
* before descriptor is initialized. Otherwise, hardware
* can read stale descriptor fields.
*/
wmb();
iowrite32(buf->index, &rq->ctrl->posted_index);
}
enic_queue_rq_desc(rq, buf->os_buf, os_buf_index, buf->dma_addr,
buf->len);

return 0;
}
Expand Down Expand Up @@ -1037,7 +1027,10 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
enic->rq_truncated_pkts++;
}

pci_unmap_single(enic->pdev, buf->dma_addr, buf->len,
PCI_DMA_FROMDEVICE);
dev_kfree_skb_any(skb);
buf->os_buf = NULL;

return;
}
Expand Down Expand Up @@ -1088,7 +1081,10 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
/* Buffer overflow
*/

pci_unmap_single(enic->pdev, buf->dma_addr, buf->len,
PCI_DMA_FROMDEVICE);
dev_kfree_skb_any(skb);
buf->os_buf = NULL;
}
}

Expand Down
16 changes: 8 additions & 8 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3343,12 +3343,11 @@ static int __maybe_unused fec_suspend(struct device *dev)
netif_device_detach(ndev);
netif_tx_unlock_bh(ndev);
fec_stop(ndev);
fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
}
rtnl_unlock();

fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);

if (fep->reg_phy)
regulator_disable(fep->reg_phy);

Expand All @@ -3367,13 +3366,14 @@ static int __maybe_unused fec_resume(struct device *dev)
return ret;
}

pinctrl_pm_select_default_state(&fep->pdev->dev);
ret = fec_enet_clk_enable(ndev, true);
if (ret)
goto failed_clk;

rtnl_lock();
if (netif_running(ndev)) {
pinctrl_pm_select_default_state(&fep->pdev->dev);
ret = fec_enet_clk_enable(ndev, true);
if (ret) {
rtnl_unlock();
goto failed_clk;
}
fec_restart(ndev);
netif_tx_lock_bh(ndev);
netif_device_attach(ndev);
Expand Down
18 changes: 10 additions & 8 deletions drivers/net/ethernet/marvell/mv643xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,6 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
int tx_index;
struct tx_desc *desc;
u32 cmd_sts;
struct sk_buff *skb;

tx_index = txq->tx_used_desc;
desc = &txq->tx_desc_area[tx_index];
Expand All @@ -1066,19 +1065,22 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
reclaimed++;
txq->tx_desc_count--;

skb = NULL;
if (cmd_sts & TX_LAST_DESC)
skb = __skb_dequeue(&txq->tx_skb);
if (!IS_TSO_HEADER(txq, desc->buf_ptr))
dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
desc->byte_cnt, DMA_TO_DEVICE);

if (cmd_sts & TX_ENABLE_INTERRUPT) {
struct sk_buff *skb = __skb_dequeue(&txq->tx_skb);

if (!WARN_ON(!skb))
dev_kfree_skb(skb);
}

if (cmd_sts & ERROR_SUMMARY) {
netdev_info(mp->dev, "tx error\n");
mp->dev->stats.tx_errors++;
}

if (!IS_TSO_HEADER(txq, desc->buf_ptr))
dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
desc->byte_cnt, DMA_TO_DEVICE);
dev_kfree_skb(skb);
}

__netif_tx_unlock_bh(nq);
Expand Down
Loading

0 comments on commit 4e84b49

Please sign in to comment.