Skip to content

Commit d44cd82

Browse files
committed
Merge tag 'net-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from netfiler, xfrm and bluetooth. Oddly this includes a fix for a posix clock regression; in our previous PR we included a change there as a pre-requisite for networking one. That fix proved to be buggy and requires the follow-up included here. Thomas suggested we should send it, given we sent the buggy patch. Current release - regressions: - posix-clock: Fix unbalanced locking in pc_clock_settime() - netfilter: fix typo causing some targets not to load on IPv6 Current release - new code bugs: - xfrm: policy: remove last remnants of pernet inexact list Previous releases - regressions: - core: fix races in netdev_tx_sent_queue()/dev_watchdog() - bluetooth: fix UAF on sco_sock_timeout - eth: hv_netvsc: fix VF namespace also in synthetic NIC NETDEV_REGISTER event - eth: usbnet: fix name regression - eth: be2net: fix potential memory leak in be_xmit() - eth: plip: fix transmit path breakage Previous releases - always broken: - sched: deny mismatched skip_sw/skip_hw flags for actions created by classifiers - netfilter: bpf: must hold reference on net namespace - eth: virtio_net: fix integer overflow in stats - eth: bnxt_en: replace ptp_lock with irqsave variant - eth: octeon_ep: add SKB allocation failures handling in __octep_oq_process_rx() Misc: - MAINTAINERS: add Simon as an official reviewer" * tag 'net-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (40 commits) net: dsa: mv88e6xxx: support 4000ps cycle counter period net: dsa: mv88e6xxx: read cycle counter period from hardware net: dsa: mv88e6xxx: group cycle counter coefficients net: usb: qmi_wwan: add Fibocom FG132 0x0112 composition hv_netvsc: Fix VF namespace also in synthetic NIC NETDEV_REGISTER event net: dsa: microchip: disable EEE for KSZ879x/KSZ877x/KSZ876x Bluetooth: ISO: Fix UAF on iso_sock_timeout Bluetooth: SCO: Fix UAF on sco_sock_timeout Bluetooth: hci_core: Disable works on hci_unregister_dev posix-clock: posix-clock: Fix unbalanced locking in pc_clock_settime() r8169: avoid unsolicited interrupts net: sched: use RCU read-side critical section in taprio_dump() net: sched: fix use-after-free in taprio_change() net/sched: act_api: deny mismatched skip_sw/skip_hw flags for actions created by classifiers net: usb: usbnet: fix name regression mlxsw: spectrum_router: fix xa_store() error checking virtio_net: fix integer overflow in stats net: fix races in netdev_tx_sent_queue()/dev_watchdog() net: wwan: fix global oob in wwan_rtnl_policy netfilter: xtables: fix typo causing some targets not to load on IPv6 ...
2 parents c9a50b9 + 9efc44f commit d44cd82

File tree

46 files changed

+565
-258
lines changed

Some content is hidden

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

46 files changed

+565
-258
lines changed

.mailmap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ Jens Axboe <[email protected]> <[email protected]>
306306
307307
Jens Osterkamp <[email protected]>
308308
309+
Jesper Dangaard Brouer <[email protected]> <[email protected]>
310+
Jesper Dangaard Brouer <[email protected]> <[email protected]>
311+
Jesper Dangaard Brouer <[email protected]> <[email protected]>
312+
Jesper Dangaard Brouer <[email protected]> <[email protected]>
313+
Jesper Dangaard Brouer <[email protected]> <[email protected]>
309314
310315
311316

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16042,6 +16042,7 @@ M: "David S. Miller" <[email protected]>
1604216042
M: Eric Dumazet <[email protected]>
1604316043
M: Jakub Kicinski <[email protected]>
1604416044
M: Paolo Abeni <[email protected]>
16045+
R: Simon Horman <[email protected]>
1604516046
1604616047
S: Maintained
1604716048
P: Documentation/process/maintainer-netdev.rst
@@ -16084,6 +16085,7 @@ F: include/uapi/linux/rtnetlink.h
1608416085
F: lib/net_utils.c
1608516086
F: lib/random32.c
1608616087
F: net/
16088+
F: samples/pktgen/
1608716089
F: tools/net/
1608816090
F: tools/testing/selftests/net/
1608916091
X: Documentation/networking/mac80211-injection.rst

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,26 +2733,27 @@ static u32 ksz_get_phy_flags(struct dsa_switch *ds, int port)
27332733
return MICREL_KSZ8_P1_ERRATA;
27342734
break;
27352735
case KSZ8567_CHIP_ID:
2736+
/* KSZ8567R Errata DS80000752C Module 4 */
2737+
case KSZ8765_CHIP_ID:
2738+
case KSZ8794_CHIP_ID:
2739+
case KSZ8795_CHIP_ID:
2740+
/* KSZ879x/KSZ877x/KSZ876x Errata DS80000687C Module 2 */
27362741
case KSZ9477_CHIP_ID:
2742+
/* KSZ9477S Errata DS80000754A Module 4 */
27372743
case KSZ9567_CHIP_ID:
2744+
/* KSZ9567S Errata DS80000756A Module 4 */
27382745
case KSZ9896_CHIP_ID:
2746+
/* KSZ9896C Errata DS80000757A Module 3 */
27392747
case KSZ9897_CHIP_ID:
2740-
/* KSZ9477 Errata DS80000754C
2741-
*
2742-
* Module 4: Energy Efficient Ethernet (EEE) feature select must
2743-
* be manually disabled
2748+
/* KSZ9897R Errata DS80000758C Module 4 */
2749+
/* Energy Efficient Ethernet (EEE) feature select must be manually disabled
27442750
* The EEE feature is enabled by default, but it is not fully
27452751
* operational. It must be manually disabled through register
27462752
* controls. If not disabled, the PHY ports can auto-negotiate
27472753
* to enable EEE, and this feature can cause link drops when
27482754
* linked to another device supporting EEE.
27492755
*
2750-
* The same item appears in the errata for the KSZ9567, KSZ9896,
2751-
* and KSZ9897.
2752-
*
2753-
* A similar item appears in the errata for the KSZ8567, but
2754-
* provides an alternative workaround. For now, use the simple
2755-
* workaround of disabling the EEE feature for this device too.
2756+
* The same item appears in the errata for all switches above.
27562757
*/
27572758
return MICREL_NO_EEE;
27582759
}

drivers/net/dsa/mv88e6xxx/chip.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ struct mv88e6xxx_gpio_ops;
206206
struct mv88e6xxx_avb_ops;
207207
struct mv88e6xxx_ptp_ops;
208208
struct mv88e6xxx_pcs_ops;
209+
struct mv88e6xxx_cc_coeffs;
209210

210211
struct mv88e6xxx_irq {
211212
u16 masked;
@@ -408,6 +409,7 @@ struct mv88e6xxx_chip {
408409
struct cyclecounter tstamp_cc;
409410
struct timecounter tstamp_tc;
410411
struct delayed_work overflow_work;
412+
const struct mv88e6xxx_cc_coeffs *cc_coeffs;
411413

412414
struct ptp_clock *ptp_clock;
413415
struct ptp_clock_info ptp_clock_info;
@@ -731,10 +733,6 @@ struct mv88e6xxx_ptp_ops {
731733
int arr1_sts_reg;
732734
int dep_sts_reg;
733735
u32 rx_filters;
734-
u32 cc_shift;
735-
u32 cc_mult;
736-
u32 cc_mult_num;
737-
u32 cc_mult_dem;
738736
};
739737

740738
struct mv88e6xxx_pcs_ops {

drivers/net/dsa/mv88e6xxx/port.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,7 @@ int mv88e6393x_port_set_policy(struct mv88e6xxx_chip *chip, int port,
17131713
ptr = shift / 8;
17141714
shift %= 8;
17151715
mask >>= ptr * 8;
1716+
ptr <<= 8;
17161717

17171718
err = mv88e6393x_port_policy_read(chip, port, ptr, &reg);
17181719
if (err)

drivers/net/dsa/mv88e6xxx/ptp.c

Lines changed: 75 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,57 @@
1818

1919
#define MV88E6XXX_MAX_ADJ_PPB 1000000
2020

21+
struct mv88e6xxx_cc_coeffs {
22+
u32 cc_shift;
23+
u32 cc_mult;
24+
u32 cc_mult_num;
25+
u32 cc_mult_dem;
26+
};
27+
2128
/* Family MV88E6250:
2229
* Raw timestamps are in units of 10-ns clock periods.
2330
*
2431
* clkadj = scaled_ppm * 10*2^28 / (10^6 * 2^16)
2532
* simplifies to
2633
* clkadj = scaled_ppm * 2^7 / 5^5
2734
*/
28-
#define MV88E6250_CC_SHIFT 28
29-
#define MV88E6250_CC_MULT (10 << MV88E6250_CC_SHIFT)
30-
#define MV88E6250_CC_MULT_NUM (1 << 7)
31-
#define MV88E6250_CC_MULT_DEM 3125ULL
35+
#define MV88E6XXX_CC_10NS_SHIFT 28
36+
static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_10ns_coeffs = {
37+
.cc_shift = MV88E6XXX_CC_10NS_SHIFT,
38+
.cc_mult = 10 << MV88E6XXX_CC_10NS_SHIFT,
39+
.cc_mult_num = 1 << 7,
40+
.cc_mult_dem = 3125ULL,
41+
};
3242

33-
/* Other families:
43+
/* Other families except MV88E6393X in internal clock mode:
3444
* Raw timestamps are in units of 8-ns clock periods.
3545
*
3646
* clkadj = scaled_ppm * 8*2^28 / (10^6 * 2^16)
3747
* simplifies to
3848
* clkadj = scaled_ppm * 2^9 / 5^6
3949
*/
40-
#define MV88E6XXX_CC_SHIFT 28
41-
#define MV88E6XXX_CC_MULT (8 << MV88E6XXX_CC_SHIFT)
42-
#define MV88E6XXX_CC_MULT_NUM (1 << 9)
43-
#define MV88E6XXX_CC_MULT_DEM 15625ULL
50+
#define MV88E6XXX_CC_8NS_SHIFT 28
51+
static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_8ns_coeffs = {
52+
.cc_shift = MV88E6XXX_CC_8NS_SHIFT,
53+
.cc_mult = 8 << MV88E6XXX_CC_8NS_SHIFT,
54+
.cc_mult_num = 1 << 9,
55+
.cc_mult_dem = 15625ULL
56+
};
57+
58+
/* Family MV88E6393X using internal clock:
59+
* Raw timestamps are in units of 4-ns clock periods.
60+
*
61+
* clkadj = scaled_ppm * 4*2^28 / (10^6 * 2^16)
62+
* simplifies to
63+
* clkadj = scaled_ppm * 2^8 / 5^6
64+
*/
65+
#define MV88E6XXX_CC_4NS_SHIFT 28
66+
static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_4ns_coeffs = {
67+
.cc_shift = MV88E6XXX_CC_4NS_SHIFT,
68+
.cc_mult = 4 << MV88E6XXX_CC_4NS_SHIFT,
69+
.cc_mult_num = 1 << 8,
70+
.cc_mult_dem = 15625ULL
71+
};
4472

4573
#define TAI_EVENT_WORK_INTERVAL msecs_to_jiffies(100)
4674

@@ -83,6 +111,33 @@ static int mv88e6352_set_gpio_func(struct mv88e6xxx_chip *chip, int pin,
83111
return chip->info->ops->gpio_ops->set_pctl(chip, pin, func);
84112
}
85113

114+
static const struct mv88e6xxx_cc_coeffs *
115+
mv88e6xxx_cc_coeff_get(struct mv88e6xxx_chip *chip)
116+
{
117+
u16 period_ps;
118+
int err;
119+
120+
err = mv88e6xxx_tai_read(chip, MV88E6XXX_TAI_CLOCK_PERIOD, &period_ps, 1);
121+
if (err) {
122+
dev_err(chip->dev, "failed to read cycle counter period: %d\n",
123+
err);
124+
return ERR_PTR(err);
125+
}
126+
127+
switch (period_ps) {
128+
case 4000:
129+
return &mv88e6xxx_cc_4ns_coeffs;
130+
case 8000:
131+
return &mv88e6xxx_cc_8ns_coeffs;
132+
case 10000:
133+
return &mv88e6xxx_cc_10ns_coeffs;
134+
default:
135+
dev_err(chip->dev, "unexpected cycle counter period of %u ps\n",
136+
period_ps);
137+
return ERR_PTR(-ENODEV);
138+
}
139+
}
140+
86141
static u64 mv88e6352_ptp_clock_read(const struct cyclecounter *cc)
87142
{
88143
struct mv88e6xxx_chip *chip = cc_to_chip(cc);
@@ -204,7 +259,6 @@ static void mv88e6352_tai_event_work(struct work_struct *ugly)
204259
static int mv88e6xxx_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
205260
{
206261
struct mv88e6xxx_chip *chip = ptp_to_chip(ptp);
207-
const struct mv88e6xxx_ptp_ops *ptp_ops = chip->info->ops->ptp_ops;
208262
int neg_adj = 0;
209263
u32 diff, mult;
210264
u64 adj;
@@ -214,10 +268,10 @@ static int mv88e6xxx_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
214268
scaled_ppm = -scaled_ppm;
215269
}
216270

217-
mult = ptp_ops->cc_mult;
218-
adj = ptp_ops->cc_mult_num;
271+
mult = chip->cc_coeffs->cc_mult;
272+
adj = chip->cc_coeffs->cc_mult_num;
219273
adj *= scaled_ppm;
220-
diff = div_u64(adj, ptp_ops->cc_mult_dem);
274+
diff = div_u64(adj, chip->cc_coeffs->cc_mult_dem);
221275

222276
mv88e6xxx_reg_lock(chip);
223277

@@ -364,10 +418,6 @@ const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops = {
364418
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
365419
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
366420
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
367-
.cc_shift = MV88E6XXX_CC_SHIFT,
368-
.cc_mult = MV88E6XXX_CC_MULT,
369-
.cc_mult_num = MV88E6XXX_CC_MULT_NUM,
370-
.cc_mult_dem = MV88E6XXX_CC_MULT_DEM,
371421
};
372422

373423
const struct mv88e6xxx_ptp_ops mv88e6250_ptp_ops = {
@@ -391,10 +441,6 @@ const struct mv88e6xxx_ptp_ops mv88e6250_ptp_ops = {
391441
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
392442
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
393443
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
394-
.cc_shift = MV88E6250_CC_SHIFT,
395-
.cc_mult = MV88E6250_CC_MULT,
396-
.cc_mult_num = MV88E6250_CC_MULT_NUM,
397-
.cc_mult_dem = MV88E6250_CC_MULT_DEM,
398444
};
399445

400446
const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = {
@@ -418,10 +464,6 @@ const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = {
418464
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
419465
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
420466
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
421-
.cc_shift = MV88E6XXX_CC_SHIFT,
422-
.cc_mult = MV88E6XXX_CC_MULT,
423-
.cc_mult_num = MV88E6XXX_CC_MULT_NUM,
424-
.cc_mult_dem = MV88E6XXX_CC_MULT_DEM,
425467
};
426468

427469
const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops = {
@@ -446,10 +488,6 @@ const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops = {
446488
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
447489
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
448490
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
449-
.cc_shift = MV88E6XXX_CC_SHIFT,
450-
.cc_mult = MV88E6XXX_CC_MULT,
451-
.cc_mult_num = MV88E6XXX_CC_MULT_NUM,
452-
.cc_mult_dem = MV88E6XXX_CC_MULT_DEM,
453491
};
454492

455493
static u64 mv88e6xxx_ptp_clock_read(const struct cyclecounter *cc)
@@ -462,10 +500,10 @@ static u64 mv88e6xxx_ptp_clock_read(const struct cyclecounter *cc)
462500
return 0;
463501
}
464502

465-
/* With a 125MHz input clock, the 32-bit timestamp counter overflows in ~34.3
503+
/* With a 250MHz input clock, the 32-bit timestamp counter overflows in ~17.2
466504
* seconds; this task forces periodic reads so that we don't miss any.
467505
*/
468-
#define MV88E6XXX_TAI_OVERFLOW_PERIOD (HZ * 16)
506+
#define MV88E6XXX_TAI_OVERFLOW_PERIOD (HZ * 8)
469507
static void mv88e6xxx_ptp_overflow_check(struct work_struct *work)
470508
{
471509
struct delayed_work *dw = to_delayed_work(work);
@@ -484,11 +522,15 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip)
484522
int i;
485523

486524
/* Set up the cycle counter */
525+
chip->cc_coeffs = mv88e6xxx_cc_coeff_get(chip);
526+
if (IS_ERR(chip->cc_coeffs))
527+
return PTR_ERR(chip->cc_coeffs);
528+
487529
memset(&chip->tstamp_cc, 0, sizeof(chip->tstamp_cc));
488530
chip->tstamp_cc.read = mv88e6xxx_ptp_clock_read;
489531
chip->tstamp_cc.mask = CYCLECOUNTER_MASK(32);
490-
chip->tstamp_cc.mult = ptp_ops->cc_mult;
491-
chip->tstamp_cc.shift = ptp_ops->cc_shift;
532+
chip->tstamp_cc.mult = chip->cc_coeffs->cc_mult;
533+
chip->tstamp_cc.shift = chip->cc_coeffs->cc_shift;
492534

493535
timecounter_init(&chip->tstamp_tc, &chip->tstamp_cc,
494536
ktime_to_ns(ktime_get_real()));

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,10 +2254,11 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
22542254

22552255
if (!bnxt_get_rx_ts_p5(bp, &ts, cmpl_ts)) {
22562256
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
2257+
unsigned long flags;
22572258

2258-
spin_lock_bh(&ptp->ptp_lock);
2259+
spin_lock_irqsave(&ptp->ptp_lock, flags);
22592260
ns = timecounter_cyc2time(&ptp->tc, ts);
2260-
spin_unlock_bh(&ptp->ptp_lock);
2261+
spin_unlock_irqrestore(&ptp->ptp_lock, flags);
22612262
memset(skb_hwtstamps(skb), 0,
22622263
sizeof(*skb_hwtstamps(skb)));
22632264
skb_hwtstamps(skb)->hwtstamp = ns_to_ktime(ns);
@@ -2757,17 +2758,18 @@ static int bnxt_async_event_process(struct bnxt *bp,
27572758
case ASYNC_EVENT_CMPL_PHC_UPDATE_EVENT_DATA1_FLAGS_PHC_RTC_UPDATE:
27582759
if (BNXT_PTP_USE_RTC(bp)) {
27592760
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
2761+
unsigned long flags;
27602762
u64 ns;
27612763

27622764
if (!ptp)
27632765
goto async_event_process_exit;
27642766

2765-
spin_lock_bh(&ptp->ptp_lock);
2767+
spin_lock_irqsave(&ptp->ptp_lock, flags);
27662768
bnxt_ptp_update_current_time(bp);
27672769
ns = (((u64)BNXT_EVENT_PHC_RTC_UPDATE(data1) <<
27682770
BNXT_PHC_BITS) | ptp->current_time);
27692771
bnxt_ptp_rtc_timecounter_init(ptp, ns);
2770-
spin_unlock_bh(&ptp->ptp_lock);
2772+
spin_unlock_irqrestore(&ptp->ptp_lock, flags);
27712773
}
27722774
break;
27732775
}
@@ -13494,9 +13496,11 @@ static void bnxt_force_fw_reset(struct bnxt *bp)
1349413496
return;
1349513497

1349613498
if (ptp) {
13497-
spin_lock_bh(&ptp->ptp_lock);
13499+
unsigned long flags;
13500+
13501+
spin_lock_irqsave(&ptp->ptp_lock, flags);
1349813502
set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
13499-
spin_unlock_bh(&ptp->ptp_lock);
13503+
spin_unlock_irqrestore(&ptp->ptp_lock, flags);
1350013504
} else {
1350113505
set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1350213506
}
@@ -13561,9 +13565,11 @@ void bnxt_fw_reset(struct bnxt *bp)
1356113565
int n = 0, tmo;
1356213566

1356313567
if (ptp) {
13564-
spin_lock_bh(&ptp->ptp_lock);
13568+
unsigned long flags;
13569+
13570+
spin_lock_irqsave(&ptp->ptp_lock, flags);
1356513571
set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
13566-
spin_unlock_bh(&ptp->ptp_lock);
13572+
spin_unlock_irqrestore(&ptp->ptp_lock, flags);
1356713573
} else {
1356813574
set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1356913575
}

0 commit comments

Comments
 (0)