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:
 "More fixes in the queue:

  1) Netfilter nat can erroneously register the device notifier twice,
     fix from Florian Westphal.

  2) Use after free in nf_tables, from Pablo Neira Ayuso.

  3) Parallel update of steering rule fix in mlx5 river, from Eli
     Britstein.

  4) RX processing panic in lan743x, fix from Bryan Whitehead.

  5) Use before initialization of TCP_SKB_CB, fix from Christoph Paasch.

  6) Fix locking in SRIOV mode of mlx4 driver, from Jack Morgenstein.

  7) Fix TX stalls in lan743x due to mishandling of interrupt ACKing
     modes, from Bryan Whitehead.

  8) Fix infoleak in l2tp_ip6_recvmsg(), from Eric Dumazet"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (43 commits)
  pptp: dst_release sk_dst_cache in pptp_sock_destruct
  MAINTAINERS: GENET & SYSTEMPORT: Add internal Broadcom list
  l2tp: fix infoleak in l2tp_ip6_recvmsg()
  net/tls: Inform user space about send buffer availability
  net_sched: return correct value for *notify* functions
  lan743x: Fix TX Stall Issue
  net/mlx4_core: Fix qp mtt size calculation
  net/mlx4_core: Fix locking in SRIOV mode when switching between events and polling
  net/mlx4_core: Fix reset flow when in command polling mode
  mlxsw: minimal: Initialize base_mac
  mlxsw: core: Prevent duplication during QSFP module initialization
  net: dwmac-sun8i: fix a missing check of of_get_phy_mode
  net: sh_eth: fix a missing check of of_get_phy_mode
  net: 8390: fix potential NULL pointer dereferences
  net: fujitsu: fix a potential NULL pointer dereference
  net: qlogic: fix a potential NULL pointer dereference
  isdn: hfcpci: fix potential NULL pointer dereference
  Documentation: devicetree: add a new optional property for port mac address
  net: rocker: fix a potential NULL pointer dereference
  net: qlge: fix a potential NULL pointer dereference
  ...
  • Loading branch information
torvalds committed Mar 14, 2019
2 parents 31ef489 + 9417d81 commit f3ca4c5
Show file tree
Hide file tree
Showing 46 changed files with 427 additions and 213 deletions.
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/net/dsa/dsa.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ properties, described in binding documents:
Documentation/devicetree/bindings/net/fixed-link.txt
for details.

- local-mac-address : See
Documentation/devicetree/bindings/net/ethernet.txt
for details.

Example

The following example shows three switches on three MDIO busses,
Expand All @@ -97,6 +101,7 @@ linked into one DSA cluster.
port@1 {
reg = <1>;
label = "lan1";
local-mac-address = [00 00 00 00 00 00];
};

port@2 {
Expand Down
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,7 @@ F: drivers/phy/broadcom/phy-brcm-usb*
BROADCOM GENET ETHERNET DRIVER
M: Doug Berger <[email protected]>
M: Florian Fainelli <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
F: drivers/net/ethernet/broadcom/genet/
Expand Down Expand Up @@ -3311,6 +3312,7 @@ F: drivers/spi/spi-iproc-qspi.c

BROADCOM SYSTEMPORT ETHERNET DRIVER
M: Florian Fainelli <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
F: drivers/net/ethernet/broadcom/bcmsysport.*
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#ifndef _UAPI_ASM_SOCKET_H
#define _UAPI_ASM_SOCKET_H

#include <linux/posix_types.h>
#include <asm/sockios.h>
#include <asm/bitsperlong.h>

/* For setsockopt(2) */
/*
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef _UAPI_ASM_SOCKET_H
#define _UAPI_ASM_SOCKET_H

#include <linux/posix_types.h>
#include <asm/sockios.h>
#include <asm/bitsperlong.h>

/*
* For setsockopt(2)
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#ifndef _UAPI_ASM_SOCKET_H
#define _UAPI_ASM_SOCKET_H

#include <linux/posix_types.h>
#include <asm/sockios.h>
#include <asm/bitsperlong.h>

/* For setsockopt(2) */
#define SOL_SOCKET 0xffff
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#ifndef _ASM_SOCKET_H
#define _ASM_SOCKET_H

#include <linux/posix_types.h>
#include <asm/sockios.h>
#include <asm/bitsperlong.h>

/* For setsockopt(2) */
#define SOL_SOCKET 0xffff
Expand Down
9 changes: 9 additions & 0 deletions drivers/isdn/hardware/mISDN/hfcpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2032,10 +2032,19 @@ setup_hw(struct hfc_pci *hc)
hc->hw.fifos = buffer;
pci_write_config_dword(hc->pdev, 0x80, hc->hw.dmahandle);
hc->hw.pci_io = ioremap((ulong) hc->hw.pci_io, 256);
if (unlikely(!hc->hw.pci_io)) {
printk(KERN_WARNING
"HFC-PCI: Error in ioremap for PCI!\n");
pci_free_consistent(hc->pdev, 0x8000, hc->hw.fifos,
hc->hw.dmahandle);
return 1;
}

printk(KERN_INFO
"HFC-PCI: defined at mem %#lx fifo %#lx(%#lx) IRQ %d HZ %d\n",
(u_long) hc->hw.pci_io, (u_long) hc->hw.fifos,
(u_long) hc->hw.dmahandle, hc->irq, HZ);

/* enable memory mapped ports, disable busmaster */
pci_write_config_word(hc->pdev, PCI_COMMAND, PCI_ENA_MEMIO);
hc->hw.int_m2 = 0;
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ethernet/8390/pcnet_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link)

virt = ioremap(link->resource[2]->start,
resource_size(link->resource[2]));
if (unlikely(!virt)) {
pcmcia_release_window(link, link->resource[2]);
return NULL;
}

for (i = 0; i < NR_INFO; i++) {
pcmcia_map_mem_page(link, link->resource[2],
hw_info[i].offset & ~(resource_size(link->resource[2])-1));
Expand Down Expand Up @@ -1423,6 +1428,11 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
/* Try scribbling on the buffer */
info->base = ioremap(link->resource[3]->start,
resource_size(link->resource[3]));
if (unlikely(!info->base)) {
ret = -ENOMEM;
goto failed;
}

for (i = 0; i < (TX_PAGES<<8); i += 2)
__raw_writew((i>>1), info->base+offset+i);
udelay(100);
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/lio_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,11 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)

sc = (struct octeon_soft_command *)
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, 16, 0);
if (!sc) {
netif_info(lio, rx_err, lio->netdev,
"Failed to allocate soft command\n");
return -ENOMEM;
}

ncmd = (union octnet_cmd *)sc->virtdptr;

Expand Down Expand Up @@ -1684,6 +1689,11 @@ int liquidio_set_fec(struct lio *lio, int on_off)

sc = octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
sizeof(struct oct_nic_seapi_resp), 0);
if (!sc) {
dev_err(&oct->pci_dev->dev,
"Failed to allocate soft command\n");
return -ENOMEM;
}

ncmd = sc->virtdptr;
resp = sc->virtrptr;
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/lio_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,11 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
sc = (struct octeon_soft_command *)
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
16, 0);
if (!sc) {
netif_info(lio, rx_err, lio->netdev,
"Failed to allocate octeon_soft_command\n");
return;
}

ncmd = (union octnet_cmd *)sc->virtdptr;

Expand Down
6 changes: 6 additions & 0 deletions drivers/net/ethernet/cavium/thunder/nicvf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,12 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
nic->nicvf_rx_mode_wq = alloc_ordered_workqueue("nicvf_rx_mode_wq_VF%d",
WQ_MEM_RECLAIM,
nic->vf_id);
if (!nic->nicvf_rx_mode_wq) {
err = -ENOMEM;
dev_err(dev, "Failed to allocate work queue\n");
goto err_unregister_interrupts;
}

INIT_WORK(&nic->rx_mode_work.work, nicvf_set_rx_mode_task);
spin_lock_init(&nic->rx_mode_wq_lock);
mutex_init(&nic->rx_mode_mtx);
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ethernet/fujitsu/fmvj18x_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
return -1;

base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
if (!base) {
pcmcia_release_window(link, link->resource[2]);
return -ENOMEM;
}

pcmcia_map_mem_page(link, link->resource[2], 0);

/*
Expand Down
9 changes: 9 additions & 0 deletions drivers/net/ethernet/mellanox/mlx4/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,8 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
if (!priv->cmd.context)
return -ENOMEM;

if (mlx4_is_mfunc(dev))
mutex_lock(&priv->cmd.slave_cmd_mutex);
down_write(&priv->cmd.switch_sem);
for (i = 0; i < priv->cmd.max_cmds; ++i) {
priv->cmd.context[i].token = i;
Expand All @@ -2670,6 +2672,8 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
down(&priv->cmd.poll_sem);
priv->cmd.use_events = 1;
up_write(&priv->cmd.switch_sem);
if (mlx4_is_mfunc(dev))
mutex_unlock(&priv->cmd.slave_cmd_mutex);

return err;
}
Expand All @@ -2682,16 +2686,21 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev)
struct mlx4_priv *priv = mlx4_priv(dev);
int i;

if (mlx4_is_mfunc(dev))
mutex_lock(&priv->cmd.slave_cmd_mutex);
down_write(&priv->cmd.switch_sem);
priv->cmd.use_events = 0;

for (i = 0; i < priv->cmd.max_cmds; ++i)
down(&priv->cmd.event_sem);

kfree(priv->cmd.context);
priv->cmd.context = NULL;

up(&priv->cmd.poll_sem);
up_write(&priv->cmd.switch_sem);
if (mlx4_is_mfunc(dev))
mutex_unlock(&priv->cmd.slave_cmd_mutex);
}

struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2719,13 +2719,13 @@ static int qp_get_mtt_size(struct mlx4_qp_context *qpc)
int total_pages;
int total_mem;
int page_offset = (be32_to_cpu(qpc->params2) >> 6) & 0x3f;
int tot;

sq_size = 1 << (log_sq_size + log_sq_sride + 4);
rq_size = (srq|rss|xrc) ? 0 : (1 << (log_rq_size + log_rq_stride + 4));
total_mem = sq_size + rq_size;
total_pages =
roundup_pow_of_two((total_mem + (page_offset << 6)) >>
page_shift);
tot = (total_mem + (page_offset << 6)) >> page_shift;
total_pages = !tot ? 1 : roundup_pow_of_two(tot);

return total_pages;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,

if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
priv->channels.params = new_channels.params;
if (!netif_is_rxfh_configured(priv->netdev))
mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
MLX5E_INDIR_RQT_SIZE, count);
goto out;
}

Expand Down
13 changes: 7 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,16 +1129,17 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep;
int ret, pf_num;
unsigned int fn;
int ret;

ret = mlx5_lag_get_pf_num(priv->mdev, &pf_num);
if (ret)
return ret;
fn = PCI_FUNC(priv->mdev->pdev->devfn);
if (fn >= MLX5_MAX_PORTS)
return -EOPNOTSUPP;

if (rep->vport == MLX5_VPORT_UPLINK)
ret = snprintf(buf, len, "p%d", pf_num);
ret = snprintf(buf, len, "p%d", fn);
else
ret = snprintf(buf, len, "pf%dvf%d", pf_num, rep->vport - 1);
ret = snprintf(buf, len, "pf%dvf%d", fn, rep->vport - 1);

if (ret >= len)
return -EOPNOTSUPP;
Expand Down
11 changes: 8 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1295,8 +1295,14 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,

skb->protocol = *((__be16 *)(skb->data));

skb->ip_summed = CHECKSUM_COMPLETE;
skb->csum = csum_unfold((__force __sum16)cqe->check_sum);
if (netdev->features & NETIF_F_RXCSUM) {
skb->ip_summed = CHECKSUM_COMPLETE;
skb->csum = csum_unfold((__force __sum16)cqe->check_sum);
stats->csum_complete++;
} else {
skb->ip_summed = CHECKSUM_NONE;
stats->csum_none++;
}

if (unlikely(mlx5e_rx_hw_stamp(tstamp)))
skb_hwtstamps(skb)->hwtstamp =
Expand All @@ -1315,7 +1321,6 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,

skb->dev = netdev;

stats->csum_complete++;
stats->packets++;
stats->bytes += cqe_bcnt;
}
Expand Down
17 changes: 11 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
u64 node_guid;
int err = 0;

if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
return -EPERM;
if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
return -EINVAL;
Expand Down Expand Up @@ -2005,7 +2005,7 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
{
struct mlx5_vport *evport;

if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
return -EPERM;
if (!LEGAL_VPORT(esw, vport))
return -EINVAL;
Expand Down Expand Up @@ -2297,19 +2297,24 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider)
int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
u32 max_rate, u32 min_rate)
{
u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
bool min_rate_supported = MLX5_CAP_QOS(esw->dev, esw_bw_share) &&
fw_max_bw_share >= MLX5_MIN_BW_SHARE;
bool max_rate_supported = MLX5_CAP_QOS(esw->dev, esw_rate_limit);
struct mlx5_vport *evport;
u32 fw_max_bw_share;
u32 previous_min_rate;
u32 divider;
bool min_rate_supported;
bool max_rate_supported;
int err = 0;

if (!ESW_ALLOWED(esw))
return -EPERM;
if (!LEGAL_VPORT(esw, vport))
return -EINVAL;

fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
min_rate_supported = MLX5_CAP_QOS(esw->dev, esw_bw_share) &&
fw_max_bw_share >= MLX5_MIN_BW_SHARE;
max_rate_supported = MLX5_CAP_QOS(esw->dev, esw_rate_limit);

if ((min_rate && !min_rate_supported) || (max_rate && !max_rate_supported))
return -EOPNOTSUPP;

Expand Down
Loading

0 comments on commit f3ca4c5

Please sign in to comment.