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:
 "Several bug fixes, many are quick merge-window regression cures:

   - When NLM_F_EXCL is not set, allow same fib rule insertion. From
     Hangbin Liu.

   - Several cures in sja1105 DSA driver (while loop exit condition fix,
     return of negative u8, etc.) from Vladimir Oltean.

   - Handle tx/rx delays in realtek PHY driver properly, from Serge
     Semin.

   - Double free in cls_matchall, from Pieter Jansen van Vuuren.

   - Disable SIOCSHWTSTAMP in macvlan/vlan containers, from Hangbin Liu.

   - Endainness fixes in aqc111, from Oliver Neukum.

   - Handle errors in packet_init properly, from Haibing Yue.

   - Various W=1 warning fixes in kTLS, from Jakub Kicinski"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (34 commits)
  nfp: add missing kdoc
  net/tls: handle errors from padding_length()
  net/tls: remove set but not used variables
  docs/btf: fix the missing section marks
  nfp: bpf: fix static check error through tightening shift amount adjustment
  selftests: bpf: initialize bpf_object pointers where needed
  packet: Fix error path in packet_init
  net/tcp: use deferred jump label for TCP acked data hook
  net: aquantia: fix undefined devm_hwmon_device_register_with_info reference
  aqc111: fix double endianness swap on BE
  aqc111: fix writing to the phy on BE
  aqc111: fix endianness issue in aqc111_change_mtu
  vlan: disable SIOCSHWTSTAMP in container
  macvlan: disable SIOCSHWTSTAMP in container
  tipc: fix hanging clients using poll with EPOLLOUT flag
  tuntap: synchronize through tfiles array instead of tun->numqueues
  tuntap: fix dividing by zero in ebpf queue selection
  dwmac4_prog_mtl_tx_algorithms() missing write operation
  ptp_qoriq: fix NULL access if ptp dt node missing
  net/sched: avoid double free on matchall reoffload
  ...
  • Loading branch information
torvalds committed May 10, 2019
2 parents 9b6c9e9 + 6c9f054 commit 601e6bc
Show file tree
Hide file tree
Showing 35 changed files with 250 additions and 74 deletions.
2 changes: 2 additions & 0 deletions Documentation/bpf/btf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ For line_info, the line number and column number are defined as below:
#define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff)

3.4 BPF_{PROG,MAP}_GET_NEXT_ID
==============================

In kernel, every loaded program, map or btf has a unique id. The id won't
change during the lifetime of a program, map, or btf.
Expand All @@ -587,6 +588,7 @@ each command, to user space, for bpf program or maps, respectively, so an
inspection tool can inspect all programs and maps.

3.5 BPF_{PROG,MAP}_GET_FD_BY_ID
===============================

An introspection tool cannot use id to get details about program or maps.
A file descriptor needs to be obtained first for reference-counting purpose.
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/dsa/lantiq_gswip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ static void gswip_port_fast_age(struct dsa_switch *ds, int port)

err = gswip_pce_table_entry_read(priv, &mac_bridge);
if (err) {
dev_err(priv->dev, "failed to read mac brigde: %d\n",
dev_err(priv->dev, "failed to read mac bridge: %d\n",
err);
return;
}
Expand All @@ -1252,7 +1252,7 @@ static void gswip_port_fast_age(struct dsa_switch *ds, int port)
mac_bridge.valid = false;
err = gswip_pce_table_entry_write(priv, &mac_bridge);
if (err) {
dev_err(priv->dev, "failed to write mac brigde: %d\n",
dev_err(priv->dev, "failed to write mac bridge: %d\n",
err);
return;
}
Expand Down Expand Up @@ -1328,7 +1328,7 @@ static int gswip_port_fdb(struct dsa_switch *ds, int port,

err = gswip_pce_table_entry_write(priv, &mac_bridge);
if (err)
dev_err(priv->dev, "failed to write mac brigde: %d\n", err);
dev_err(priv->dev, "failed to write mac bridge: %d\n", err);

return err;
}
Expand Down Expand Up @@ -1360,7 +1360,7 @@ static int gswip_port_fdb_dump(struct dsa_switch *ds, int port,

err = gswip_pce_table_entry_read(priv, &mac_bridge);
if (err) {
dev_err(priv->dev, "failed to write mac brigde: %d\n",
dev_err(priv->dev, "failed to write mac bridge: %d\n",
err);
return err;
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/dsa/sja1105/sja1105_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,11 @@ static u8 sja1105_stp_state_get(struct sja1105_private *priv, int port)
return BR_STATE_LEARNING;
if (mac[port].ingress && mac[port].egress && mac[port].dyn_learn)
return BR_STATE_FORWARDING;
return -EINVAL;
/* This is really an error condition if the MAC was in none of the STP
* states above. But treating the port as disabled does nothing, which
* is adequate, and it also resets the MAC to a known state later on.
*/
return BR_STATE_DISABLED;
}

/* For situations where we need to change a setting at runtime that is only
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/dsa/sja1105/sja1105_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,15 @@ int sja1105_static_config_upload(struct sja1105_private *priv)
"invalid, retrying...\n");
continue;
}
} while (--retries && (status.crcchkl == 1 || status.crcchkg == 1 ||
status.configs == 0 || status.ids == 1));
/* Success! */
break;
} while (--retries);

if (!retries) {
rc = -EIO;
dev_err(dev, "Failed to upload config to device, giving up\n");
goto out;
} else if (retries != RETRIES - 1) {
} else if (retries != RETRIES) {
dev_info(dev, "Succeeded after %d tried\n", RETRIES - retries);
}

Expand All @@ -483,7 +484,7 @@ int sja1105_static_config_upload(struct sja1105_private *priv)
return rc;
}

struct sja1105_regs sja1105et_regs = {
static struct sja1105_regs sja1105et_regs = {
.device_id = 0x0,
.prod_id = 0x100BC3,
.status = 0x1,
Expand All @@ -508,7 +509,7 @@ struct sja1105_regs sja1105et_regs = {
.rmii_ext_tx_clk = {0x100018, 0x10001F, 0x100026, 0x10002D, 0x100034},
};

struct sja1105_regs sja1105pqrs_regs = {
static struct sja1105_regs sja1105pqrs_regs = {
.device_id = 0x0,
.prod_id = 0x100BC3,
.status = 0x1,
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ethernet/aquantia/atlantic/aq_drvinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "aq_drvinfo.h"

#if IS_REACHABLE(CONFIG_HWMON)
static int aq_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *value)
{
Expand Down Expand Up @@ -123,3 +124,7 @@ int aq_drvinfo_init(struct net_device *ndev)

return err;
}

#else
int aq_drvinfo_init(struct net_device *ndev) { return 0; }
#endif
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto,
u8 il4_proto, u32 *type_cs_vlan_tso,
u32 *ol_type_vlan_len_msec)
{
unsigned char *l2_hdr = l2_hdr = skb->data;
unsigned char *l2_hdr = skb->data;
u32 l4_proto = ol4_proto;
union l4_hdr_info l4;
union l3_hdr_info l3;
Expand Down
13 changes: 12 additions & 1 deletion drivers/net/ethernet/netronome/nfp/bpf/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab,
return;
}

if (sc == SHF_SC_L_SHF)
/* NFP shift instruction has something special. If shift direction is
* left then shift amount of 1 to 31 is specified as 32 minus the amount
* to shift.
*
* But no need to do this for indirect shift which has shift amount be
* 0. Even after we do this subtraction, shift amount 0 will be turned
* into 32 which will eventually be encoded the same as 0 because only
* low 5 bits are encoded, but shift amount be 32 will fail the
* FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of
* mask range.
*/
if (sc == SHF_SC_L_SHF && shift)
shift = 32 - shift;

insn = OP_SHF_BASE |
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/netronome/nfp/ccm.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ static inline unsigned int nfp_ccm_get_tag(struct sk_buff *skb)

/**
* struct nfp_ccm - common control message handling
* @app: APP handle
*
* @tag_allocator: bitmap of control message tags in use
* @tag_alloc_next: next tag bit to allocate
* @tag_alloc_last: next tag bit to be freed
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const struct net_device_ops nfp_repr_netdev_ops = {
.ndo_fix_features = nfp_repr_fix_features,
.ndo_set_features = nfp_port_set_features,
.ndo_set_mac_address = eth_mac_addr,
.ndo_get_port_parent_id = nfp_port_get_port_parent_id,
.ndo_get_devlink_port = nfp_devlink_get_devlink_port,
};

Expand Down
16 changes: 16 additions & 0 deletions drivers/net/ethernet/netronome/nfp/nfp_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
return NULL;
}

int nfp_port_get_port_parent_id(struct net_device *netdev,
struct netdev_phys_item_id *ppid)
{
struct nfp_port *port;
const u8 *serial;

port = nfp_port_from_netdev(netdev);
if (!port)
return -EOPNOTSUPP;

ppid->id_len = nfp_cpp_serial(port->app->cpp, &serial);
memcpy(&ppid->id, serial, ppid->id_len);

return 0;
}

int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
void *type_data)
{
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ static void dwmac4_prog_mtl_tx_algorithms(struct mac_device_info *hw,
default:
break;
}

writel(value, ioaddr + MTL_OPERATION_MODE);
}

static void dwmac4_set_mtl_tx_queue_weight(struct mac_device_info *hw,
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)

switch (cmd) {
case SIOCSHWTSTAMP:
if (!net_eq(dev_net(dev), &init_net))
break;
case SIOCGHWTSTAMP:
if (netif_device_present(real_dev) && ops->ndo_do_ioctl)
err = ops->ndo_do_ioctl(real_dev, &ifrr, cmd);
Expand Down
70 changes: 66 additions & 4 deletions drivers/net/phy/realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@

#define RTL821x_INSR 0x13

#define RTL821x_EXT_PAGE_SELECT 0x1e
#define RTL821x_PAGE_SELECT 0x1f

#define RTL8211F_INSR 0x1d

#define RTL8211F_TX_DELAY BIT(8)
#define RTL8211E_TX_DELAY BIT(1)
#define RTL8211E_RX_DELAY BIT(2)
#define RTL8211E_MODE_MII_GMII BIT(3)

#define RTL8201F_ISR 0x1e
#define RTL8201F_IER 0x13
Expand Down Expand Up @@ -157,16 +161,73 @@ static int rtl8211c_config_init(struct phy_device *phydev)

static int rtl8211f_config_init(struct phy_device *phydev)
{
u16 val = 0;
u16 val;

/* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
/* enable TX-delay for rgmii-{id,txid}, and disable it for rgmii and
* rgmii-rxid. The RX-delay can be enabled by the external RXDLY pin.
*/
switch (phydev->interface) {
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_RXID:
val = 0;
break;
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_TXID:
val = RTL8211F_TX_DELAY;
break;
default: /* the rest of the modes imply leaving delay as is. */
return 0;
}

return phy_modify_paged(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, val);
}

static int rtl8211e_config_init(struct phy_device *phydev)
{
int ret = 0, oldpage;
u16 val;

/* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */
switch (phydev->interface) {
case PHY_INTERFACE_MODE_RGMII:
val = 0;
break;
case PHY_INTERFACE_MODE_RGMII_ID:
val = RTL8211E_TX_DELAY | RTL8211E_RX_DELAY;
break;
case PHY_INTERFACE_MODE_RGMII_RXID:
val = RTL8211E_RX_DELAY;
break;
case PHY_INTERFACE_MODE_RGMII_TXID:
val = RTL8211E_TX_DELAY;
break;
default: /* the rest of the modes imply leaving delays as is. */
return 0;
}

/* According to a sample driver there is a 0x1c config register on the
* 0xa4 extension page (0x7) layout. It can be used to disable/enable
* the RX/TX delays otherwise controlled by RXDLY/TXDLY pins. It can
* also be used to customize the whole configuration register:
* 8:6 = PHY Address, 5:4 = Auto-Negotiation, 3 = Interface Mode Select,
* 2 = RX Delay, 1 = TX Delay, 0 = SELRGV (see original PHY datasheet
* for details).
*/
oldpage = phy_select_page(phydev, 0x7);
if (oldpage < 0)
goto err_restore_page;

ret = phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4);
if (ret)
goto err_restore_page;

ret = phy_modify(phydev, 0x1c, RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
val);

err_restore_page:
return phy_restore_page(phydev, oldpage, ret);
}

static int rtl8211b_suspend(struct phy_device *phydev)
{
phy_write(phydev, MII_MMD_DATA, BIT(9));
Expand Down Expand Up @@ -239,6 +300,7 @@ static struct phy_driver realtek_drvs[] = {
}, {
PHY_ID_MATCH_EXACT(0x001cc915),
.name = "RTL8211E Gigabit Ethernet",
.config_init = &rtl8211e_config_init,
.ack_interrupt = &rtl821x_ack_interrupt,
.config_intr = &rtl8211e_config_intr,
.suspend = genphy_suspend,
Expand Down
14 changes: 12 additions & 2 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,18 @@ static u16 tun_automq_select_queue(struct tun_struct *tun, struct sk_buff *skb)
static u16 tun_ebpf_select_queue(struct tun_struct *tun, struct sk_buff *skb)
{
struct tun_prog *prog;
u32 numqueues;
u16 ret = 0;

numqueues = READ_ONCE(tun->numqueues);
if (!numqueues)
return 0;

prog = rcu_dereference(tun->steering_prog);
if (prog)
ret = bpf_prog_run_clear_cb(prog->prog, skb);

return ret % tun->numqueues;
return ret % numqueues;
}

static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,
Expand Down Expand Up @@ -699,6 +704,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
tun->tfiles[tun->numqueues - 1]);
ntfile = rtnl_dereference(tun->tfiles[index]);
ntfile->queue_index = index;
rcu_assign_pointer(tun->tfiles[tun->numqueues - 1],
NULL);

--tun->numqueues;
if (clean) {
Expand Down Expand Up @@ -1081,7 +1088,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
tfile = rcu_dereference(tun->tfiles[txq]);

/* Drop packet if interface is not attached */
if (txq >= tun->numqueues)
if (!tfile)
goto drop;

if (!rcu_dereference(tun->steering_prog))
Expand Down Expand Up @@ -1304,6 +1311,7 @@ static int tun_xdp_xmit(struct net_device *dev, int n,

rcu_read_lock();

resample:
numqueues = READ_ONCE(tun->numqueues);
if (!numqueues) {
rcu_read_unlock();
Expand All @@ -1312,6 +1320,8 @@ static int tun_xdp_xmit(struct net_device *dev, int n,

tfile = rcu_dereference(tun->tfiles[smp_processor_id() %
numqueues]);
if (unlikely(!tfile))
goto resample;

spin_lock(&tfile->tx_ring.producer_lock);
for (i = 0; i < n; i++) {
Expand Down
Loading

0 comments on commit 601e6bc

Please sign in to comment.