Skip to content

Commit cd66289

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Limit the number of can filters to avoid > MAX_ORDER allocations. Fix from Marc Kleine-Budde. 2) Limit GSO max size in netvsc driver to avoid problems with NVGRE configurations. From Stephen Hemminger. 3) Return proper error when memory allocation fails in ser_gigaset_init(), from Dan Carpenter. 4) Missing linkage undo in error paths of ipvlan_link_new(), from Gao Feng. 5) Missing necessayr SET_NETDEV_DEV in lantiq and cpmac drivers, from Florian Fainelli. 6) Handle probe deferral properly in smsc911x driver. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: net: mlx5: Fix Kconfig help text net: smsc911x: back out silently on probe deferrals ibmveth: set correct gso_size and gso_type net: ethernet: cpmac: Call SET_NETDEV_DEV() net: ethernet: lantiq_etop: Call SET_NETDEV_DEV() vhost-vsock: fix orphan connection reset cxgb4/cxgb4vf: Assign netdev->dev_port with port ID driver: ipvlan: Unlink the upper dev when ipvlan_link_new failed ser_gigaset: return -ENOMEM on error instead of success NET: usb: cdc_mbim: add quirk for supporting Telit LE922A can: peak: fix bad memory access and free sequence phy: Don't increment MDIO bus refcount unless it's a different owner netvsc: reduce maximum GSO size drivers: net: cpsw-phy-sel: Clear RGMII_IDMODE on "rgmii" links can: raw: raw_setsockopt: limit number of can_filter that can be set
2 parents 810ac7b + d33695f commit cd66289

File tree

21 files changed

+142
-20
lines changed

21 files changed

+142
-20
lines changed

drivers/isdn/gigaset/ser-gigaset.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,10 @@ static int __init ser_gigaset_init(void)
755755
driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
756756
GIGASET_MODULENAME, GIGASET_DEVNAME,
757757
&ops, THIS_MODULE);
758-
if (!driver)
758+
if (!driver) {
759+
rc = -ENOMEM;
759760
goto error;
761+
}
760762

761763
rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc);
762764
if (rc != 0) {

drivers/net/can/usb/peak_usb/pcan_usb_core.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -870,23 +870,25 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
870870
static void peak_usb_disconnect(struct usb_interface *intf)
871871
{
872872
struct peak_usb_device *dev;
873+
struct peak_usb_device *dev_prev_siblings;
873874

874875
/* unregister as many netdev devices as siblings */
875-
for (dev = usb_get_intfdata(intf); dev; dev = dev->prev_siblings) {
876+
for (dev = usb_get_intfdata(intf); dev; dev = dev_prev_siblings) {
876877
struct net_device *netdev = dev->netdev;
877878
char name[IFNAMSIZ];
878879

880+
dev_prev_siblings = dev->prev_siblings;
879881
dev->state &= ~PCAN_USB_STATE_CONNECTED;
880882
strncpy(name, netdev->name, IFNAMSIZ);
881883

882884
unregister_netdev(netdev);
883-
free_candev(netdev);
884885

885886
kfree(dev->cmd_buf);
886887
dev->next_siblings = NULL;
887888
if (dev->adapter->dev_free)
888889
dev->adapter->dev_free(dev);
889890

891+
free_candev(netdev);
890892
dev_info(&intf->dev, "%s removed\n", name);
891893
}
892894

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

+1
Original file line numberDiff line numberDiff line change
@@ -4931,6 +4931,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
49314931
*/
49324932
for_each_port(adapter, i) {
49334933
pi = adap2pinfo(adapter, i);
4934+
adapter->port[i]->dev_port = pi->lport;
49344935
netif_set_real_num_tx_queues(adapter->port[i], pi->nqsets);
49354936
netif_set_real_num_rx_queues(adapter->port[i], pi->nqsets);
49364937

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

-1
Original file line numberDiff line numberDiff line change
@@ -7851,7 +7851,6 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
78517851
return ret;
78527852

78537853
memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
7854-
adap->port[i]->dev_port = j;
78557854
j++;
78567855
}
78577856
return 0;

drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c

+1
Original file line numberDiff line numberDiff line change
@@ -2969,6 +2969,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
29692969

29702970
netdev->netdev_ops = &cxgb4vf_netdev_ops;
29712971
netdev->ethtool_ops = &cxgb4vf_ethtool_ops;
2972+
netdev->dev_port = pi->port_id;
29722973

29732974
/*
29742975
* Initialize the hardware/software state for the port.

drivers/net/ethernet/ibm/ibmveth.c

+63-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static struct kobj_type ktype_veth_pool;
5858

5959
static const char ibmveth_driver_name[] = "ibmveth";
6060
static const char ibmveth_driver_string[] = "IBM Power Virtual Ethernet Driver";
61-
#define ibmveth_driver_version "1.05"
61+
#define ibmveth_driver_version "1.06"
6262

6363
MODULE_AUTHOR("Santiago Leon <[email protected]>");
6464
MODULE_DESCRIPTION("IBM Power Virtual Ethernet Driver");
@@ -137,6 +137,11 @@ static inline int ibmveth_rxq_frame_offset(struct ibmveth_adapter *adapter)
137137
return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_OFF_MASK;
138138
}
139139

140+
static inline int ibmveth_rxq_large_packet(struct ibmveth_adapter *adapter)
141+
{
142+
return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_LRG_PKT;
143+
}
144+
140145
static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter)
141146
{
142147
return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].length);
@@ -1174,6 +1179,45 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
11741179
goto retry_bounce;
11751180
}
11761181

1182+
static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
1183+
{
1184+
int offset = 0;
1185+
1186+
/* only TCP packets will be aggregated */
1187+
if (skb->protocol == htons(ETH_P_IP)) {
1188+
struct iphdr *iph = (struct iphdr *)skb->data;
1189+
1190+
if (iph->protocol == IPPROTO_TCP) {
1191+
offset = iph->ihl * 4;
1192+
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
1193+
} else {
1194+
return;
1195+
}
1196+
} else if (skb->protocol == htons(ETH_P_IPV6)) {
1197+
struct ipv6hdr *iph6 = (struct ipv6hdr *)skb->data;
1198+
1199+
if (iph6->nexthdr == IPPROTO_TCP) {
1200+
offset = sizeof(struct ipv6hdr);
1201+
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
1202+
} else {
1203+
return;
1204+
}
1205+
} else {
1206+
return;
1207+
}
1208+
/* if mss is not set through Large Packet bit/mss in rx buffer,
1209+
* expect that the mss will be written to the tcp header checksum.
1210+
*/
1211+
if (lrg_pkt) {
1212+
skb_shinfo(skb)->gso_size = mss;
1213+
} else if (offset) {
1214+
struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
1215+
1216+
skb_shinfo(skb)->gso_size = ntohs(tcph->check);
1217+
tcph->check = 0;
1218+
}
1219+
}
1220+
11771221
static int ibmveth_poll(struct napi_struct *napi, int budget)
11781222
{
11791223
struct ibmveth_adapter *adapter =
@@ -1182,6 +1226,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
11821226
int frames_processed = 0;
11831227
unsigned long lpar_rc;
11841228
struct iphdr *iph;
1229+
u16 mss = 0;
11851230

11861231
restart_poll:
11871232
while (frames_processed < budget) {
@@ -1199,9 +1244,21 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
11991244
int length = ibmveth_rxq_frame_length(adapter);
12001245
int offset = ibmveth_rxq_frame_offset(adapter);
12011246
int csum_good = ibmveth_rxq_csum_good(adapter);
1247+
int lrg_pkt = ibmveth_rxq_large_packet(adapter);
12021248

12031249
skb = ibmveth_rxq_get_buffer(adapter);
12041250

1251+
/* if the large packet bit is set in the rx queue
1252+
* descriptor, the mss will be written by PHYP eight
1253+
* bytes from the start of the rx buffer, which is
1254+
* skb->data at this stage
1255+
*/
1256+
if (lrg_pkt) {
1257+
__be64 *rxmss = (__be64 *)(skb->data + 8);
1258+
1259+
mss = (u16)be64_to_cpu(*rxmss);
1260+
}
1261+
12051262
new_skb = NULL;
12061263
if (length < rx_copybreak)
12071264
new_skb = netdev_alloc_skb(netdev, length);
@@ -1235,11 +1292,15 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
12351292
if (iph->check == 0xffff) {
12361293
iph->check = 0;
12371294
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
1238-
adapter->rx_large_packets++;
12391295
}
12401296
}
12411297
}
12421298

1299+
if (length > netdev->mtu + ETH_HLEN) {
1300+
ibmveth_rx_mss_helper(skb, mss, lrg_pkt);
1301+
adapter->rx_large_packets++;
1302+
}
1303+
12431304
napi_gro_receive(napi, skb); /* send it up */
12441305

12451306
netdev->stats.rx_packets++;

drivers/net/ethernet/ibm/ibmveth.h

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ struct ibmveth_rx_q_entry {
209209
#define IBMVETH_RXQ_TOGGLE 0x80000000
210210
#define IBMVETH_RXQ_TOGGLE_SHIFT 31
211211
#define IBMVETH_RXQ_VALID 0x40000000
212+
#define IBMVETH_RXQ_LRG_PKT 0x04000000
212213
#define IBMVETH_RXQ_NO_CSUM 0x02000000
213214
#define IBMVETH_RXQ_CSUM_GOOD 0x01000000
214215
#define IBMVETH_RXQ_OFF_MASK 0x0000FFFF

drivers/net/ethernet/lantiq_etop.c

+1
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ ltq_etop_probe(struct platform_device *pdev)
704704
priv->pldata = dev_get_platdata(&pdev->dev);
705705
priv->netdev = dev;
706706
spin_lock_init(&priv->lock);
707+
SET_NETDEV_DEV(dev, &pdev->dev);
707708

708709
for (i = 0; i < MAX_DMA_CHAN; i++) {
709710
if (IS_TX(i))

drivers/net/ethernet/mellanox/mlx5/core/Kconfig

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ config MLX5_CORE_EN
1818
default n
1919
---help---
2020
Ethernet support in Mellanox Technologies ConnectX-4 NIC.
21-
Ethernet and Infiniband support in ConnectX-4 are currently mutually
22-
exclusive.
2321

2422
config MLX5_CORE_EN_DCB
2523
bool "Data Center Bridging (DCB) Support"

drivers/net/ethernet/smsc/smsc911x.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,16 @@ static int smsc911x_request_resources(struct platform_device *pdev)
438438
ret = regulator_bulk_get(&pdev->dev,
439439
ARRAY_SIZE(pdata->supplies),
440440
pdata->supplies);
441-
if (ret)
441+
if (ret) {
442+
/*
443+
* Retry on deferrals, else just report the error
444+
* and try to continue.
445+
*/
446+
if (ret == -EPROBE_DEFER)
447+
return ret;
442448
netdev_err(ndev, "couldn't get regulators %d\n",
443449
ret);
450+
}
444451

445452
/* Request optional RESET GPIO */
446453
pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev,

drivers/net/ethernet/ti/cpmac.c

+1
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ static int cpmac_probe(struct platform_device *pdev)
11131113
if (!dev)
11141114
return -ENOMEM;
11151115

1116+
SET_NETDEV_DEV(dev, &pdev->dev);
11161117
platform_set_drvdata(pdev, dev);
11171118
priv = netdev_priv(dev);
11181119

drivers/net/ethernet/ti/cpsw-phy-sel.c

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv,
8181
};
8282

8383
mask = GMII_SEL_MODE_MASK << (slave * 2) | BIT(slave + 6);
84+
mask |= BIT(slave + 4);
8485
mode <<= slave * 2;
8586

8687
if (priv->rmii_clock_external) {

drivers/net/hyperv/netvsc_drv.c

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
NETIF_F_TSO | \
4848
NETIF_F_TSO6 | \
4949
NETIF_F_HW_CSUM)
50+
51+
/* Restrict GSO size to account for NVGRE */
52+
#define NETVSC_GSO_MAX_SIZE 62768
53+
5054
static int ring_size = 128;
5155
module_param(ring_size, int, S_IRUGO);
5256
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
@@ -1400,6 +1404,7 @@ static int netvsc_probe(struct hv_device *dev,
14001404
nvdev = net_device_ctx->nvdev;
14011405
netif_set_real_num_tx_queues(net, nvdev->num_chn);
14021406
netif_set_real_num_rx_queues(net, nvdev->num_chn);
1407+
netif_set_gso_max_size(net, NETVSC_GSO_MAX_SIZE);
14031408

14041409
ret = register_netdev(net);
14051410
if (ret != 0) {

drivers/net/ipvlan/ipvlan_main.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,15 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
546546
}
547547
err = ipvlan_set_port_mode(port, mode);
548548
if (err) {
549-
goto unregister_netdev;
549+
goto unlink_netdev;
550550
}
551551

552552
list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans);
553553
netif_stacked_transfer_operstate(phy_dev, dev);
554554
return 0;
555555

556+
unlink_netdev:
557+
netdev_upper_dev_unlink(phy_dev, dev);
556558
unregister_netdev:
557559
unregister_netdevice(dev);
558560
destroy_ipvlan_port:

drivers/net/phy/phy_device.c

+13-3
Original file line numberDiff line numberDiff line change
@@ -857,11 +857,17 @@ EXPORT_SYMBOL(phy_attached_print);
857857
int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
858858
u32 flags, phy_interface_t interface)
859859
{
860+
struct module *ndev_owner = dev->dev.parent->driver->owner;
860861
struct mii_bus *bus = phydev->mdio.bus;
861862
struct device *d = &phydev->mdio.dev;
862863
int err;
863864

864-
if (!try_module_get(bus->owner)) {
865+
/* For Ethernet device drivers that register their own MDIO bus, we
866+
* will have bus->owner match ndev_mod, so we do not want to increment
867+
* our own module->refcnt here, otherwise we would not be able to
868+
* unload later on.
869+
*/
870+
if (ndev_owner != bus->owner && !try_module_get(bus->owner)) {
865871
dev_err(&dev->dev, "failed to get the bus module\n");
866872
return -EIO;
867873
}
@@ -921,7 +927,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
921927

922928
error:
923929
put_device(d);
924-
module_put(bus->owner);
930+
if (ndev_owner != bus->owner)
931+
module_put(bus->owner);
925932
return err;
926933
}
927934
EXPORT_SYMBOL(phy_attach_direct);
@@ -971,6 +978,8 @@ EXPORT_SYMBOL(phy_attach);
971978
*/
972979
void phy_detach(struct phy_device *phydev)
973980
{
981+
struct net_device *dev = phydev->attached_dev;
982+
struct module *ndev_owner = dev->dev.parent->driver->owner;
974983
struct mii_bus *bus;
975984
int i;
976985

@@ -998,7 +1007,8 @@ void phy_detach(struct phy_device *phydev)
9981007
bus = phydev->mdio.bus;
9991008

10001009
put_device(&phydev->mdio.dev);
1001-
module_put(bus->owner);
1010+
if (ndev_owner != bus->owner)
1011+
module_put(bus->owner);
10021012
}
10031013
EXPORT_SYMBOL(phy_detach);
10041014

drivers/net/usb/cdc_mbim.c

+21
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,21 @@ static const struct driver_info cdc_mbim_info_ndp_to_end = {
602602
.data = CDC_NCM_FLAG_NDP_TO_END,
603603
};
604604

605+
/* Some modems (e.g. Telit LE922A6) do not work properly with altsetting
606+
* toggle done in cdc_ncm_bind_common. CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE
607+
* flag is used to avoid this procedure.
608+
*/
609+
static const struct driver_info cdc_mbim_info_avoid_altsetting_toggle = {
610+
.description = "CDC MBIM",
611+
.flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN,
612+
.bind = cdc_mbim_bind,
613+
.unbind = cdc_mbim_unbind,
614+
.manage_power = cdc_mbim_manage_power,
615+
.rx_fixup = cdc_mbim_rx_fixup,
616+
.tx_fixup = cdc_mbim_tx_fixup,
617+
.data = CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE,
618+
};
619+
605620
static const struct usb_device_id mbim_devs[] = {
606621
/* This duplicate NCM entry is intentional. MBIM devices can
607622
* be disguised as NCM by default, and this is necessary to
@@ -626,6 +641,12 @@ static const struct usb_device_id mbim_devs[] = {
626641
{ USB_VENDOR_AND_INTERFACE_INFO(0x12d1, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
627642
.driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
628643
},
644+
645+
/* Telit LE922A6 in MBIM composition */
646+
{ USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1041, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
647+
.driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle,
648+
},
649+
629650
/* default entry */
630651
{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
631652
.driver_info = (unsigned long)&cdc_mbim_info_zlp,

drivers/net/usb/cdc_ncm.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -839,11 +839,18 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
839839

840840
iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
841841

842+
/* Device-specific flags */
843+
ctx->drvflags = drvflags;
844+
842845
/* Reset data interface. Some devices will not reset properly
843846
* unless they are configured first. Toggle the altsetting to
844-
* force a reset
847+
* force a reset.
848+
* Some other devices do not work properly with this procedure
849+
* that can be avoided using quirk CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE
845850
*/
846-
usb_set_interface(dev->udev, iface_no, data_altsetting);
851+
if (!(ctx->drvflags & CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE))
852+
usb_set_interface(dev->udev, iface_no, data_altsetting);
853+
847854
temp = usb_set_interface(dev->udev, iface_no, 0);
848855
if (temp) {
849856
dev_dbg(&intf->dev, "set interface failed\n");
@@ -890,9 +897,6 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
890897
/* finish setting up the device specific data */
891898
cdc_ncm_setup(dev);
892899

893-
/* Device-specific flags */
894-
ctx->drvflags = drvflags;
895-
896900
/* Allocate the delayed NDP if needed. */
897901
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
898902
ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL);

drivers/vhost/vsock.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk)
506506
* executing.
507507
*/
508508

509-
if (!vhost_vsock_get(vsk->local_addr.svm_cid)) {
509+
if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) {
510510
sock_set_flag(sk, SOCK_DONE);
511511
vsk->peer_shutdown = SHUTDOWN_MASK;
512512
sk->sk_state = SS_UNCONNECTED;

0 commit comments

Comments
 (0)