Skip to content

Commit 49d8137

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) We've discovered a common error in several networking drivers, they put VLAN offload features into ->vlan_features, which would suggest that they support offloading 2 or more levels of VLAN encapsulation. Not only do these devices not do that, but we don't have the infrastructure yet to handle that at all. Fixes from Vlad Yasevich. 2) Fix tcpdump crash with bridging and vlans, also from Vlad. 3) Some MAINTAINERS updates for random32 and bonding. 4) Fix late reseeds of prandom generator, from Sasha Levin. 5) Bridge doesn't handle stacked vlans properly, fix from Toshiaki Makita. 6) Fix deadlock in openvswitch, from Flavio Leitner. 7) get_timewait4_sock() doesn't report delay times correctly, fix from Eric Dumazet. 8) Duplicate address detection and addrconf verification need to run in contexts where RTNL can be obtained. Move them to run from a workqueue. From Hannes Frederic Sowa. 9) Fix route refcount leaking in ip tunnels, from Pravin B Shelar. 10) Don't return -EINTR from non-blocking recvmsg() on AF_UNIX sockets, from Eric Dumazet. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (28 commits) vlan: Warn the user if lowerdev has bad vlan features. veth: Turn off vlan rx acceleration in vlan_features ifb: Remove vlan acceleration from vlan_features qlge: Do not propaged vlan tag offloads to vlans bridge: Fix crash with vlan filtering and tcpdump net: Account for all vlan headers in skb_mac_gso_segment MAINTAINERS: bonding: change email address MAINTAINERS: bonding: change email address ipv6: move DAD and addrconf_verify processing to workqueue tcp: fix get_timewait4_sock() delay computation on 64bit openvswitch: fix a possible deadlock and lockdep warning bridge: Fix handling stacked vlan tags bridge: Fix inabillity to retrieve vlan tags when tx offload is disabled vhost: validate vhost_get_vq_desc return value vhost: fix total length when packets are too short random32: avoid attempt to late reseed if in the middle of seeding random32: assign to network folks in MAINTAINERS net/mlx4_core: pass pci_device_id.driver_data to __mlx4_init_one during reset core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors vlan: Set hard_header_len according to available acceleration ...
2 parents bc53267 + 5f2feca commit 49d8137

File tree

32 files changed

+363
-195
lines changed

32 files changed

+363
-195
lines changed

MAINTAINERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,8 +1832,8 @@ F: net/bluetooth/
18321832
F: include/net/bluetooth/
18331833

18341834
BONDING DRIVER
1835-
M: Jay Vosburgh <fubar@us.ibm.com>
1836-
M: Veaceslav Falico <vfalico@redhat.com>
1835+
M: Jay Vosburgh <j.vosburgh@gmail.com>
1836+
M: Veaceslav Falico <vfalico@gmail.com>
18371837
M: Andy Gospodarek <andy@greyhouse.net>
18381838
L: netdev@vger.kernel.org
18391839
W: http://sourceforge.net/projects/bonding/
@@ -6006,6 +6006,7 @@ F: include/uapi/linux/net.h
60066006
F: include/uapi/linux/netdevice.h
60076007
F: tools/net/
60086008
F: tools/testing/selftests/net/
6009+
F: lib/random32.c
60096010

60106011
NETWORKING [IPv4/IPv6]
60116012
M: "David S. Miller" <davem@davemloft.net>

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17649,8 +17649,6 @@ static int tg3_init_one(struct pci_dev *pdev,
1764917649

1765017650
tg3_init_bufmgr_config(tp);
1765117651

17652-
features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
17653-
1765417652
/* 5700 B0 chips do not support checksumming correctly due
1765517653
* to hardware bugs.
1765617654
*/
@@ -17682,7 +17680,8 @@ static int tg3_init_one(struct pci_dev *pdev,
1768217680
features |= NETIF_F_TSO_ECN;
1768317681
}
1768417682

17685-
dev->features |= features;
17683+
dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX |
17684+
NETIF_F_HW_VLAN_CTAG_RX;
1768617685
dev->vlan_features |= features;
1768717686

1768817687
/*

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/interrupt.h>
2323
#include <net/ip.h>
2424
#include <net/ipv6.h>
25+
#include <linux/io.h>
2526
#include <linux/of.h>
2627
#include <linux/of_irq.h>
2728
#include <linux/of_mdio.h>
@@ -88,8 +89,9 @@
8889
#define MVNETA_TX_IN_PRGRS BIT(1)
8990
#define MVNETA_TX_FIFO_EMPTY BIT(8)
9091
#define MVNETA_RX_MIN_FRAME_SIZE 0x247c
91-
#define MVNETA_SGMII_SERDES_CFG 0x24A0
92+
#define MVNETA_SERDES_CFG 0x24A0
9293
#define MVNETA_SGMII_SERDES_PROTO 0x0cc7
94+
#define MVNETA_RGMII_SERDES_PROTO 0x0667
9395
#define MVNETA_TYPE_PRIO 0x24bc
9496
#define MVNETA_FORCE_UNI BIT(21)
9597
#define MVNETA_TXQ_CMD_1 0x24e4
@@ -161,7 +163,7 @@
161163
#define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc
162164
#define MVNETA_GMAC0_PORT_ENABLE BIT(0)
163165
#define MVNETA_GMAC_CTRL_2 0x2c08
164-
#define MVNETA_GMAC2_PSC_ENABLE BIT(3)
166+
#define MVNETA_GMAC2_PCS_ENABLE BIT(3)
165167
#define MVNETA_GMAC2_PORT_RGMII BIT(4)
166168
#define MVNETA_GMAC2_PORT_RESET BIT(6)
167169
#define MVNETA_GMAC_STATUS 0x2c10
@@ -710,35 +712,6 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
710712
mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
711713
}
712714

713-
714-
715-
/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
716-
static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
717-
{
718-
u32 val;
719-
720-
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
721-
722-
if (enable)
723-
val |= MVNETA_GMAC2_PORT_RGMII;
724-
else
725-
val &= ~MVNETA_GMAC2_PORT_RGMII;
726-
727-
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
728-
}
729-
730-
/* Config SGMII port */
731-
static void mvneta_port_sgmii_config(struct mvneta_port *pp)
732-
{
733-
u32 val;
734-
735-
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
736-
val |= MVNETA_GMAC2_PSC_ENABLE;
737-
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
738-
739-
mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
740-
}
741-
742715
/* Start the Ethernet port RX and TX activity */
743716
static void mvneta_port_up(struct mvneta_port *pp)
744717
{
@@ -2756,12 +2729,15 @@ static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
27562729
mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
27572730

27582731
if (phy_mode == PHY_INTERFACE_MODE_SGMII)
2759-
mvneta_port_sgmii_config(pp);
2732+
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
2733+
else
2734+
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_RGMII_SERDES_PROTO);
2735+
2736+
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
27602737

2761-
mvneta_gmac_rgmii_set(pp, 1);
2738+
val |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
27622739

27632740
/* Cancel Port Reset */
2764-
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
27652741
val &= ~MVNETA_GMAC2_PORT_RESET;
27662742
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
27672743

@@ -2774,6 +2750,7 @@ static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
27742750
static int mvneta_probe(struct platform_device *pdev)
27752751
{
27762752
const struct mbus_dram_target_info *dram_target_info;
2753+
struct resource *res;
27772754
struct device_node *dn = pdev->dev.of_node;
27782755
struct device_node *phy_node;
27792756
u32 phy_addr;
@@ -2838,17 +2815,23 @@ static int mvneta_probe(struct platform_device *pdev)
28382815

28392816
clk_prepare_enable(pp->clk);
28402817

2841-
pp->base = of_iomap(dn, 0);
2818+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2819+
if (!res) {
2820+
err = -ENODEV;
2821+
goto err_clk;
2822+
}
2823+
2824+
pp->base = devm_ioremap_resource(&pdev->dev, res);
28422825
if (pp->base == NULL) {
2843-
err = -ENOMEM;
2826+
err = PTR_ERR(pp->base);
28442827
goto err_clk;
28452828
}
28462829

28472830
/* Alloc per-cpu stats */
28482831
pp->stats = alloc_percpu(struct mvneta_pcpu_stats);
28492832
if (!pp->stats) {
28502833
err = -ENOMEM;
2851-
goto err_unmap;
2834+
goto err_clk;
28522835
}
28532836

28542837
for_each_possible_cpu(cpu) {
@@ -2913,8 +2896,6 @@ static int mvneta_probe(struct platform_device *pdev)
29132896
mvneta_deinit(pp);
29142897
err_free_stats:
29152898
free_percpu(pp->stats);
2916-
err_unmap:
2917-
iounmap(pp->base);
29182899
err_clk:
29192900
clk_disable_unprepare(pp->clk);
29202901
err_free_irq:
@@ -2934,7 +2915,6 @@ static int mvneta_remove(struct platform_device *pdev)
29342915
mvneta_deinit(pp);
29352916
clk_disable_unprepare(pp->clk);
29362917
free_percpu(pp->stats);
2937-
iounmap(pp->base);
29382918
irq_dispose_mapping(dev->irq);
29392919
free_netdev(dev);
29402920

drivers/net/ethernet/mellanox/mlx4/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,11 @@ static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev,
26812681

26822682
static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev)
26832683
{
2684-
int ret = __mlx4_init_one(pdev, 0);
2684+
const struct pci_device_id *id;
2685+
int ret;
2686+
2687+
id = pci_match_id(mlx4_pci_table, pdev);
2688+
ret = __mlx4_init_one(pdev, id->driver_data);
26852689

26862690
return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
26872691
}

drivers/net/ethernet/qlogic/qlge/qlge_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4765,7 +4765,9 @@ static int qlge_probe(struct pci_dev *pdev,
47654765
ndev->features = ndev->hw_features;
47664766
ndev->vlan_features = ndev->hw_features;
47674767
/* vlan gets same features (except vlan filter) */
4768-
ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
4768+
ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER |
4769+
NETIF_F_HW_VLAN_CTAG_TX |
4770+
NETIF_F_HW_VLAN_CTAG_RX);
47694771

47704772
if (test_bit(QL_DMA64, &qdev->flags))
47714773
ndev->features |= NETIF_F_HIGHDMA;

drivers/net/ifb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ static void ifb_setup(struct net_device *dev)
180180
dev->tx_queue_len = TX_Q_LIMIT;
181181

182182
dev->features |= IFB_FEATURES;
183-
dev->vlan_features |= IFB_FEATURES;
183+
dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
184+
NETIF_F_HW_VLAN_STAG_TX);
184185

185186
dev->flags |= IFF_NOARP;
186187
dev->flags &= ~IFF_MULTICAST;

drivers/net/usb/usbnet.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -752,14 +752,12 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
752752
// precondition: never called in_interrupt
753753
static void usbnet_terminate_urbs(struct usbnet *dev)
754754
{
755-
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup);
756755
DECLARE_WAITQUEUE(wait, current);
757756
int temp;
758757

759758
/* ensure there are no more active urbs */
760-
add_wait_queue(&unlink_wakeup, &wait);
759+
add_wait_queue(&dev->wait, &wait);
761760
set_current_state(TASK_UNINTERRUPTIBLE);
762-
dev->wait = &unlink_wakeup;
763761
temp = unlink_urbs(dev, &dev->txq) +
764762
unlink_urbs(dev, &dev->rxq);
765763

@@ -773,15 +771,14 @@ static void usbnet_terminate_urbs(struct usbnet *dev)
773771
"waited for %d urb completions\n", temp);
774772
}
775773
set_current_state(TASK_RUNNING);
776-
dev->wait = NULL;
777-
remove_wait_queue(&unlink_wakeup, &wait);
774+
remove_wait_queue(&dev->wait, &wait);
778775
}
779776

780777
int usbnet_stop (struct net_device *net)
781778
{
782779
struct usbnet *dev = netdev_priv(net);
783780
struct driver_info *info = dev->driver_info;
784-
int retval;
781+
int retval, pm;
785782

786783
clear_bit(EVENT_DEV_OPEN, &dev->flags);
787784
netif_stop_queue (net);
@@ -791,6 +788,8 @@ int usbnet_stop (struct net_device *net)
791788
net->stats.rx_packets, net->stats.tx_packets,
792789
net->stats.rx_errors, net->stats.tx_errors);
793790

791+
/* to not race resume */
792+
pm = usb_autopm_get_interface(dev->intf);
794793
/* allow minidriver to stop correctly (wireless devices to turn off
795794
* radio etc) */
796795
if (info->stop) {
@@ -817,6 +816,9 @@ int usbnet_stop (struct net_device *net)
817816
dev->flags = 0;
818817
del_timer_sync (&dev->delay);
819818
tasklet_kill (&dev->bh);
819+
if (!pm)
820+
usb_autopm_put_interface(dev->intf);
821+
820822
if (info->manage_power &&
821823
!test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags))
822824
info->manage_power(dev, 0);
@@ -1437,11 +1439,12 @@ static void usbnet_bh (unsigned long param)
14371439
/* restart RX again after disabling due to high error rate */
14381440
clear_bit(EVENT_RX_KILL, &dev->flags);
14391441

1440-
// waiting for all pending urbs to complete?
1441-
if (dev->wait) {
1442-
if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) {
1443-
wake_up (dev->wait);
1444-
}
1442+
/* waiting for all pending urbs to complete?
1443+
* only then can we forgo submitting anew
1444+
*/
1445+
if (waitqueue_active(&dev->wait)) {
1446+
if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0)
1447+
wake_up_all(&dev->wait);
14451448

14461449
// or are we maybe short a few urbs?
14471450
} else if (netif_running (dev->net) &&
@@ -1580,6 +1583,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
15801583
dev->driver_name = name;
15811584
dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
15821585
| NETIF_MSG_PROBE | NETIF_MSG_LINK);
1586+
init_waitqueue_head(&dev->wait);
15831587
skb_queue_head_init (&dev->rxq);
15841588
skb_queue_head_init (&dev->txq);
15851589
skb_queue_head_init (&dev->done);
@@ -1791,9 +1795,10 @@ int usbnet_resume (struct usb_interface *intf)
17911795
spin_unlock_irq(&dev->txq.lock);
17921796

17931797
if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1794-
/* handle remote wakeup ASAP */
1795-
if (!dev->wait &&
1796-
netif_device_present(dev->net) &&
1798+
/* handle remote wakeup ASAP
1799+
* we cannot race against stop
1800+
*/
1801+
if (netif_device_present(dev->net) &&
17971802
!timer_pending(&dev->delay) &&
17981803
!test_bit(EVENT_RX_HALT, &dev->flags))
17991804
rx_alloc_submit(dev, GFP_NOIO);

drivers/net/veth.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ static void veth_setup(struct net_device *dev)
286286
dev->features |= NETIF_F_LLTX;
287287
dev->features |= VETH_FEATURES;
288288
dev->vlan_features = dev->features &
289-
~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX);
289+
~(NETIF_F_HW_VLAN_CTAG_TX |
290+
NETIF_F_HW_VLAN_STAG_TX |
291+
NETIF_F_HW_VLAN_CTAG_RX |
292+
NETIF_F_HW_VLAN_STAG_RX);
290293
dev->destructor = veth_dev_free;
291294

292295
dev->hw_features = VETH_FEATURES;

drivers/net/virtio_net.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,7 @@ static bool try_fill_recv(struct receive_queue *rq, gfp_t gfp)
671671
if (err)
672672
break;
673673
} while (rq->vq->num_free);
674-
if (unlikely(!virtqueue_kick(rq->vq)))
675-
return false;
674+
virtqueue_kick(rq->vq);
676675
return !oom;
677676
}
678677

@@ -877,7 +876,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
877876
err = xmit_skb(sq, skb);
878877

879878
/* This should not happen! */
880-
if (unlikely(err) || unlikely(!virtqueue_kick(sq->vq))) {
879+
if (unlikely(err)) {
881880
dev->stats.tx_fifo_errors++;
882881
if (net_ratelimit())
883882
dev_warn(&dev->dev,
@@ -886,6 +885,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
886885
kfree_skb(skb);
887886
return NETDEV_TX_OK;
888887
}
888+
virtqueue_kick(sq->vq);
889889

890890
/* Don't wait up for transmitted skbs to be freed. */
891891
skb_orphan(skb);

drivers/vhost/net.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
505505
r = -ENOBUFS;
506506
goto err;
507507
}
508-
d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
508+
r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
509509
ARRAY_SIZE(vq->iov) - seg, &out,
510510
&in, log, log_num);
511+
if (unlikely(r < 0))
512+
goto err;
513+
514+
d = r;
511515
if (d == vq->num) {
512516
r = 0;
513517
goto err;
@@ -532,6 +536,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
532536
*iovcount = seg;
533537
if (unlikely(log))
534538
*log_num = nlogs;
539+
540+
/* Detect overrun */
541+
if (unlikely(datalen > 0)) {
542+
r = UIO_MAXIOV + 1;
543+
goto err;
544+
}
535545
return headcount;
536546
err:
537547
vhost_discard_vq_desc(vq, headcount);
@@ -587,6 +597,14 @@ static void handle_rx(struct vhost_net *net)
587597
/* On error, stop handling until the next kick. */
588598
if (unlikely(headcount < 0))
589599
break;
600+
/* On overrun, truncate and discard */
601+
if (unlikely(headcount > UIO_MAXIOV)) {
602+
msg.msg_iovlen = 1;
603+
err = sock->ops->recvmsg(NULL, sock, &msg,
604+
1, MSG_DONTWAIT | MSG_TRUNC);
605+
pr_debug("Discarded rx packet: len %zd\n", sock_len);
606+
continue;
607+
}
590608
/* OK, now we need to know about added descriptors. */
591609
if (!headcount) {
592610
if (unlikely(vhost_enable_notify(&net->dev, vq))) {

include/linux/netdev_features.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,11 @@ enum {
163163
/* changeable features with no special hardware requirements */
164164
#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
165165

166+
#define NETIF_F_VLAN_FEATURES (NETIF_F_HW_VLAN_CTAG_FILTER | \
167+
NETIF_F_HW_VLAN_CTAG_RX | \
168+
NETIF_F_HW_VLAN_CTAG_TX | \
169+
NETIF_F_HW_VLAN_STAG_FILTER | \
170+
NETIF_F_HW_VLAN_STAG_RX | \
171+
NETIF_F_HW_VLAN_STAG_TX)
172+
166173
#endif /* _LINUX_NETDEV_FEATURES_H */

0 commit comments

Comments
 (0)