Skip to content

Commit fc08b19

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) MLX5 bug fixes from Saeed Mahameed et al: - released wrong resources when firmware timeout happens - fix wrong check for encapsulation size limits - UAR memory leak - ETHTOOL_GRXCLSRLALL failed to fill in info->data 2) Don't cache l3mdev on mis-matches local route, causes net devices to leak refs. From Robert Shearman. 3) Handle fragmented SKBs properly in macsec driver, the problem is that we were mis-sizing the sgvec table. From Jason A. Donenfeld. 4) We cannot have checksum offload enabled for inner UDP tunneled packet during IPSEC, from Ansis Atteka. 5) Fix double SKB free in ravb driver, from Dan Carpenter. 6) Fix CPU port handling in b53 DSA driver, from Florian Dainelli. 7) Don't use on-stack buffers for usb_control_msg() in CAN usb driver, from Maksim Salau. 8) Fix device leak in macvlan driver, from Herbert Xu. We have to purge the broadcast queue properly on port destroy. 9) Fix tx ring entry limit on EF10 devices in sfc driver. From Bert Kenward. 10) Fix memory leaks in team driver, from Pan Bian. 11) Don't setup ipv6_stub before it can be actually used, from Paolo Abeni. 12) Fix tipc socket flow control accounting, from Parthasarathy Bhuvaragan. 13) Fix crash on module unload in hso driver, from Andreas Kemnade. 14) Fix purging of bridge multicast entries, the problem is that if we don't defer it to ndo_uninit it's possible for new entries to get added after we purge. Fix from Xin Long. 15) Don't return garbage for PACKET_HDRLEN getsockopt, from Alexander Potapenko. 16) Fix autoneg stall properly in PHY layer, and revert micrel driver change that was papering over it. From Alexander Kochetkov. 17) Don't dereference an ipv4 route as an ipv6 one in the ip6_tunnnel code, from Cong Wang. 18) Clear out the congestion control private of the TCP socket in all of the right places, from Wei Wang. 19) rawv6_ioctl measures SKB length incorrectly, fix from Jamie Bainbridge. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (41 commits) ipv6: check raw payload size correctly in ioctl tcp: memset ca_priv data to 0 properly ipv6: check skb->protocol before lookup for nexthop net: core: Prevent from dereferencing null pointer when releasing SKB macsec: dynamically allocate space for sglist Revert "phy: micrel: Disable auto negotiation on startup" net: phy: fix auto-negotiation stall due to unavailable interrupt net/packet: check length in getsockopt() called with PACKET_HDRLEN net: ipv6: regenerate host route if moved to gc list bridge: move bridge multicast cleanup to ndo_uninit ipv6: fix source routing qed: Fix error in the dcbx app meta data initialization. netvsc: fix calculation of available send sections net: hso: fix module unloading tipc: fix socket flow control accounting error at tipc_recv_stream tipc: fix socket flow control accounting error at tipc_send_stream ipv6: move stub initialization after ipv6 setup completion team: fix memory leaks sfc: tx ring can only have 2048 entries for all EF10 NICs macvlan: Fix device ref leak when purging bc_queue ...
2 parents ea3a859 + 105f552 commit fc08b19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+373
-141
lines changed

drivers/net/can/usb/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ config CAN_PEAK_USB
7272
PCAN-USB Pro dual CAN 2.0b channels USB adapter
7373
PCAN-USB FD single CAN-FD channel USB adapter
7474
PCAN-USB Pro FD dual CAN-FD channels USB adapter
75+
PCAN-Chip USB CAN-FD to USB stamp module
76+
PCAN-USB X6 6 CAN-FD channels USB adapter
7577

7678
(see also http://www.peak-system.com).
7779

drivers/net/can/usb/gs_usb.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,18 @@ static const struct net_device_ops gs_usb_netdev_ops = {
739739
static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
740740
{
741741
struct gs_can *dev = netdev_priv(netdev);
742-
struct gs_identify_mode imode;
742+
struct gs_identify_mode *imode;
743743
int rc;
744744

745+
imode = kmalloc(sizeof(*imode), GFP_KERNEL);
746+
747+
if (!imode)
748+
return -ENOMEM;
749+
745750
if (do_identify)
746-
imode.mode = GS_CAN_IDENTIFY_ON;
751+
imode->mode = GS_CAN_IDENTIFY_ON;
747752
else
748-
imode.mode = GS_CAN_IDENTIFY_OFF;
753+
imode->mode = GS_CAN_IDENTIFY_OFF;
749754

750755
rc = usb_control_msg(interface_to_usbdev(dev->iface),
751756
usb_sndctrlpipe(interface_to_usbdev(dev->iface),
@@ -755,10 +760,12 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
755760
USB_RECIP_INTERFACE,
756761
dev->channel,
757762
0,
758-
&imode,
759-
sizeof(imode),
763+
imode,
764+
sizeof(*imode),
760765
100);
761766

767+
kfree(imode);
768+
762769
return (rc > 0) ? 0 : rc;
763770
}
764771

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static struct usb_device_id peak_usb_table[] = {
3939
{USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPRO_PRODUCT_ID)},
4040
{USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBFD_PRODUCT_ID)},
4141
{USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPROFD_PRODUCT_ID)},
42+
{USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBCHIP_PRODUCT_ID)},
4243
{USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBX6_PRODUCT_ID)},
4344
{} /* Terminating entry */
4445
};
@@ -51,6 +52,7 @@ static const struct peak_usb_adapter *const peak_usb_adapters_list[] = {
5152
&pcan_usb_pro,
5253
&pcan_usb_fd,
5354
&pcan_usb_pro_fd,
55+
&pcan_usb_chip,
5456
&pcan_usb_x6,
5557
};
5658

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define PCAN_USBPRO_PRODUCT_ID 0x000d
2828
#define PCAN_USBPROFD_PRODUCT_ID 0x0011
2929
#define PCAN_USBFD_PRODUCT_ID 0x0012
30+
#define PCAN_USBCHIP_PRODUCT_ID 0x0013
3031
#define PCAN_USBX6_PRODUCT_ID 0x0014
3132

3233
#define PCAN_USB_DRIVER_NAME "peak_usb"
@@ -90,6 +91,7 @@ struct peak_usb_adapter {
9091
extern const struct peak_usb_adapter pcan_usb;
9192
extern const struct peak_usb_adapter pcan_usb_pro;
9293
extern const struct peak_usb_adapter pcan_usb_fd;
94+
extern const struct peak_usb_adapter pcan_usb_chip;
9395
extern const struct peak_usb_adapter pcan_usb_pro_fd;
9496
extern const struct peak_usb_adapter pcan_usb_x6;
9597

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

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,78 @@ const struct peak_usb_adapter pcan_usb_fd = {
10611061
.do_get_berr_counter = pcan_usb_fd_get_berr_counter,
10621062
};
10631063

1064+
/* describes the PCAN-CHIP USB */
1065+
static const struct can_bittiming_const pcan_usb_chip_const = {
1066+
.name = "pcan_chip_usb",
1067+
.tseg1_min = 1,
1068+
.tseg1_max = (1 << PUCAN_TSLOW_TSGEG1_BITS),
1069+
.tseg2_min = 1,
1070+
.tseg2_max = (1 << PUCAN_TSLOW_TSGEG2_BITS),
1071+
.sjw_max = (1 << PUCAN_TSLOW_SJW_BITS),
1072+
.brp_min = 1,
1073+
.brp_max = (1 << PUCAN_TSLOW_BRP_BITS),
1074+
.brp_inc = 1,
1075+
};
1076+
1077+
static const struct can_bittiming_const pcan_usb_chip_data_const = {
1078+
.name = "pcan_chip_usb",
1079+
.tseg1_min = 1,
1080+
.tseg1_max = (1 << PUCAN_TFAST_TSGEG1_BITS),
1081+
.tseg2_min = 1,
1082+
.tseg2_max = (1 << PUCAN_TFAST_TSGEG2_BITS),
1083+
.sjw_max = (1 << PUCAN_TFAST_SJW_BITS),
1084+
.brp_min = 1,
1085+
.brp_max = (1 << PUCAN_TFAST_BRP_BITS),
1086+
.brp_inc = 1,
1087+
};
1088+
1089+
const struct peak_usb_adapter pcan_usb_chip = {
1090+
.name = "PCAN-Chip USB",
1091+
.device_id = PCAN_USBCHIP_PRODUCT_ID,
1092+
.ctrl_count = PCAN_USBFD_CHANNEL_COUNT,
1093+
.ctrlmode_supported = CAN_CTRLMODE_FD |
1094+
CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
1095+
.clock = {
1096+
.freq = PCAN_UFD_CRYSTAL_HZ,
1097+
},
1098+
.bittiming_const = &pcan_usb_chip_const,
1099+
.data_bittiming_const = &pcan_usb_chip_data_const,
1100+
1101+
/* size of device private data */
1102+
.sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
1103+
1104+
/* timestamps usage */
1105+
.ts_used_bits = 32,
1106+
.ts_period = 1000000, /* calibration period in ts. */
1107+
.us_per_ts_scale = 1, /* us = (ts * scale) >> shift */
1108+
.us_per_ts_shift = 0,
1109+
1110+
/* give here messages in/out endpoints */
1111+
.ep_msg_in = PCAN_USBPRO_EP_MSGIN,
1112+
.ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0},
1113+
1114+
/* size of rx/tx usb buffers */
1115+
.rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE,
1116+
.tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE,
1117+
1118+
/* device callbacks */
1119+
.intf_probe = pcan_usb_pro_probe, /* same as PCAN-USB Pro */
1120+
.dev_init = pcan_usb_fd_init,
1121+
1122+
.dev_exit = pcan_usb_fd_exit,
1123+
.dev_free = pcan_usb_fd_free,
1124+
.dev_set_bus = pcan_usb_fd_set_bus,
1125+
.dev_set_bittiming = pcan_usb_fd_set_bittiming_slow,
1126+
.dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast,
1127+
.dev_decode_buf = pcan_usb_fd_decode_buf,
1128+
.dev_start = pcan_usb_fd_start,
1129+
.dev_stop = pcan_usb_fd_stop,
1130+
.dev_restart_async = pcan_usb_fd_restart_async,
1131+
.dev_encode_msg = pcan_usb_fd_encode_msg,
1132+
1133+
.do_get_berr_counter = pcan_usb_fd_get_berr_counter,
1134+
};
1135+
10641136
/* describes the PCAN-USB Pro FD adapter */
10651137
static const struct can_bittiming_const pcan_usb_pro_fd_const = {
10661138
.name = "pcan_usb_pro_fd",

drivers/net/dsa/b53/b53_common.c

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ static void b53_get_vlan_entry(struct b53_device *dev, u16 vid,
326326

327327
static void b53_set_forwarding(struct b53_device *dev, int enable)
328328
{
329+
struct dsa_switch *ds = dev->ds;
329330
u8 mgmt;
330331

331332
b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt);
@@ -336,6 +337,15 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
336337
mgmt &= ~SM_SW_FWD_EN;
337338

338339
b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
340+
341+
/* Include IMP port in dumb forwarding mode when no tagging protocol is
342+
* set
343+
*/
344+
if (ds->ops->get_tag_protocol(ds) == DSA_TAG_PROTO_NONE) {
345+
b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, &mgmt);
346+
mgmt |= B53_MII_DUMB_FWDG_EN;
347+
b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt);
348+
}
339349
}
340350

341351
static void b53_enable_vlan(struct b53_device *dev, bool enable)
@@ -598,7 +608,8 @@ static void b53_switch_reset_gpio(struct b53_device *dev)
598608

599609
static int b53_switch_reset(struct b53_device *dev)
600610
{
601-
u8 mgmt;
611+
unsigned int timeout = 1000;
612+
u8 mgmt, reg;
602613

603614
b53_switch_reset_gpio(dev);
604615

@@ -607,6 +618,28 @@ static int b53_switch_reset(struct b53_device *dev)
607618
b53_write8(dev, B53_CTRL_PAGE, B53_SOFTRESET, 0x00);
608619
}
609620

621+
/* This is specific to 58xx devices here, do not use is58xx() which
622+
* covers the larger Starfigther 2 family, including 7445/7278 which
623+
* still use this driver as a library and need to perform the reset
624+
* earlier.
625+
*/
626+
if (dev->chip_id == BCM58XX_DEVICE_ID) {
627+
b53_read8(dev, B53_CTRL_PAGE, B53_SOFTRESET, &reg);
628+
reg |= SW_RST | EN_SW_RST | EN_CH_RST;
629+
b53_write8(dev, B53_CTRL_PAGE, B53_SOFTRESET, reg);
630+
631+
do {
632+
b53_read8(dev, B53_CTRL_PAGE, B53_SOFTRESET, &reg);
633+
if (!(reg & SW_RST))
634+
break;
635+
636+
usleep_range(1000, 2000);
637+
} while (timeout-- > 0);
638+
639+
if (timeout == 0)
640+
return -ETIMEDOUT;
641+
}
642+
610643
b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt);
611644

612645
if (!(mgmt & SM_SW_FWD_EN)) {
@@ -1731,7 +1764,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
17311764
.vlans = 4096,
17321765
.enabled_ports = 0x1ff,
17331766
.arl_entries = 4,
1734-
.cpu_port = B53_CPU_PORT_25,
1767+
.cpu_port = B53_CPU_PORT,
17351768
.vta_regs = B53_VTA_REGS,
17361769
.duplex_reg = B53_DUPLEX_STAT_GE,
17371770
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,

drivers/net/dsa/b53/b53_regs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
#define B53_UC_FWD_EN BIT(6)
105105
#define B53_MC_FWD_EN BIT(7)
106106

107+
/* Switch control (8 bit) */
108+
#define B53_SWITCH_CTRL 0x22
109+
#define B53_MII_DUMB_FWDG_EN BIT(6)
110+
107111
/* (16 bit) */
108112
#define B53_UC_FLOOD_MASK 0x32
109113
#define B53_MC_FLOOD_MASK 0x34
@@ -139,6 +143,7 @@
139143
/* Software reset register (8 bit) */
140144
#define B53_SOFTRESET 0x79
141145
#define SW_RST BIT(7)
146+
#define EN_CH_RST BIT(6)
142147
#define EN_SW_RST BIT(4)
143148

144149
/* Fast Aging Control register (8 bit) */

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
#define MLX5E_VALID_NUM_MTTS(num_mtts) (MLX5_MTT_OCTW(num_mtts) - 1 <= U16_MAX)
9191

9292
#define MLX5_UMR_ALIGN (2048)
93-
#define MLX5_MPWRQ_SMALL_PACKET_THRESHOLD (128)
93+
#define MLX5_MPWRQ_SMALL_PACKET_THRESHOLD (256)
9494

9595
#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ (64 * 1024)
9696
#define MLX5E_DEFAULT_LRO_TIMEOUT 32

drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ int mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv, struct ethtool_rxnfc *i
564564
int idx = 0;
565565
int err = 0;
566566

567+
info->data = MAX_NUM_OF_ETHTOOL_RULES;
567568
while ((!err || err == -ENOENT) && idx < info->rule_cnt) {
568569
err = mlx5e_ethtool_get_flow(priv, info, location);
569570
if (!err)

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static void mlx5e_tx_timeout_work(struct work_struct *work)
174174

175175
static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
176176
{
177-
struct mlx5e_sw_stats *s = &priv->stats.sw;
177+
struct mlx5e_sw_stats temp, *s = &temp;
178178
struct mlx5e_rq_stats *rq_stats;
179179
struct mlx5e_sq_stats *sq_stats;
180180
u64 tx_offload_none = 0;
@@ -229,6 +229,7 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
229229
s->link_down_events_phy = MLX5_GET(ppcnt_reg,
230230
priv->stats.pport.phy_counters,
231231
counter_set.phys_layer_cntrs.link_down_events);
232+
memcpy(&priv->stats.sw, s, sizeof(*s));
232233
}
233234

234235
static void mlx5e_update_vport_counters(struct mlx5e_priv *priv)
@@ -243,7 +244,6 @@ static void mlx5e_update_vport_counters(struct mlx5e_priv *priv)
243244
MLX5_SET(query_vport_counter_in, in, op_mod, 0);
244245
MLX5_SET(query_vport_counter_in, in, other_vport, 0);
245246

246-
memset(out, 0, outlen);
247247
mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen);
248248
}
249249

0 commit comments

Comments
 (0)