Skip to content

Commit 50b17cf

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) We have to be careful to not try and place a checksum after the end of a rawv6 packet, fix from Dave Jones with help from Hannes Frederic Sowa. 2) Missing memory barriers in tcp_tasklet_func() lead to crashes, from Eric Dumazet. 3) Several bug fixes for the new XDP support in virtio_net, from Jason Wang. 4) Increase headroom in RX skbs in be2net driver to accomodate encapsulations such as geneve. From Kalesh A P. 5) Fix SKB frag unmapping on TX in mvpp2, from Thomas Petazzoni. 6) Pre-pulling UDP headers created a regression in RECVORIGDSTADDR socket option support, from Willem de Bruijn. 7) UID based routing added a potential OOPS in ip_do_redirect() when we see an SKB without a socket attached. We just need it for the network namespace which we can get from skb->dev instead. Fix from Lorenzo Colitti. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (30 commits) sctp: fix recovering from 0 win with small data chunks sctp: do not loose window information if in rwnd_over virtio-net: XDP support for small buffers virtio-net: remove big packet XDP codes virtio-net: forbid XDP when VIRTIO_NET_F_GUEST_UFO is support virtio-net: make rx buf size estimation works for XDP virtio-net: unbreak csumed packets for XDP_PASS virtio-net: correctly handle XDP_PASS for linearized packets virtio-net: fix page miscount during XDP linearizing virtio-net: correctly xmit linearized page on XDP_TX virtio-net: remove the warning before XDP linearizing mlxsw: spectrum_router: Correctly remove nexthop groups mlxsw: spectrum_router: Don't reflect dead neighs neigh: Send netevent after marking neigh as dead ipv6: handle -EFAULT from skb_copy_bits inet: fix IP(V6)_RECVORIGDSTADDR for udp sockets net/sched: cls_flower: Mandate mask when matching on flags net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6 stmmac: CSR clock configuration fix net: ipv4: Don't crash if passing a null sk to ip_do_redirect. ...
2 parents a307d0a + 1636098 commit 50b17cf

File tree

25 files changed

+197
-146
lines changed

25 files changed

+197
-146
lines changed

drivers/net/ethernet/emulex/benet/be.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/* Number of bytes of an RX frame that are copied to skb->data */
6666
#define BE_HDR_LEN ((u16) 64)
6767
/* allocate extra space to allow tunneling decapsulation without head reallocation */
68-
#define BE_RX_SKB_ALLOC_SIZE (BE_HDR_LEN + 64)
68+
#define BE_RX_SKB_ALLOC_SIZE 256
6969

7070
#define BE_MAX_JUMBO_FRAME_SIZE 9018
7171
#define BE_MIN_MTU 256

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,17 @@ struct mvpp2_rx_desc {
770770
u32 reserved8;
771771
};
772772

773+
struct mvpp2_txq_pcpu_buf {
774+
/* Transmitted SKB */
775+
struct sk_buff *skb;
776+
777+
/* Physical address of transmitted buffer */
778+
dma_addr_t phys;
779+
780+
/* Size transmitted */
781+
size_t size;
782+
};
783+
773784
/* Per-CPU Tx queue control */
774785
struct mvpp2_txq_pcpu {
775786
int cpu;
@@ -785,11 +796,8 @@ struct mvpp2_txq_pcpu {
785796
/* Number of Tx DMA descriptors reserved for each CPU */
786797
int reserved_num;
787798

788-
/* Array of transmitted skb */
789-
struct sk_buff **tx_skb;
790-
791-
/* Array of transmitted buffers' physical addresses */
792-
dma_addr_t *tx_buffs;
799+
/* Infos about transmitted buffers */
800+
struct mvpp2_txq_pcpu_buf *buffs;
793801

794802
/* Index of last TX DMA descriptor that was inserted */
795803
int txq_put_index;
@@ -979,10 +987,11 @@ static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu,
979987
struct sk_buff *skb,
980988
struct mvpp2_tx_desc *tx_desc)
981989
{
982-
txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb;
983-
if (skb)
984-
txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] =
985-
tx_desc->buf_phys_addr;
990+
struct mvpp2_txq_pcpu_buf *tx_buf =
991+
txq_pcpu->buffs + txq_pcpu->txq_put_index;
992+
tx_buf->skb = skb;
993+
tx_buf->size = tx_desc->data_size;
994+
tx_buf->phys = tx_desc->buf_phys_addr;
986995
txq_pcpu->txq_put_index++;
987996
if (txq_pcpu->txq_put_index == txq_pcpu->size)
988997
txq_pcpu->txq_put_index = 0;
@@ -4401,17 +4410,16 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
44014410
int i;
44024411

44034412
for (i = 0; i < num; i++) {
4404-
dma_addr_t buf_phys_addr =
4405-
txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];
4406-
struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];
4413+
struct mvpp2_txq_pcpu_buf *tx_buf =
4414+
txq_pcpu->buffs + txq_pcpu->txq_get_index;
44074415

44084416
mvpp2_txq_inc_get(txq_pcpu);
44094417

4410-
dma_unmap_single(port->dev->dev.parent, buf_phys_addr,
4411-
skb_headlen(skb), DMA_TO_DEVICE);
4412-
if (!skb)
4418+
dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
4419+
tx_buf->size, DMA_TO_DEVICE);
4420+
if (!tx_buf->skb)
44134421
continue;
4414-
dev_kfree_skb_any(skb);
4422+
dev_kfree_skb_any(tx_buf->skb);
44154423
}
44164424
}
44174425

@@ -4651,15 +4659,10 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
46514659
for_each_present_cpu(cpu) {
46524660
txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
46534661
txq_pcpu->size = txq->size;
4654-
txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *
4655-
sizeof(*txq_pcpu->tx_skb),
4656-
GFP_KERNEL);
4657-
if (!txq_pcpu->tx_skb)
4658-
goto error;
4659-
4660-
txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size *
4661-
sizeof(dma_addr_t), GFP_KERNEL);
4662-
if (!txq_pcpu->tx_buffs)
4662+
txq_pcpu->buffs = kmalloc(txq_pcpu->size *
4663+
sizeof(struct mvpp2_txq_pcpu_buf),
4664+
GFP_KERNEL);
4665+
if (!txq_pcpu->buffs)
46634666
goto error;
46644667

46654668
txq_pcpu->count = 0;
@@ -4673,8 +4676,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
46734676
error:
46744677
for_each_present_cpu(cpu) {
46754678
txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
4676-
kfree(txq_pcpu->tx_skb);
4677-
kfree(txq_pcpu->tx_buffs);
4679+
kfree(txq_pcpu->buffs);
46784680
}
46794681

46804682
dma_free_coherent(port->dev->dev.parent,
@@ -4693,8 +4695,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
46934695

46944696
for_each_present_cpu(cpu) {
46954697
txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
4696-
kfree(txq_pcpu->tx_skb);
4697-
kfree(txq_pcpu->tx_buffs);
4698+
kfree(txq_pcpu->buffs);
46984699
}
46994700

47004701
if (txq->descs)

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work)
942942
char rauht_pl[MLXSW_REG_RAUHT_LEN];
943943
struct net_device *dev;
944944
bool entry_connected;
945-
u8 nud_state;
945+
u8 nud_state, dead;
946946
bool updating;
947947
bool removing;
948948
bool adding;
@@ -953,10 +953,11 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work)
953953
dip = ntohl(*((__be32 *) n->primary_key));
954954
memcpy(neigh_entry->ha, n->ha, sizeof(neigh_entry->ha));
955955
nud_state = n->nud_state;
956+
dead = n->dead;
956957
dev = n->dev;
957958
read_unlock_bh(&n->lock);
958959

959-
entry_connected = nud_state & NUD_VALID;
960+
entry_connected = nud_state & NUD_VALID && !dead;
960961
adding = (!neigh_entry->offloaded) && entry_connected;
961962
updating = neigh_entry->offloaded && entry_connected;
962963
removing = neigh_entry->offloaded && !entry_connected;
@@ -1351,7 +1352,7 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
13511352
struct mlxsw_sp_neigh_entry *neigh_entry;
13521353
struct net_device *dev = fib_nh->nh_dev;
13531354
struct neighbour *n;
1354-
u8 nud_state;
1355+
u8 nud_state, dead;
13551356

13561357
/* Take a reference of neigh here ensuring that neigh would
13571358
* not be detructed before the nexthop entry is finished.
@@ -1383,8 +1384,9 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
13831384
list_add_tail(&nh->neigh_list_node, &neigh_entry->nexthop_list);
13841385
read_lock_bh(&n->lock);
13851386
nud_state = n->nud_state;
1387+
dead = n->dead;
13861388
read_unlock_bh(&n->lock);
1387-
__mlxsw_sp_nexthop_neigh_update(nh, !(nud_state & NUD_VALID));
1389+
__mlxsw_sp_nexthop_neigh_update(nh, !(nud_state & NUD_VALID && !dead));
13881390

13891391
return 0;
13901392
}
@@ -1394,6 +1396,7 @@ static void mlxsw_sp_nexthop_fini(struct mlxsw_sp *mlxsw_sp,
13941396
{
13951397
struct mlxsw_sp_neigh_entry *neigh_entry = nh->neigh_entry;
13961398

1399+
__mlxsw_sp_nexthop_neigh_update(nh, true);
13971400
list_del(&nh->neigh_list_node);
13981401

13991402
/* If that is the last nexthop connected to that neigh, remove from
@@ -1452,6 +1455,8 @@ mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp,
14521455
nh = &nh_grp->nexthops[i];
14531456
mlxsw_sp_nexthop_fini(mlxsw_sp, nh);
14541457
}
1458+
mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp);
1459+
WARN_ON_ONCE(nh_grp->adj_index_valid);
14551460
kfree(nh_grp);
14561461
}
14571462

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
864864
int ret;
865865
struct device *dev = &bsp_priv->pdev->dev;
866866

867+
ret = gmac_clk_enable(bsp_priv, true);
868+
if (ret)
869+
return ret;
870+
867871
/*rmii or rgmii*/
868872
if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_RGMII) {
869873
dev_info(dev, "init for RGMII\n");
@@ -880,10 +884,6 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
880884
if (ret)
881885
return ret;
882886

883-
ret = gmac_clk_enable(bsp_priv, true);
884-
if (ret)
885-
return ret;
886-
887887
pm_runtime_enable(dev);
888888
pm_runtime_get_sync(dev);
889889

drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
539539
mac->mii.reg_shift = 6;
540540
mac->mii.reg_mask = 0x000007C0;
541541
mac->mii.clk_csr_shift = 2;
542-
mac->mii.clk_csr_mask = 0xF;
542+
mac->mii.clk_csr_mask = GENMASK(5, 2);
543543

544544
/* Get and dump the chip ID */
545545
*synopsys_id = stmmac_get_synopsys_id(hwid);

drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ struct mac_device_info *dwmac100_setup(void __iomem *ioaddr, int *synopsys_id)
197197
mac->mii.reg_shift = 6;
198198
mac->mii.reg_mask = 0x000007C0;
199199
mac->mii.clk_csr_shift = 2;
200-
mac->mii.clk_csr_mask = 0xF;
200+
mac->mii.clk_csr_mask = GENMASK(5, 2);
201201

202202
/* Synopsys Id is not available on old chips */
203203
*synopsys_id = 0;

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
8181
value |= (phyaddr << priv->hw->mii.addr_shift)
8282
& priv->hw->mii.addr_mask;
8383
value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
84-
value |= (priv->clk_csr & priv->hw->mii.clk_csr_mask)
85-
<< priv->hw->mii.clk_csr_shift;
84+
value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
85+
& priv->hw->mii.clk_csr_mask;
8686
if (priv->plat->has_gmac4)
8787
value |= MII_GMAC4_READ;
8888

@@ -122,8 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
122122
& priv->hw->mii.addr_mask;
123123
value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
124124

125-
value |= ((priv->clk_csr & priv->hw->mii.clk_csr_mask)
126-
<< priv->hw->mii.clk_csr_shift);
125+
value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
126+
& priv->hw->mii.clk_csr_mask;
127127
if (priv->plat->has_gmac4)
128128
value |= MII_GMAC4_WRITE;
129129

drivers/net/fddi/skfp/hwmtm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ void mac_drv_clear_rx_queue(struct s_smc *smc)
14831483
r = queue->rx_curr_get ;
14841484
while (queue->rx_used) {
14851485
DRV_BUF_FLUSH(r,DDI_DMA_SYNC_FORCPU) ;
1486-
DB_RX("switch OWN bit of RxD 0x%x ",r,0,5) ;
1486+
DB_RX("switch OWN bit of RxD 0x%p ",r,0,5) ;
14871487
r->rxd_rbctrl &= ~cpu_to_le32(BMU_OWN) ;
14881488
frag_count = 1 ;
14891489
DRV_BUF_FLUSH(r,DDI_DMA_SYNC_FORDEV) ;
@@ -1645,7 +1645,7 @@ void hwm_tx_frag(struct s_smc *smc, char far *virt, u_long phys, int len,
16451645
DB_TX("hwm_tx_frag: len = %d, frame_status = %x ",len,frame_status,2) ;
16461646
if (frame_status & LAN_TX) {
16471647
/* '*t' is already defined */
1648-
DB_TX("LAN_TX: TxD = %x, virt = %x ",t,virt,3) ;
1648+
DB_TX("LAN_TX: TxD = %p, virt = %p ",t,virt,3) ;
16491649
t->txd_virt = virt ;
16501650
t->txd_txdscr = cpu_to_le32(smc->os.hwm.tx_descr) ;
16511651
t->txd_tbadr = cpu_to_le32(phys) ;
@@ -1819,7 +1819,7 @@ void smt_send_mbuf(struct s_smc *smc, SMbuf *mb, int fc)
18191819
__le32 tbctrl;
18201820

18211821
NDD_TRACE("THSB",mb,fc,0) ;
1822-
DB_TX("smt_send_mbuf: mb = 0x%x, fc = 0x%x",mb,fc,4) ;
1822+
DB_TX("smt_send_mbuf: mb = 0x%p, fc = 0x%x",mb,fc,4) ;
18231823

18241824
mb->sm_off-- ; /* set to fc */
18251825
mb->sm_len++ ; /* + fc */
@@ -1960,7 +1960,7 @@ static void mac_drv_clear_txd(struct s_smc *smc)
19601960

19611961
do {
19621962
DRV_BUF_FLUSH(t1,DDI_DMA_SYNC_FORCPU) ;
1963-
DB_TX("check OWN/EOF bit of TxD 0x%x",t1,0,5) ;
1963+
DB_TX("check OWN/EOF bit of TxD 0x%p",t1,0,5) ;
19641964
tbctrl = le32_to_cpu(CR_READ(t1->txd_tbctrl));
19651965

19661966
if (tbctrl & BMU_OWN || !queue->tx_used){
@@ -1988,7 +1988,7 @@ static void mac_drv_clear_txd(struct s_smc *smc)
19881988
}
19891989
else {
19901990
#ifndef PASS_1ST_TXD_2_TX_COMP
1991-
DB_TX("mac_drv_tx_comp for TxD 0x%x",t2,0,4) ;
1991+
DB_TX("mac_drv_tx_comp for TxD 0x%p",t2,0,4) ;
19921992
mac_drv_tx_complete(smc,t2) ;
19931993
#else
19941994
DB_TX("mac_drv_tx_comp for TxD 0x%x",
@@ -2052,7 +2052,7 @@ void mac_drv_clear_tx_queue(struct s_smc *smc)
20522052
tx_used = queue->tx_used ;
20532053
while (tx_used) {
20542054
DRV_BUF_FLUSH(t,DDI_DMA_SYNC_FORCPU) ;
2055-
DB_TX("switch OWN bit of TxD 0x%x ",t,0,5) ;
2055+
DB_TX("switch OWN bit of TxD 0x%p ",t,0,5) ;
20562056
t->txd_tbctrl &= ~cpu_to_le32(BMU_OWN) ;
20572057
DRV_BUF_FLUSH(t,DDI_DMA_SYNC_FORDEV) ;
20582058
t = t->txd_next ;

drivers/net/fddi/skfp/pmf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void smt_pmf_received_pack(struct s_smc *smc, SMbuf *mb, int local)
284284
SMbuf *reply ;
285285

286286
sm = smtod(mb,struct smt_header *) ;
287-
DB_SMT("SMT: processing PMF frame at %x len %d\n",sm,mb->sm_len) ;
287+
DB_SMT("SMT: processing PMF frame at %p len %d\n",sm,mb->sm_len) ;
288288
#ifdef DEBUG
289289
dump_smt(smc,sm,"PMF Received") ;
290290
#endif

drivers/net/fddi/skfp/smt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs)
504504
#endif
505505

506506
smt_swap_para(sm,(int) mb->sm_len,1) ;
507-
DB_SMT("SMT : received packet [%s] at 0x%x\n",
507+
DB_SMT("SMT : received packet [%s] at 0x%p\n",
508508
smt_type_name[m_fc(mb) & 0xf],sm) ;
509509
DB_SMT("SMT : version %d, class %s\n",sm->smt_version,
510510
smt_class_name[(sm->smt_class>LAST_CLASS)?0 : sm->smt_class]) ;

0 commit comments

Comments
 (0)