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
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
  ...
  • Loading branch information
Linus Torvalds committed Apr 12, 2018
2 parents 67a7a8f + 0c84cee commit 5d13659
Show file tree
Hide file tree
Showing 19 changed files with 345 additions and 198 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/aquantia/atlantic/aq_nic.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,11 @@ void aq_nic_shutdown(struct aq_nic_s *self)

netif_device_detach(self->ndev);

err = aq_nic_stop(self);
if (err < 0)
goto err_exit;
if (netif_running(self->ndev)) {
err = aq_nic_stop(self);
if (err < 0)
goto err_exit;
}
aq_nic_deinit(self);

err_exit:
Expand Down
16 changes: 16 additions & 0 deletions drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#define FORCE_FLASHLESS 0

static int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual);
static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
enum hal_atl_utils_fw_state_e state);

int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
{
Expand Down Expand Up @@ -247,6 +249,20 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self)

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

/* FW 1.x may bootup in an invalid POWER state (WOL feature).
* We should work around this by forcing its state back to DEINIT
*/
if (!hw_atl_utils_ver_match(HW_ATL_FW_VER_1X,
aq_hw_read_reg(self,
HW_ATL_MPI_FW_VERSION))) {
int err = 0;

hw_atl_utils_mpi_set_state(self, MPI_DEINIT);
AQ_HW_WAIT_FOR((aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR) &
HW_ATL_MPI_STATE_MSK) == MPI_DEINIT,
10, 1000U);
}

if (self->rbl_enabled)
return hw_atl_utils_soft_reset_rbl(self);
else
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -6090,7 +6090,7 @@ static void bnxt_free_irq(struct bnxt *bp)
free_irq_cpu_rmap(bp->dev->rx_cpu_rmap);
bp->dev->rx_cpu_rmap = NULL;
#endif
if (!bp->irq_tbl)
if (!bp->irq_tbl || !bp->bnapi)
return;

for (i = 0; i < bp->cp_nr_rings; i++) {
Expand Down Expand Up @@ -7686,6 +7686,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
if (bp->flags & BNXT_FLAG_AGG_RINGS)
rx_rings <<= 1;
cp = sh ? max_t(int, tx_rings_needed, rx) : tx_rings_needed + rx;
if (bp->flags & BNXT_FLAG_NEW_RM)
cp += bnxt_get_ulp_msix_num(bp);
return bnxt_hwrm_check_rings(bp, tx_rings_needed, rx_rings, rx, cp,
vnics);
}
Expand Down
11 changes: 8 additions & 3 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,17 +870,22 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct bnxt *bp = netdev_priv(dev);
struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
struct bnxt_vnic_info *vnic;
int i = 0;

if (hfunc)
*hfunc = ETH_RSS_HASH_TOP;

if (indir)
if (!bp->vnic_info)
return 0;

vnic = &bp->vnic_info[0];
if (indir && vnic->rss_table) {
for (i = 0; i < HW_HASH_INDEX_SIZE; i++)
indir[i] = le16_to_cpu(vnic->rss_table[i]);
}

if (key)
if (key && vnic->rss_hash_key)
memcpy(key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);

return 0;
Expand Down
63 changes: 62 additions & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,30 @@ static bool is_wildcard(void *mask, int len)
return true;
}

static bool is_exactmatch(void *mask, int len)
{
const u8 *p = mask;
int i;

for (i = 0; i < len; i++)
if (p[i] != 0xff)
return false;

return true;
}

static bool bits_set(void *key, int len)
{
const u8 *p = key;
int i;

for (i = 0; i < len; i++)
if (p[i] != 0)
return true;

return false;
}

static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow,
__le16 ref_flow_handle,
__le32 tunnel_handle, __le16 *flow_handle)
Expand Down Expand Up @@ -764,6 +788,41 @@ static bool bnxt_tc_can_offload(struct bnxt *bp, struct bnxt_tc_flow *flow)
return false;
}

/* Currently source/dest MAC cannot be partial wildcard */
if (bits_set(&flow->l2_key.smac, sizeof(flow->l2_key.smac)) &&
!is_exactmatch(flow->l2_mask.smac, sizeof(flow->l2_mask.smac))) {
netdev_info(bp->dev, "Wildcard match unsupported for Source MAC\n");
return false;
}
if (bits_set(&flow->l2_key.dmac, sizeof(flow->l2_key.dmac)) &&
!is_exactmatch(&flow->l2_mask.dmac, sizeof(flow->l2_mask.dmac))) {
netdev_info(bp->dev, "Wildcard match unsupported for Dest MAC\n");
return false;
}

/* Currently VLAN fields cannot be partial wildcard */
if (bits_set(&flow->l2_key.inner_vlan_tci,
sizeof(flow->l2_key.inner_vlan_tci)) &&
!is_exactmatch(&flow->l2_mask.inner_vlan_tci,
sizeof(flow->l2_mask.inner_vlan_tci))) {
netdev_info(bp->dev, "Wildcard match unsupported for VLAN TCI\n");
return false;
}
if (bits_set(&flow->l2_key.inner_vlan_tpid,
sizeof(flow->l2_key.inner_vlan_tpid)) &&
!is_exactmatch(&flow->l2_mask.inner_vlan_tpid,
sizeof(flow->l2_mask.inner_vlan_tpid))) {
netdev_info(bp->dev, "Wildcard match unsupported for VLAN TPID\n");
return false;
}

/* Currently Ethertype must be set */
if (!is_exactmatch(&flow->l2_mask.ether_type,
sizeof(flow->l2_mask.ether_type))) {
netdev_info(bp->dev, "Wildcard match unsupported for Ethertype\n");
return false;
}

return true;
}

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

/* Check if there's another flow using the same tunnel decap.
* If not, add this tunnel to the table and resolve the other
* tunnel header fileds
* tunnel header fileds. Ignore src_port in the tunnel_key,
* since it is not required for decap filters.
*/
decap_key->tp_src = 0;
decap_node = bnxt_tc_get_tunnel_node(bp, &tc_info->decap_table,
&tc_info->decap_ht_params,
decap_key);
Expand Down
30 changes: 30 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@ static int hwrm_cfa_vfr_free(struct bnxt *bp, u16 vf_idx)
return rc;
}

static int bnxt_hwrm_vfr_qcfg(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
u16 *max_mtu)
{
struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
struct hwrm_func_qcfg_input req = {0};
u16 mtu;
int rc;

bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCFG, -1, -1);
req.fid = cpu_to_le16(bp->pf.vf[vf_rep->vf_idx].fw_fid);

mutex_lock(&bp->hwrm_cmd_lock);

rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (!rc) {
mtu = le16_to_cpu(resp->max_mtu_configured);
if (!mtu)
*max_mtu = BNXT_MAX_MTU;
else
*max_mtu = mtu;
}
mutex_unlock(&bp->hwrm_cmd_lock);
return rc;
}

static int bnxt_vf_rep_open(struct net_device *dev)
{
struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
Expand Down Expand Up @@ -365,6 +390,7 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
struct net_device *dev)
{
struct net_device *pf_dev = bp->dev;
u16 max_mtu;

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

static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/slip/slhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
if(x < 0 || x > comp->rslot_limit)
goto bad;

/* Check if the cstate is initialized */
if (!comp->rstate[x].initialized)
goto bad;

comp->flags &=~ SLF_TOSS;
comp->recv_current = x;
} else {
Expand Down Expand Up @@ -673,6 +677,7 @@ slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
if (cs->cs_tcp.doff > 5)
memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr), (cs->cs_tcp.doff - 5) * 4);
cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2;
cs->initialized = true;
/* Put headers back on packet
* Neither header checksum is recalculated
*/
Expand Down
33 changes: 28 additions & 5 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,15 @@ static void __tun_detach(struct tun_file *tfile, bool clean)

static void tun_detach(struct tun_file *tfile, bool clean)
{
struct tun_struct *tun;
struct net_device *dev;

rtnl_lock();
tun = rtnl_dereference(tfile->tun);
dev = tun ? tun->dev : NULL;
__tun_detach(tfile, clean);
if (dev)
netdev_state_change(dev);
rtnl_unlock();
}

Expand Down Expand Up @@ -2562,10 +2569,15 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
/* One or more queue has already been attached, no need
* to initialize the device again.
*/
netdev_state_change(dev);
return 0;
}
}
else {

tun->flags = (tun->flags & ~TUN_FEATURES) |
(ifr->ifr_flags & TUN_FEATURES);

netdev_state_change(dev);
} else {
char *name;
unsigned long flags = 0;
int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?
Expand Down Expand Up @@ -2642,6 +2654,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);

tun->flags = (tun->flags & ~TUN_FEATURES) |
(ifr->ifr_flags & TUN_FEATURES);

INIT_LIST_HEAD(&tun->disabled);
err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI);
if (err < 0)
Expand All @@ -2656,9 +2671,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)

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

tun->flags = (tun->flags & ~TUN_FEATURES) |
(ifr->ifr_flags & TUN_FEATURES);

/* Make sure persistent devices do not get stuck in
* xoff state.
*/
Expand Down Expand Up @@ -2805,6 +2817,9 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
} else
ret = -EINVAL;

if (ret >= 0)
netdev_state_change(tun->dev);

unlock:
rtnl_unlock();
return ret;
Expand Down Expand Up @@ -2845,6 +2860,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
unsigned int ifindex;
int le;
int ret;
bool do_notify = false;

if (cmd == TUNSETIFF || cmd == TUNSETQUEUE ||
(_IOC_TYPE(cmd) == SOCK_IOC_TYPE && cmd != SIOCGSKNS)) {
Expand Down Expand Up @@ -2941,10 +2957,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
if (arg && !(tun->flags & IFF_PERSIST)) {
tun->flags |= IFF_PERSIST;
__module_get(THIS_MODULE);
do_notify = true;
}
if (!arg && (tun->flags & IFF_PERSIST)) {
tun->flags &= ~IFF_PERSIST;
module_put(THIS_MODULE);
do_notify = true;
}

tun_debug(KERN_INFO, tun, "persist %s\n",
Expand All @@ -2959,6 +2977,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
break;
}
tun->owner = owner;
do_notify = true;
tun_debug(KERN_INFO, tun, "owner set to %u\n",
from_kuid(&init_user_ns, tun->owner));
break;
Expand All @@ -2971,6 +2990,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
break;
}
tun->group = group;
do_notify = true;
tun_debug(KERN_INFO, tun, "group set to %u\n",
from_kgid(&init_user_ns, tun->group));
break;
Expand Down Expand Up @@ -3130,6 +3150,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
break;
}

if (do_notify)
netdev_state_change(tun->dev);

unlock:
rtnl_unlock();
if (tun)
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/usb/cdc_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,12 @@ static const struct usb_device_id products[] = {
USB_CDC_SUBCLASS_ETHERNET,
USB_CDC_PROTO_NONE),
.driver_info = (unsigned long)&wwan_info,
}, {
/* Cinterion AHS3 modem by GEMALTO */
USB_DEVICE_AND_INTERFACE_INFO(0x1e2d, 0x0055, USB_CLASS_COMM,
USB_CDC_SUBCLASS_ETHERNET,
USB_CDC_PROTO_NONE),
.driver_info = (unsigned long)&wwan_info,
}, {
USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
USB_CDC_PROTO_NONE),
Expand Down
9 changes: 3 additions & 6 deletions drivers/net/usb/lan78xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset,
offset += 0x100;
else
ret = -EINVAL;
ret = lan78xx_read_raw_otp(dev, offset, length, data);
if (!ret)
ret = lan78xx_read_raw_otp(dev, offset, length, data);
}

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

lan78xx_defer_kevent(dev, EVENT_STAT_UPDATE);
set_bit(EVENT_STAT_UPDATE, &dev->flags);
}

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

ret = lan78xx_reset(dev);
if (ret < 0)
goto done;

phy_start(net->phydev);

netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
Expand Down
Loading

0 comments on commit 5d13659

Please sign in to comment.