Skip to content

Commit 5d13659

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) In ip_gre tunnel, handle the conflict between TUNNEL_{SEQ,CSUM} and GSO/LLTX properly. From Sabrina Dubroca. 2) Stop properly on error in lan78xx_read_otp(), from Phil Elwell. 3) Don't uncompress in slip before rstate is initialized, from Tejaswi Tanikella. 4) When using 1.x firmware on aquantia, issue a deinit before we hardware reset the chip, otherwise we break dirty wake WOL. From Igor Russkikh. 5) Correct log check in vhost_vq_access_ok(), from Stefan Hajnoczi. 6) Fix ethtool -x crashes in bnxt_en, from Michael Chan. 7) Fix races in l2tp tunnel creation and duplicate tunnel detection, from Guillaume Nault. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (22 commits) l2tp: fix race in duplicate tunnel detection l2tp: fix races in tunnel creation tun: send netlink notification when the device is modified tun: set the flags before registering the netdevice lan78xx: Don't reset the interface on open bnxt_en: Fix NULL pointer dereference at bnxt_free_irq(). bnxt_en: Need to include RDMA rings in bnxt_check_rings(). bnxt_en: Support max-mtu with VF-reps bnxt_en: Ignore src port field in decap filter nodes bnxt_en: do not allow wildcard matches for L2 flows bnxt_en: Fix ethtool -x crash when device is down. vhost: return bool from *_access_ok() functions vhost: fix vhost_vq_access_ok() log check vhost: Fix vhost_copy_to_user() net: aquantia: oops when shutdown on already stopped device net: aquantia: Regression on reset with 1.x firmware cdc_ether: flag the Cinterion AHS8 modem by gemalto as WWAN slip: Check if rstate is initialized before uncompressing lan78xx: Avoid spurious kevent 4 "error" lan78xx: Correctly indicate invalid OTP ...
2 parents 67a7a8f + 0c84cee commit 5d13659

File tree

19 files changed

+345
-198
lines changed

19 files changed

+345
-198
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_nic.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,9 +951,11 @@ void aq_nic_shutdown(struct aq_nic_s *self)
951951

952952
netif_device_detach(self->ndev);
953953

954-
err = aq_nic_stop(self);
955-
if (err < 0)
956-
goto err_exit;
954+
if (netif_running(self->ndev)) {
955+
err = aq_nic_stop(self);
956+
if (err < 0)
957+
goto err_exit;
958+
}
957959
aq_nic_deinit(self);
958960

959961
err_exit:

drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#define FORCE_FLASHLESS 0
4949

5050
static int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual);
51+
static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
52+
enum hal_atl_utils_fw_state_e state);
5153

5254
int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
5355
{
@@ -247,6 +249,20 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self)
247249

248250
self->rbl_enabled = (boot_exit_code != 0);
249251

252+
/* FW 1.x may bootup in an invalid POWER state (WOL feature).
253+
* We should work around this by forcing its state back to DEINIT
254+
*/
255+
if (!hw_atl_utils_ver_match(HW_ATL_FW_VER_1X,
256+
aq_hw_read_reg(self,
257+
HW_ATL_MPI_FW_VERSION))) {
258+
int err = 0;
259+
260+
hw_atl_utils_mpi_set_state(self, MPI_DEINIT);
261+
AQ_HW_WAIT_FOR((aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR) &
262+
HW_ATL_MPI_STATE_MSK) == MPI_DEINIT,
263+
10, 1000U);
264+
}
265+
250266
if (self->rbl_enabled)
251267
return hw_atl_utils_soft_reset_rbl(self);
252268
else

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6090,7 +6090,7 @@ static void bnxt_free_irq(struct bnxt *bp)
60906090
free_irq_cpu_rmap(bp->dev->rx_cpu_rmap);
60916091
bp->dev->rx_cpu_rmap = NULL;
60926092
#endif
6093-
if (!bp->irq_tbl)
6093+
if (!bp->irq_tbl || !bp->bnapi)
60946094
return;
60956095

60966096
for (i = 0; i < bp->cp_nr_rings; i++) {
@@ -7686,6 +7686,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
76867686
if (bp->flags & BNXT_FLAG_AGG_RINGS)
76877687
rx_rings <<= 1;
76887688
cp = sh ? max_t(int, tx_rings_needed, rx) : tx_rings_needed + rx;
7689+
if (bp->flags & BNXT_FLAG_NEW_RM)
7690+
cp += bnxt_get_ulp_msix_num(bp);
76897691
return bnxt_hwrm_check_rings(bp, tx_rings_needed, rx_rings, rx, cp,
76907692
vnics);
76917693
}

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,17 +870,22 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
870870
u8 *hfunc)
871871
{
872872
struct bnxt *bp = netdev_priv(dev);
873-
struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
873+
struct bnxt_vnic_info *vnic;
874874
int i = 0;
875875

876876
if (hfunc)
877877
*hfunc = ETH_RSS_HASH_TOP;
878878

879-
if (indir)
879+
if (!bp->vnic_info)
880+
return 0;
881+
882+
vnic = &bp->vnic_info[0];
883+
if (indir && vnic->rss_table) {
880884
for (i = 0; i < HW_HASH_INDEX_SIZE; i++)
881885
indir[i] = le16_to_cpu(vnic->rss_table[i]);
886+
}
882887

883-
if (key)
888+
if (key && vnic->rss_hash_key)
884889
memcpy(key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);
885890

886891
return 0;

drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,30 @@ static bool is_wildcard(void *mask, int len)
377377
return true;
378378
}
379379

380+
static bool is_exactmatch(void *mask, int len)
381+
{
382+
const u8 *p = mask;
383+
int i;
384+
385+
for (i = 0; i < len; i++)
386+
if (p[i] != 0xff)
387+
return false;
388+
389+
return true;
390+
}
391+
392+
static bool bits_set(void *key, int len)
393+
{
394+
const u8 *p = key;
395+
int i;
396+
397+
for (i = 0; i < len; i++)
398+
if (p[i] != 0)
399+
return true;
400+
401+
return false;
402+
}
403+
380404
static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow,
381405
__le16 ref_flow_handle,
382406
__le32 tunnel_handle, __le16 *flow_handle)
@@ -764,6 +788,41 @@ static bool bnxt_tc_can_offload(struct bnxt *bp, struct bnxt_tc_flow *flow)
764788
return false;
765789
}
766790

791+
/* Currently source/dest MAC cannot be partial wildcard */
792+
if (bits_set(&flow->l2_key.smac, sizeof(flow->l2_key.smac)) &&
793+
!is_exactmatch(flow->l2_mask.smac, sizeof(flow->l2_mask.smac))) {
794+
netdev_info(bp->dev, "Wildcard match unsupported for Source MAC\n");
795+
return false;
796+
}
797+
if (bits_set(&flow->l2_key.dmac, sizeof(flow->l2_key.dmac)) &&
798+
!is_exactmatch(&flow->l2_mask.dmac, sizeof(flow->l2_mask.dmac))) {
799+
netdev_info(bp->dev, "Wildcard match unsupported for Dest MAC\n");
800+
return false;
801+
}
802+
803+
/* Currently VLAN fields cannot be partial wildcard */
804+
if (bits_set(&flow->l2_key.inner_vlan_tci,
805+
sizeof(flow->l2_key.inner_vlan_tci)) &&
806+
!is_exactmatch(&flow->l2_mask.inner_vlan_tci,
807+
sizeof(flow->l2_mask.inner_vlan_tci))) {
808+
netdev_info(bp->dev, "Wildcard match unsupported for VLAN TCI\n");
809+
return false;
810+
}
811+
if (bits_set(&flow->l2_key.inner_vlan_tpid,
812+
sizeof(flow->l2_key.inner_vlan_tpid)) &&
813+
!is_exactmatch(&flow->l2_mask.inner_vlan_tpid,
814+
sizeof(flow->l2_mask.inner_vlan_tpid))) {
815+
netdev_info(bp->dev, "Wildcard match unsupported for VLAN TPID\n");
816+
return false;
817+
}
818+
819+
/* Currently Ethertype must be set */
820+
if (!is_exactmatch(&flow->l2_mask.ether_type,
821+
sizeof(flow->l2_mask.ether_type))) {
822+
netdev_info(bp->dev, "Wildcard match unsupported for Ethertype\n");
823+
return false;
824+
}
825+
767826
return true;
768827
}
769828

@@ -992,8 +1051,10 @@ static int bnxt_tc_get_decap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow,
9921051

9931052
/* Check if there's another flow using the same tunnel decap.
9941053
* If not, add this tunnel to the table and resolve the other
995-
* tunnel header fileds
1054+
* tunnel header fileds. Ignore src_port in the tunnel_key,
1055+
* since it is not required for decap filters.
9961056
*/
1057+
decap_key->tp_src = 0;
9971058
decap_node = bnxt_tc_get_tunnel_node(bp, &tc_info->decap_table,
9981059
&tc_info->decap_ht_params,
9991060
decap_key);

drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ static int hwrm_cfa_vfr_free(struct bnxt *bp, u16 vf_idx)
6464
return rc;
6565
}
6666

67+
static int bnxt_hwrm_vfr_qcfg(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
68+
u16 *max_mtu)
69+
{
70+
struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
71+
struct hwrm_func_qcfg_input req = {0};
72+
u16 mtu;
73+
int rc;
74+
75+
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCFG, -1, -1);
76+
req.fid = cpu_to_le16(bp->pf.vf[vf_rep->vf_idx].fw_fid);
77+
78+
mutex_lock(&bp->hwrm_cmd_lock);
79+
80+
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
81+
if (!rc) {
82+
mtu = le16_to_cpu(resp->max_mtu_configured);
83+
if (!mtu)
84+
*max_mtu = BNXT_MAX_MTU;
85+
else
86+
*max_mtu = mtu;
87+
}
88+
mutex_unlock(&bp->hwrm_cmd_lock);
89+
return rc;
90+
}
91+
6792
static int bnxt_vf_rep_open(struct net_device *dev)
6893
{
6994
struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
@@ -365,6 +390,7 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
365390
struct net_device *dev)
366391
{
367392
struct net_device *pf_dev = bp->dev;
393+
u16 max_mtu;
368394

369395
dev->netdev_ops = &bnxt_vf_rep_netdev_ops;
370396
dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops;
@@ -380,6 +406,10 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
380406
bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx,
381407
dev->perm_addr);
382408
ether_addr_copy(dev->dev_addr, dev->perm_addr);
409+
/* Set VF-Rep's max-mtu to the corresponding VF's max-mtu */
410+
if (!bnxt_hwrm_vfr_qcfg(bp, vf_rep, &max_mtu))
411+
dev->max_mtu = max_mtu;
412+
dev->min_mtu = ETH_ZLEN;
383413
}
384414

385415
static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])

drivers/net/slip/slhc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@ slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
509509
if(x < 0 || x > comp->rslot_limit)
510510
goto bad;
511511

512+
/* Check if the cstate is initialized */
513+
if (!comp->rstate[x].initialized)
514+
goto bad;
515+
512516
comp->flags &=~ SLF_TOSS;
513517
comp->recv_current = x;
514518
} else {
@@ -673,6 +677,7 @@ slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
673677
if (cs->cs_tcp.doff > 5)
674678
memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr), (cs->cs_tcp.doff - 5) * 4);
675679
cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2;
680+
cs->initialized = true;
676681
/* Put headers back on packet
677682
* Neither header checksum is recalculated
678683
*/

drivers/net/tun.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,15 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
743743

744744
static void tun_detach(struct tun_file *tfile, bool clean)
745745
{
746+
struct tun_struct *tun;
747+
struct net_device *dev;
748+
746749
rtnl_lock();
750+
tun = rtnl_dereference(tfile->tun);
751+
dev = tun ? tun->dev : NULL;
747752
__tun_detach(tfile, clean);
753+
if (dev)
754+
netdev_state_change(dev);
748755
rtnl_unlock();
749756
}
750757

@@ -2562,10 +2569,15 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
25622569
/* One or more queue has already been attached, no need
25632570
* to initialize the device again.
25642571
*/
2572+
netdev_state_change(dev);
25652573
return 0;
25662574
}
2567-
}
2568-
else {
2575+
2576+
tun->flags = (tun->flags & ~TUN_FEATURES) |
2577+
(ifr->ifr_flags & TUN_FEATURES);
2578+
2579+
netdev_state_change(dev);
2580+
} else {
25692581
char *name;
25702582
unsigned long flags = 0;
25712583
int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?
@@ -2642,6 +2654,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
26422654
~(NETIF_F_HW_VLAN_CTAG_TX |
26432655
NETIF_F_HW_VLAN_STAG_TX);
26442656

2657+
tun->flags = (tun->flags & ~TUN_FEATURES) |
2658+
(ifr->ifr_flags & TUN_FEATURES);
2659+
26452660
INIT_LIST_HEAD(&tun->disabled);
26462661
err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI);
26472662
if (err < 0)
@@ -2656,9 +2671,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
26562671

26572672
tun_debug(KERN_INFO, tun, "tun_set_iff\n");
26582673

2659-
tun->flags = (tun->flags & ~TUN_FEATURES) |
2660-
(ifr->ifr_flags & TUN_FEATURES);
2661-
26622674
/* Make sure persistent devices do not get stuck in
26632675
* xoff state.
26642676
*/
@@ -2805,6 +2817,9 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
28052817
} else
28062818
ret = -EINVAL;
28072819

2820+
if (ret >= 0)
2821+
netdev_state_change(tun->dev);
2822+
28082823
unlock:
28092824
rtnl_unlock();
28102825
return ret;
@@ -2845,6 +2860,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
28452860
unsigned int ifindex;
28462861
int le;
28472862
int ret;
2863+
bool do_notify = false;
28482864

28492865
if (cmd == TUNSETIFF || cmd == TUNSETQUEUE ||
28502866
(_IOC_TYPE(cmd) == SOCK_IOC_TYPE && cmd != SIOCGSKNS)) {
@@ -2941,10 +2957,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
29412957
if (arg && !(tun->flags & IFF_PERSIST)) {
29422958
tun->flags |= IFF_PERSIST;
29432959
__module_get(THIS_MODULE);
2960+
do_notify = true;
29442961
}
29452962
if (!arg && (tun->flags & IFF_PERSIST)) {
29462963
tun->flags &= ~IFF_PERSIST;
29472964
module_put(THIS_MODULE);
2965+
do_notify = true;
29482966
}
29492967

29502968
tun_debug(KERN_INFO, tun, "persist %s\n",
@@ -2959,6 +2977,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
29592977
break;
29602978
}
29612979
tun->owner = owner;
2980+
do_notify = true;
29622981
tun_debug(KERN_INFO, tun, "owner set to %u\n",
29632982
from_kuid(&init_user_ns, tun->owner));
29642983
break;
@@ -2971,6 +2990,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
29712990
break;
29722991
}
29732992
tun->group = group;
2993+
do_notify = true;
29742994
tun_debug(KERN_INFO, tun, "group set to %u\n",
29752995
from_kgid(&init_user_ns, tun->group));
29762996
break;
@@ -3130,6 +3150,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
31303150
break;
31313151
}
31323152

3153+
if (do_notify)
3154+
netdev_state_change(tun->dev);
3155+
31333156
unlock:
31343157
rtnl_unlock();
31353158
if (tun)

drivers/net/usb/cdc_ether.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,12 @@ static const struct usb_device_id products[] = {
901901
USB_CDC_SUBCLASS_ETHERNET,
902902
USB_CDC_PROTO_NONE),
903903
.driver_info = (unsigned long)&wwan_info,
904+
}, {
905+
/* Cinterion AHS3 modem by GEMALTO */
906+
USB_DEVICE_AND_INTERFACE_INFO(0x1e2d, 0x0055, USB_CLASS_COMM,
907+
USB_CDC_SUBCLASS_ETHERNET,
908+
USB_CDC_PROTO_NONE),
909+
.driver_info = (unsigned long)&wwan_info,
904910
}, {
905911
USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
906912
USB_CDC_PROTO_NONE),

drivers/net/usb/lan78xx.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset,
928928
offset += 0x100;
929929
else
930930
ret = -EINVAL;
931-
ret = lan78xx_read_raw_otp(dev, offset, length, data);
931+
if (!ret)
932+
ret = lan78xx_read_raw_otp(dev, offset, length, data);
932933
}
933934

934935
return ret;
@@ -2502,7 +2503,7 @@ static void lan78xx_init_stats(struct lan78xx_net *dev)
25022503
dev->stats.rollover_max.eee_tx_lpi_transitions = 0xFFFFFFFF;
25032504
dev->stats.rollover_max.eee_tx_lpi_time = 0xFFFFFFFF;
25042505

2505-
lan78xx_defer_kevent(dev, EVENT_STAT_UPDATE);
2506+
set_bit(EVENT_STAT_UPDATE, &dev->flags);
25062507
}
25072508

25082509
static int lan78xx_open(struct net_device *net)
@@ -2514,10 +2515,6 @@ static int lan78xx_open(struct net_device *net)
25142515
if (ret < 0)
25152516
goto out;
25162517

2517-
ret = lan78xx_reset(dev);
2518-
if (ret < 0)
2519-
goto done;
2520-
25212518
phy_start(net->phydev);
25222519

25232520
netif_dbg(dev, ifup, dev->net, "phy initialised successfully");

0 commit comments

Comments
 (0)