* [PATCH net-next v5 2/3] gve: make nic clock reads thread safe
From: Harshitha Ramamurthy @ 2026-04-29 1:28 UTC (permalink / raw)
To: netdev
Cc: joshwash, hramamurthy, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran, jstultz, tglx, sboyd, willemb, nktgrg,
jfraker, ziweixiao, maolson, jordanrhee, thostet, alok.a.tiwari,
pkaligineedi, horms, dwmw2, jacob.e.keller, yyd, linux-kernel
In-Reply-To: <20260429012819.3102675-1-hramamurthy@google.com>
From: Ankit Garg <nktgrg@google.com>
Add a mutex to protect the shared DMA buffer that receives NIC
timestamp reports. The NIC timestamp will be read from two different
threads: the periodic worker and upcoming `gettimex64`.
Move clock registration to the last step of initialization to ensure
that all data needed by the clock module is initialized before
the clock is exposed to usermode.
Reviewed-by: Joshua Washington <joshwash@google.com>
Signed-off-by: Ankit Garg <nktgrg@google.com>
Signed-off-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
---
Changes in v3:
- Reorder init/teardown to register PTP clock last, and simplify code
- Move ptp-related members from gve_priv to gve_ptp
- Only assign priv->ptp after ptp module is successfully initialized
---
drivers/net/ethernet/google/gve/gve.h | 12 +-
drivers/net/ethernet/google/gve/gve_ethtool.c | 3 +-
drivers/net/ethernet/google/gve/gve_ptp.c | 134 ++++++++----------
3 files changed, 63 insertions(+), 86 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h
index 1d66d3834f7e..7b69d0cfc0d5 100644
--- a/drivers/net/ethernet/google/gve/gve.h
+++ b/drivers/net/ethernet/google/gve/gve.h
@@ -792,6 +792,9 @@ struct gve_ptp {
struct ptp_clock_info info;
struct ptp_clock *clock;
struct gve_priv *priv;
+ struct mutex nic_ts_read_lock; /* Protects nic_ts_report */
+ struct gve_nic_ts_report *nic_ts_report;
+ dma_addr_t nic_ts_report_bus;
};
struct gve_priv {
@@ -923,8 +926,6 @@ struct gve_priv {
bool nic_timestamp_supported;
struct gve_ptp *ptp;
struct kernel_hwtstamp_config ts_config;
- struct gve_nic_ts_report *nic_ts_report;
- dma_addr_t nic_ts_report_bus;
u64 last_sync_nic_counter; /* Clock counter from last NIC TS report */
};
@@ -1201,7 +1202,7 @@ static inline bool gve_supports_xdp_xmit(struct gve_priv *priv)
static inline bool gve_is_clock_enabled(struct gve_priv *priv)
{
- return priv->nic_ts_report;
+ return priv->ptp;
}
/* gqi napi handler defined in gve_main.c */
@@ -1321,14 +1322,9 @@ int gve_flow_rules_reset(struct gve_priv *priv);
int gve_init_rss_config(struct gve_priv *priv, u16 num_queues);
/* PTP and timestamping */
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
-int gve_clock_nic_ts_read(struct gve_priv *priv);
int gve_init_clock(struct gve_priv *priv);
void gve_teardown_clock(struct gve_priv *priv);
#else /* CONFIG_PTP_1588_CLOCK */
-static inline int gve_clock_nic_ts_read(struct gve_priv *priv)
-{
- return -EOPNOTSUPP;
-}
static inline int gve_init_clock(struct gve_priv *priv)
{
diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
index dc2213b5ce24..4fd7e8a442c5 100644
--- a/drivers/net/ethernet/google/gve/gve_ethtool.c
+++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
@@ -972,8 +972,7 @@ static int gve_get_ts_info(struct net_device *netdev,
info->rx_filters |= BIT(HWTSTAMP_FILTER_NONE) |
BIT(HWTSTAMP_FILTER_ALL);
- if (priv->ptp)
- info->phc_index = ptp_clock_index(priv->ptp->clock);
+ info->phc_index = ptp_clock_index(priv->ptp->clock);
}
return 0;
diff --git a/drivers/net/ethernet/google/gve/gve_ptp.c b/drivers/net/ethernet/google/gve/gve_ptp.c
index 06b1cf4a5efc..ad15f1209a83 100644
--- a/drivers/net/ethernet/google/gve/gve_ptp.c
+++ b/drivers/net/ethernet/google/gve/gve_ptp.c
@@ -11,19 +11,20 @@
#define GVE_NIC_TS_SYNC_INTERVAL_MS 250
/* Read the nic timestamp from hardware via the admin queue. */
-int gve_clock_nic_ts_read(struct gve_priv *priv)
+static int gve_clock_nic_ts_read(struct gve_ptp *ptp, u64 *nic_raw)
{
- u64 nic_raw;
int err;
- err = gve_adminq_report_nic_ts(priv, priv->nic_ts_report_bus);
+ mutex_lock(&ptp->nic_ts_read_lock);
+ err = gve_adminq_report_nic_ts(ptp->priv, ptp->nic_ts_report_bus);
if (err)
- return err;
+ goto out;
- nic_raw = be64_to_cpu(priv->nic_ts_report->nic_timestamp);
- WRITE_ONCE(priv->last_sync_nic_counter, nic_raw);
+ *nic_raw = be64_to_cpu(ptp->nic_ts_report->nic_timestamp);
- return 0;
+out:
+ mutex_unlock(&ptp->nic_ts_read_lock);
+ return err;
}
static int gve_ptp_gettimex64(struct ptp_clock_info *info,
@@ -41,17 +42,21 @@ static int gve_ptp_settime64(struct ptp_clock_info *info,
static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
{
- const struct gve_ptp *ptp = container_of(info, struct gve_ptp, info);
+ struct gve_ptp *ptp = container_of(info, struct gve_ptp, info);
struct gve_priv *priv = ptp->priv;
+ u64 nic_raw;
int err;
if (gve_get_reset_in_progress(priv) || !gve_get_admin_queue_ok(priv))
goto out;
- err = gve_clock_nic_ts_read(priv);
- if (err && net_ratelimit())
- dev_err(&priv->pdev->dev,
- "%s read err %d\n", __func__, err);
+ err = gve_clock_nic_ts_read(ptp, &nic_raw);
+ if (err) {
+ dev_err_ratelimited(&priv->pdev->dev, "%s read err %d\n",
+ __func__, err);
+ goto out;
+ }
+ WRITE_ONCE(priv->last_sync_nic_counter, nic_raw);
out:
return msecs_to_jiffies(GVE_NIC_TS_SYNC_INTERVAL_MS);
@@ -65,94 +70,71 @@ static const struct ptp_clock_info gve_ptp_caps = {
.do_aux_work = gve_ptp_do_aux_work,
};
-static int gve_ptp_init(struct gve_priv *priv)
+int gve_init_clock(struct gve_priv *priv)
{
struct gve_ptp *ptp;
+ u64 nic_raw;
int err;
- priv->ptp = kzalloc_obj(*priv->ptp);
- if (!priv->ptp)
+ ptp = kzalloc_obj(*priv->ptp);
+ if (!ptp)
return -ENOMEM;
- ptp = priv->ptp;
ptp->info = gve_ptp_caps;
- ptp->clock = ptp_clock_register(&ptp->info, &priv->pdev->dev);
-
- if (IS_ERR(ptp->clock)) {
- dev_err(&priv->pdev->dev, "PTP clock registration failed\n");
- err = PTR_ERR(ptp->clock);
- goto free_ptp;
- }
-
ptp->priv = priv;
- return 0;
-
-free_ptp:
- kfree(ptp);
- priv->ptp = NULL;
- return err;
-}
-
-static void gve_ptp_release(struct gve_priv *priv)
-{
- struct gve_ptp *ptp = priv->ptp;
-
- if (!ptp)
- return;
-
- if (ptp->clock)
- ptp_clock_unregister(ptp->clock);
-
- kfree(ptp);
- priv->ptp = NULL;
-}
-
-int gve_init_clock(struct gve_priv *priv)
-{
- int err;
-
- err = gve_ptp_init(priv);
- if (err)
- return err;
-
- priv->nic_ts_report =
+ mutex_init(&ptp->nic_ts_read_lock);
+ ptp->nic_ts_report =
dma_alloc_coherent(&priv->pdev->dev,
sizeof(struct gve_nic_ts_report),
- &priv->nic_ts_report_bus,
- GFP_KERNEL);
- if (!priv->nic_ts_report) {
+ &ptp->nic_ts_report_bus, GFP_KERNEL);
+ if (!ptp->nic_ts_report) {
dev_err(&priv->pdev->dev, "%s dma alloc error\n", __func__);
err = -ENOMEM;
- goto release_ptp;
+ goto free_ptp;
}
- err = gve_clock_nic_ts_read(priv);
+
+ err = gve_clock_nic_ts_read(ptp, &nic_raw);
if (err) {
dev_err(&priv->pdev->dev, "failed to read NIC clock %d\n", err);
- goto release_nic_ts_report;
+ goto free_dma_mem;
}
- ptp_schedule_worker(priv->ptp->clock,
+ WRITE_ONCE(priv->last_sync_nic_counter, nic_raw);
+
+ ptp->clock = ptp_clock_register(&ptp->info, &priv->pdev->dev);
+ if (IS_ERR(ptp->clock)) {
+ dev_err(&priv->pdev->dev, "PTP clock registration failed\n");
+ err = PTR_ERR(ptp->clock);
+ goto free_dma_mem;
+ }
+
+ priv->ptp = ptp;
+ ptp_schedule_worker(ptp->clock,
msecs_to_jiffies(GVE_NIC_TS_SYNC_INTERVAL_MS));
return 0;
-release_nic_ts_report:
- dma_free_coherent(&priv->pdev->dev,
- sizeof(struct gve_nic_ts_report),
- priv->nic_ts_report, priv->nic_ts_report_bus);
- priv->nic_ts_report = NULL;
-release_ptp:
- gve_ptp_release(priv);
+free_dma_mem:
+ dma_free_coherent(&priv->pdev->dev, sizeof(struct gve_nic_ts_report),
+ ptp->nic_ts_report, ptp->nic_ts_report_bus);
+ ptp->nic_ts_report = NULL;
+free_ptp:
+ mutex_destroy(&ptp->nic_ts_read_lock);
+ kfree(ptp);
return err;
}
void gve_teardown_clock(struct gve_priv *priv)
{
- gve_ptp_release(priv);
+ struct gve_ptp *ptp = priv->ptp;
- if (priv->nic_ts_report) {
- dma_free_coherent(&priv->pdev->dev,
- sizeof(struct gve_nic_ts_report),
- priv->nic_ts_report, priv->nic_ts_report_bus);
- priv->nic_ts_report = NULL;
- }
+ if (!ptp)
+ return;
+
+ priv->ptp = NULL;
+ ptp_clock_unregister(ptp->clock);
+ dma_free_coherent(&priv->pdev->dev, sizeof(struct gve_nic_ts_report),
+ ptp->nic_ts_report, ptp->nic_ts_report_bus);
+ ptp->nic_ts_report = NULL;
+ mutex_destroy(&ptp->nic_ts_read_lock);
+ kfree(ptp);
}
--
2.54.0.545.g6539524ca2-goog
^ permalink raw reply related
* [PATCH net-next v5 3/3] gve: implement PTP gettimex64
From: Harshitha Ramamurthy @ 2026-04-29 1:28 UTC (permalink / raw)
To: netdev
Cc: joshwash, hramamurthy, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran, jstultz, tglx, sboyd, willemb, nktgrg,
jfraker, ziweixiao, maolson, jordanrhee, thostet, alok.a.tiwari,
pkaligineedi, horms, dwmw2, jacob.e.keller, yyd, linux-kernel,
Naman Gulati
In-Reply-To: <20260429012819.3102675-1-hramamurthy@google.com>
From: Jordan Rhee <jordanrhee@google.com>
Enable chrony and phc2sys to synchronize system clock to NIC clock.
The system cycle counters are sampled by the device to minimize the
uncertainty window. If the system times are sampled in the host, the
delta between pre and post readings is 100us or more due to AQ command
latency. The system times returned by the device have a delta of ~1us,
which enables significantly more accurate clock synchronization.
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Kevin Yang <yyd@google.com>
Reviewed-by: Naman Gulati <namangulati@google.com>
Signed-off-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
---
Changes in v5:
- Reformulate retry loop in terms of total timeout (Jakub Kicinski)
Changes in v3:
- Take system time snapshot inside the mutex
- Return -EOPNOTSUPP if cross-timestamp is requested on an arch other
than x86 or arm64
Changes in v2:
- fix compilation warning on ARM by casting cycles_t to u64
---
drivers/net/ethernet/google/gve/gve_adminq.h | 4 +-
drivers/net/ethernet/google/gve/gve_ptp.c | 196 ++++++++++++++++++-
2 files changed, 191 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.h b/drivers/net/ethernet/google/gve/gve_adminq.h
index 22a74b6aa17e..e6dcf6da9091 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.h
+++ b/drivers/net/ethernet/google/gve/gve_adminq.h
@@ -411,8 +411,8 @@ static_assert(sizeof(struct gve_adminq_report_nic_ts) == 16);
struct gve_nic_ts_report {
__be64 nic_timestamp; /* NIC clock in nanoseconds */
- __be64 reserved1;
- __be64 reserved2;
+ __be64 pre_cycles; /* System cycle counter before NIC clock read */
+ __be64 post_cycles; /* System cycle counter after NIC clock read */
__be64 reserved3;
__be64 reserved4;
};
diff --git a/drivers/net/ethernet/google/gve/gve_ptp.c b/drivers/net/ethernet/google/gve/gve_ptp.c
index ad15f1209a83..c6c98ef825aa 100644
--- a/drivers/net/ethernet/google/gve/gve_ptp.c
+++ b/drivers/net/ethernet/google/gve/gve_ptp.c
@@ -10,28 +10,210 @@
/* Interval to schedule a nic timestamp calibration, 250ms. */
#define GVE_NIC_TS_SYNC_INTERVAL_MS 250
+/*
+ * Stores cycle counter samples in get_cycles() units from a
+ * sandwiched NIC clock read
+ */
+struct gve_sysclock_sample {
+ /* system time snapshot taken just before issuing AdminQ command */
+ struct system_time_snapshot snapshot;
+ /* Cycle counter from NIC before clock read */
+ u64 nic_pre_cycles;
+ /* Cycle counter from NIC after clock read */
+ u64 nic_post_cycles;
+ /* Cycle counter from host before issuing AQ command */
+ cycles_t host_pre_cycles;
+ /* Cycle counter from host after AQ command returns */
+ cycles_t host_post_cycles;
+};
+
+/*
+ * Read NIC clock by issuing the AQ command. The command is subject to
+ * rate limiting and may need to be retried. Requires nic_ts_read_lock
+ * to be held.
+ */
+static int gve_ptp_read_timestamp(struct gve_ptp *ptp, cycles_t *pre_cycles,
+ cycles_t *post_cycles,
+ struct system_time_snapshot *snap)
+{
+ unsigned long deadline = jiffies + msecs_to_jiffies(100);
+ unsigned long delay_us = 1000;
+ int err;
+
+ lockdep_assert_held(&ptp->nic_ts_read_lock);
+
+ do {
+ if (snap)
+ ktime_get_snapshot(snap);
+
+ *pre_cycles = get_cycles();
+ err = gve_adminq_report_nic_ts(ptp->priv,
+ ptp->nic_ts_report_bus);
+
+ /* Prevent get_cycles() from being speculatively executed
+ * before the AdminQ command
+ */
+ rmb();
+ *post_cycles = get_cycles();
+ if (likely(err != -EAGAIN))
+ return err;
+
+ fsleep(delay_us);
+
+ /* Exponential backoff */
+ delay_us *= 2;
+ } while (time_before(jiffies, deadline));
+
+ return -ETIMEDOUT;
+}
+
/* Read the nic timestamp from hardware via the admin queue. */
-static int gve_clock_nic_ts_read(struct gve_ptp *ptp, u64 *nic_raw)
+static int gve_clock_nic_ts_read(struct gve_ptp *ptp, u64 *nic_raw,
+ struct gve_sysclock_sample *sysclock)
{
+ cycles_t host_pre_cycles, host_post_cycles;
+ struct gve_nic_ts_report *ts_report;
int err;
mutex_lock(&ptp->nic_ts_read_lock);
- err = gve_adminq_report_nic_ts(ptp->priv, ptp->nic_ts_report_bus);
- if (err)
+ err = gve_ptp_read_timestamp(ptp, &host_pre_cycles, &host_post_cycles,
+ sysclock ? &sysclock->snapshot : NULL);
+ if (err) {
+ dev_err_ratelimited(&ptp->priv->pdev->dev,
+ "AdminQ timestamp read failed: %d\n", err);
goto out;
+ }
- *nic_raw = be64_to_cpu(ptp->nic_ts_report->nic_timestamp);
+ ts_report = ptp->nic_ts_report;
+ *nic_raw = be64_to_cpu(ts_report->nic_timestamp);
+
+ if (sysclock) {
+ sysclock->nic_pre_cycles = be64_to_cpu(ts_report->pre_cycles);
+ sysclock->nic_post_cycles = be64_to_cpu(ts_report->post_cycles);
+ sysclock->host_pre_cycles = host_pre_cycles;
+ sysclock->host_post_cycles = host_post_cycles;
+ }
out:
mutex_unlock(&ptp->nic_ts_read_lock);
return err;
}
+struct gve_cycles_to_clock_callback_ctx {
+ u64 cycles;
+};
+
+static int gve_cycles_to_clock_fn(ktime_t *device_time,
+ struct system_counterval_t *system_counterval,
+ void *ctx)
+{
+ struct gve_cycles_to_clock_callback_ctx *context = ctx;
+
+ *device_time = 0;
+
+ system_counterval->cycles = context->cycles;
+ system_counterval->use_nsecs = false;
+
+ if (IS_ENABLED(CONFIG_X86))
+ system_counterval->cs_id = CSID_X86_TSC;
+ else if (IS_ENABLED(CONFIG_ARM64))
+ system_counterval->cs_id = CSID_ARM_ARCH_COUNTER;
+ else
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+/*
+ * Convert a raw cycle count (e.g. from get_cycles()) to the system clock
+ * type specified by clockid. The system_time_snapshot must be taken before
+ * the cycle counter is sampled.
+ */
+static int gve_cycles_to_timespec64(struct gve_priv *priv, clockid_t clockid,
+ struct system_time_snapshot *snap,
+ u64 cycles, struct timespec64 *ts)
+{
+ struct gve_cycles_to_clock_callback_ctx ctx = {0};
+ struct system_device_crosststamp xtstamp;
+ int err;
+
+ ctx.cycles = cycles;
+ err = get_device_system_crosststamp(gve_cycles_to_clock_fn, &ctx, snap,
+ &xtstamp);
+ if (err) {
+ dev_err_ratelimited(&priv->pdev->dev,
+ "get_device_system_crosststamp() failed to convert %lld cycles to system time: %d\n",
+ cycles,
+ err);
+ return err;
+ }
+
+ switch (clockid) {
+ case CLOCK_REALTIME:
+ *ts = ktime_to_timespec64(xtstamp.sys_realtime);
+ break;
+ case CLOCK_MONOTONIC_RAW:
+ *ts = ktime_to_timespec64(xtstamp.sys_monoraw);
+ break;
+ default:
+ dev_err_ratelimited(&priv->pdev->dev,
+ "Cycle count conversion to clockid %d not supported\n",
+ clockid);
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
+
static int gve_ptp_gettimex64(struct ptp_clock_info *info,
struct timespec64 *ts,
struct ptp_system_timestamp *sts)
{
- return -EOPNOTSUPP;
+ struct gve_ptp *ptp = container_of(info, struct gve_ptp, info);
+ struct gve_sysclock_sample sysclock = {0};
+ struct gve_priv *priv = ptp->priv;
+ u64 nic_ts;
+ int err;
+
+ if (sts && !(IS_ENABLED(CONFIG_X86) || IS_ENABLED(CONFIG_ARM64)))
+ return -EOPNOTSUPP;
+
+ err = gve_clock_nic_ts_read(ptp, &nic_ts, sts ? &sysclock : NULL);
+ if (err)
+ return err;
+
+ if (sts) {
+ /* Reject samples with out of order system clock values */
+ if (!(sysclock.host_pre_cycles <= sysclock.nic_pre_cycles &&
+ sysclock.nic_pre_cycles <= sysclock.nic_post_cycles &&
+ sysclock.nic_post_cycles <= sysclock.host_post_cycles)) {
+ dev_err_ratelimited(&priv->pdev->dev,
+ "AdminQ system clock cycle counts out of order. Expecting %llu <= %llu <= %llu <= %llu\n",
+ (u64)sysclock.host_pre_cycles,
+ sysclock.nic_pre_cycles,
+ sysclock.nic_post_cycles,
+ (u64)sysclock.host_post_cycles);
+ return -EBADMSG;
+ }
+
+ err = gve_cycles_to_timespec64(priv, sts->clockid,
+ &sysclock.snapshot,
+ sysclock.nic_pre_cycles,
+ &sts->pre_ts);
+ if (err)
+ return err;
+
+ err = gve_cycles_to_timespec64(priv, sts->clockid,
+ &sysclock.snapshot,
+ sysclock.nic_post_cycles,
+ &sts->post_ts);
+ if (err)
+ return err;
+ }
+
+ *ts = ns_to_timespec64(nic_ts);
+
+ return 0;
}
static int gve_ptp_settime64(struct ptp_clock_info *info,
@@ -50,7 +232,7 @@ static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
if (gve_get_reset_in_progress(priv) || !gve_get_admin_queue_ok(priv))
goto out;
- err = gve_clock_nic_ts_read(ptp, &nic_raw);
+ err = gve_clock_nic_ts_read(ptp, &nic_raw, NULL);
if (err) {
dev_err_ratelimited(&priv->pdev->dev, "%s read err %d\n",
__func__, err);
@@ -93,7 +275,7 @@ int gve_init_clock(struct gve_priv *priv)
goto free_ptp;
}
- err = gve_clock_nic_ts_read(ptp, &nic_raw);
+ err = gve_clock_nic_ts_read(ptp, &nic_raw, NULL);
if (err) {
dev_err(&priv->pdev->dev, "failed to read NIC clock %d\n", err);
goto free_dma_mem;
--
2.54.0.545.g6539524ca2-goog
^ permalink raw reply related
* Re: [PATCH net-next v7 1/4] dt-bindings: ethernet: eswin: add clock sampling control
From: Andrew Lunn @ 2026-04-29 1:28 UTC (permalink / raw)
To: lizhi2
Cc: devicetree, andrew+netdev, davem, edumazet, kuba, robh, krzk+dt,
conor+dt, netdev, pabeni, mcoquelin.stm32, alexandre.torgue,
rmk+kernel, pjw, palmer, aou, alex, linux-riscv, linux-stm32,
linux-arm-kernel, linux-kernel, maxime.chevallier, ningyu, linmin,
pinkesh.vaghela, pritesh.patel, weishangjuan, horms, Conor Dooley
In-Reply-To: <20260427072439.1134-1-lizhi2@eswincomputing.com>
> For the TX path of eth1, there is also a skew between the TX clock
> and data on the MAC controller inside the silicon. This skew happens
> to be approximately 2 ns. Therefore, it can be considered that the
> 2 ns delay of TX is provided by the MAC, so the TX is compliant with
> the RGMII standard.
> tx-internal-delay-ps:
> - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400]
> + minimum: 0
> + maximum: 2540
> + multipleOf: 20
This does not seem correct for eth1. Isn't minimum 2000, maximum 4540?
You have this fixed 2ns you cannot turn off.
Andrew
^ permalink raw reply
* Re: [PATCH net] net: psp: require admin permission for dev-set and key-rotate
From: patchwork-bot+netdevbpf @ 2026-04-29 1:30 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
daniel.zahka, willemdebruijn.kernel, donald.hunter
In-Reply-To: <20260427195856.401223-1-kuba@kernel.org>
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Apr 2026 12:58:56 -0700 you wrote:
> The dev-set and key-rotate netlink operations modify shared device
> state (PSP version configuration and cryptographic key material,
> respectively) but do not require CAP_NET_ADMIN. The only access
> control is psp_dev_check_access() which merely verifies netns
> membership.
>
> Fixes: 00c94ca2b99e ("psp: base PSP device support")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>
> [...]
Here is the summary with links:
- [net] net: psp: require admin permission for dev-set and key-rotate
https://git.kernel.org/netdev/net/c/b718342a7fba
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net] bareudp: fix NULL pointer dereference in bareudp_fill_metadata_dst()
From: patchwork-bot+netdevbpf @ 2026-04-29 1:30 UTC (permalink / raw)
To: Weiming Shi
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, willemb,
martin.varghese, netdev, xmei5
In-Reply-To: <20260426165350.1663137-2-bestswngs@gmail.com>
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 26 Apr 2026 09:53:51 -0700 you wrote:
> bareudp_fill_metadata_dst() passes bareudp->sock to
> udp_tunnel6_dst_lookup() in the IPv6 path without a NULL check.
> The socket is only created in bareudp_open() and NULLed in
> bareudp_stop(), so calling this function while the device is down
> triggers a NULL dereference via sock->sk.
>
> BUG: kernel NULL pointer dereference, address: 0000000000000018
> RIP: 0010:udp_tunnel6_dst_lookup (net/ipv6/ip6_udp_tunnel.c:160)
> Call Trace:
> <TASK>
> bareudp_fill_metadata_dst (drivers/net/bareudp.c:532)
> do_execute_actions (net/openvswitch/actions.c:901)
> ovs_execute_actions (net/openvswitch/actions.c:1589)
> ovs_packet_cmd_execute (net/openvswitch/datapath.c:700)
> genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114)
> genl_rcv_msg (net/netlink/genetlink.c:1209)
> netlink_rcv_skb (net/netlink/af_netlink.c:2550)
> </TASK>
>
> [...]
Here is the summary with links:
- [net] bareudp: fix NULL pointer dereference in bareudp_fill_metadata_dst()
https://git.kernel.org/netdev/net/c/aa6c6d9ee064
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net 1/8] netfilter: arp_tables: fix IEEE1394 ARP payload parsing
From: patchwork-bot+netdevbpf @ 2026-04-29 1:30 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: netfilter-devel, davem, netdev, kuba, pabeni, edumazet, fw, horms
In-Reply-To: <20260428095840.51961-2-pablo@netfilter.org>
Hello:
This series was applied to netdev/net.git (main)
by Pablo Neira Ayuso <pablo@netfilter.org>:
On Tue, 28 Apr 2026 11:58:32 +0200 you wrote:
> Weiming Shi says:
>
> "arp_packet_match() unconditionally parses the ARP payload assuming two
> hardware addresses are present (source and target). However,
> IPv4-over-IEEE1394 ARP (RFC 2734) omits the target hardware address
> field, and arp_hdr_len() already accounts for this by returning a
> shorter length for ARPHRD_IEEE1394 devices.
>
> [...]
Here is the summary with links:
- [net,1/8] netfilter: arp_tables: fix IEEE1394 ARP payload parsing
https://git.kernel.org/netdev/net/c/1e8e3f449b1e
- [net,2/8] netfilter: nf_tables: use list_del_rcu for netlink hooks
https://git.kernel.org/netdev/net/c/f3224ee463f8
- [net,3/8] rculist: add list_splice_rcu() for private lists
https://git.kernel.org/netdev/net/c/f902877b6355
- [net,4/8] netfilter: nf_tables: join hook list via splice_list_rcu() in commit phase
https://git.kernel.org/netdev/net/c/a6134e62dba2
- [net,5/8] netfilter: nf_tables: add hook transactions for device deletions
https://git.kernel.org/netdev/net/c/10f79dbd7719
- [net,6/8] netfilter: xt_policy: fix strict mode inbound policy matching
https://git.kernel.org/netdev/net/c/4b2b4d7d4e20
- [net,7/8] netfilter: reject zero shift in nft_bitwise
https://git.kernel.org/netdev/net/c/fe11e5c40817
- [net,8/8] netfilter: nf_conntrack_sip: don't use simple_strtoul
https://git.kernel.org/netdev/net/c/8cf6809cddcb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net v2 0/2] sctp: fix a vtag verification failure caused by stale INITs
From: patchwork-bot+netdevbpf @ 2026-04-29 1:30 UTC (permalink / raw)
To: Xin Long
Cc: netdev, netfilter-devel, linux-sctp, davem, kuba, edumazet,
pabeni, horms, pablo, fw, phil, marcelo.leitner, yiche.cy
In-Reply-To: <cover.1777214801.git.lucien.xin@gmail.com>
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 26 Apr 2026 10:46:39 -0400 you wrote:
> Similar to Scenario B in commit 8e56b063c865 ( netfilter: handle the
> connecting collision properly in nf_conntrack_proto_sctp"):
>
> Scenario B: INIT_ACK is delayed until the peer completes its own handshake
>
> 192.168.1.2 > 192.168.1.1: sctp (1) [INIT] [init tag: 3922216408]
> 192.168.1.1 > 192.168.1.2: sctp (1) [INIT] [init tag: 144230885]
> 192.168.1.2 > 192.168.1.1: sctp (1) [INIT ACK] [init tag: 3922216408]
> 192.168.1.1 > 192.168.1.2: sctp (1) [COOKIE ECHO]
> 192.168.1.2 > 192.168.1.1: sctp (1) [COOKIE ACK]
> 192.168.1.1 > 192.168.1.2: sctp (1) [INIT ACK] [init tag: 3914796021] *
>
> [...]
Here is the summary with links:
- [net,v2,1/2] netfilter: skip recording stale or retransmitted INIT
https://git.kernel.org/netdev/net/c/576a5d2bad48
- [net,v2,2/2] sctp: discard stale INIT after handshake completion
https://git.kernel.org/netdev/net/c/8a92cb475ca9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net v2] net: psp: check for device unregister when creating assoc
From: patchwork-bot+netdevbpf @ 2026-04-29 1:30 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
yimingqian591, willemb, daniel.zahka, willemdebruijn.kernel
In-Reply-To: <20260427190606.366101-1-kuba@kernel.org>
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Apr 2026 12:06:06 -0700 you wrote:
> psp_assoc_device_get_locked() obtains a psp_dev reference via
> psp_dev_get_for_sock() (which uses psp_dev_tryget() under RCU);
> it then acquires psd->lock and drops the reference. Before
> the lock is taken, psp_dev_unregister() can run to completion:
> take psd->lock, clear out state, unlock, drop the registration
> reference.
>
> [...]
Here is the summary with links:
- [net,v2] net: psp: check for device unregister when creating assoc
https://git.kernel.org/netdev/net/c/b89769f936a8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net-next] net: dummy: do not acquire RTNL for too long
From: patchwork-bot+netdevbpf @ 2026-04-29 1:30 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, kuba, pabeni, horms, netdev, eric.dumazet
In-Reply-To: <20260427091016.737015-1-edumazet@google.com>
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Apr 2026 09:10:16 +0000 you wrote:
> Instead of holding RTNL for an arbitrary amount of time,
> call register_netdev() for each dummy device created
> at module loading time.
>
> Tested:
>
> modprobe dummy numdummies=10000
>
> [...]
Here is the summary with links:
- [net-next] net: dummy: do not acquire RTNL for too long
https://git.kernel.org/netdev/net-next/c/bed510e44095
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH v2 net 0/5] net/sched: sch_cake: annotate data-races in cake_dump_stats() (series)
From: patchwork-bot+netdevbpf @ 2026-04-29 1:40 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, horms, jhs, jiri, toke, netdev, eric.dumazet
In-Reply-To: <20260427083606.459355-1-edumazet@google.com>
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Apr 2026 08:36:01 +0000 you wrote:
> cake_dump_stats() runs without qdisc spinlock being held.
>
> This mini series adds missing READ_ONCE()/WRITE_ONCE() annotations.
>
> Original patch was too big, splitting it eases code review.
>
> Eric Dumazet (5):
> net/sched: sch_cake: annotate data-races in cake_dump_stats() (I)
> net/sched: sch_cake: annotate data-races in cake_dump_stats() (II)
> net/sched: sch_cake: annotate data-races in cake_dump_stats() (III)
> net/sched: sch_cake: annotate data-races in cake_dump_stats() (IV)
> net/sched: sch_cake: annotate data-races in cake_dump_stats() (V)
>
> [...]
Here is the summary with links:
- [v2,net,1/5] net/sched: sch_cake: annotate data-races in cake_dump_stats() (I)
https://git.kernel.org/netdev/net/c/44967ac3785e
- [v2,net,2/5] net/sched: sch_cake: annotate data-races in cake_dump_stats() (II)
https://git.kernel.org/netdev/net/c/91a96427b93b
- [v2,net,3/5] net/sched: sch_cake: annotate data-races in cake_dump_stats() (III)
https://git.kernel.org/netdev/net/c/276a98a43496
- [v2,net,4/5] net/sched: sch_cake: annotate data-races in cake_dump_stats() (IV)
https://git.kernel.org/netdev/net/c/8fab48d87745
- [v2,net,5/5] net/sched: sch_cake: annotate data-races in cake_dump_stats() (V)
https://git.kernel.org/netdev/net/c/a6c95b833dc1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net v2 0/4] netconsole: configfs store callback fixes
From: patchwork-bot+netdevbpf @ 2026-04-29 1:40 UTC (permalink / raw)
To: Breno Leitao
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, k-keiichi, satyam,
akpm, thepacketgeek, asantostc, gustavold, netdev, linux-kernel,
kernel-team, horms
In-Reply-To: <20260427-netconsole_ai_fixes-v2-0-59965f29d9cc@debian.org>
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Apr 2026 07:30:34 -0700 you wrote:
> V2 for issues in netconsole's configfs store callbacks.
>
> There are still some changes I want to make, such as, having the dynamic
> lock when reading from configfs (_show() callbacks), wich will solve
> other issues, but I will keep it for later.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
>
> [...]
Here is the summary with links:
- [net,v2,1/4] netconsole: return count instead of strnlen(buf, count) from store callbacks
https://git.kernel.org/netdev/net/c/d62c6f2df5c0
- [net,v2,2/4] netconsole: avoid clobbering userdatum value on truncated write
https://git.kernel.org/netdev/net/c/e6dd94252b0f
- [net,v2,3/4] netconsole: propagate device name truncation in dev_name_store()
https://git.kernel.org/netdev/net/c/92ceb7bff62c
- [net,v2,4/4] netconsole: restore userdatum value on update_userdata() failure
https://git.kernel.org/netdev/net/c/869cd6490faf
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net-next] ppp: add PPPOX symbol
From: patchwork-bot+netdevbpf @ 2026-04-29 1:40 UTC (permalink / raw)
To: Qingfang Deng
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, julianbraha,
ebiggers, netdev, linux-kernel, linux-ppp
In-Reply-To: <20260428012830.3069-1-qingfang.deng@linux.dev>
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 28 Apr 2026 09:28:26 +0800 you wrote:
> Add a dedicated CONFIG_PPPOX symbol to handle the PPPoX generic module,
> avoiding redundant pppox.o definitions in the Makefile.
>
> Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
> ---
> drivers/net/ppp/Kconfig | 6 ++++++
> drivers/net/ppp/Makefile | 6 +++---
> 2 files changed, 9 insertions(+), 3 deletions(-)
Here is the summary with links:
- [net-next] ppp: add PPPOX symbol
https://git.kernel.org/netdev/net-next/c/09942ddedcb9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net-next v7 4/4] riscv: dts: eswin: eic7700-hifive-premier-p550: enable Ethernet controller
From: Andrew Lunn @ 2026-04-29 1:41 UTC (permalink / raw)
To: lizhi2
Cc: devicetree, andrew+netdev, davem, edumazet, kuba, robh, krzk+dt,
conor+dt, netdev, pabeni, mcoquelin.stm32, alexandre.torgue,
rmk+kernel, pjw, palmer, aou, alex, linux-riscv, linux-stm32,
linux-arm-kernel, linux-kernel, maxime.chevallier, ningyu, linmin,
pinkesh.vaghela, pritesh.patel, weishangjuan, horms
In-Reply-To: <20260427072603.1191-1-lizhi2@eswincomputing.com>
> +&gmac1 {
> + phy-handle = <&gmac1_phy0>;
> + /*
> + * For the TX path of gmac1, there is a skew between the TX clock
> + * and data on the MAC controller inside the silicon. This skew happens
> + * to be approximately 2 ns. Therefore, it can be considered that the
> + * 2 ns delay of TX is provided by the MAC.
> + * No delay configuration for tx is needed in software via PHY driver.
> + */
> + phy-mode = "rgmii-rxid";
This is wrong. Take a read of
https://elixir.bootlin.com/linux/v6.15/source/Documentation/devicetree/bindings/net/ethernet-controller.yaml#L287
phy-mode describes the board. If the board provides the 2ns delay, you
use rgmii. If the MAC/PHY pair needs to provide the delay, you using
rgmii-id.
If rgmii-id is used, it is up to the MAC/PHY to decide which will add
the delay. If the MAC adds the delay, it needs to mask the value of
phy-mode it passes to the PHY so it does not also add the delay.
Your broken hardware means you cannot support 'rgmii' or 'rgmii-rx',
since you cannot turn off this 2ns delay, so you end up with double
delays if anybody designs a board with 2ns TX delay on the board
itself. So please validate the PHY modes and return -EINVAL if these
modes are used.
Andrew
---
pw-bot: cr
^ permalink raw reply
* Re: [PATCH net-next 3/3] psp: validate IPv4 header fields in psp_dev_rcv()
From: Jakub Kicinski @ 2026-04-29 1:43 UTC (permalink / raw)
To: Willem de Bruijn
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
daniel.zahka
In-Reply-To: <willemdebruijn.kernel.223eebd28b57a@gmail.com>
On Tue, 28 Apr 2026 20:22:34 -0400 Willem de Bruijn wrote:
> Jakub Kicinski wrote:
> > psp_dev_rcv() is called from the NIC driver's RX completion path
> > before the frame reaches ip_rcv_core(), so the IP header has not
> > been validated in SW, yet. We expect that the device has done
> > all this validation, but let's also add the SW checks, to avoid
> > surprises.
>
> If devices are expected to have verified this, should these be more
> noisy checks, similar to netdev_rx_csum_fault?
Maybe "expect" is a bit of a strong word, I meant "anticipate" /
"suspect". Dropping invalid packet in SW doesn't seem like a huge
problem, other paths in this function already do. For rx csum the
problem is that we got a incorrectly math'ed out value for what is
likely a valid packet.
That's just to explain my thinking, if you prefer we warn / dump skb
I can respin.
^ permalink raw reply
* Re: [PATCH net-next] net/mlx5: Add MLX5_VXLAN config option
From: Jakub Kicinski @ 2026-04-29 1:46 UTC (permalink / raw)
To: Marc Harvey
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni, netdev,
linux-rdma, linux-kernel, Kuniyuki Iwashima
In-Reply-To: <20260428-mlx5_vxlan-v1-1-cf666d042618@google.com>
On Tue, 28 Apr 2026 22:44:34 +0000 Marc Harvey wrote:
> Currently, there is no way to disable mlx5 vxlan offloading if vxlan
> is enabled. We've (possibly) seen some minor udp rr and udp stream
> regressions when enabling vxlan, and want a way to disable this
> offloading. Also coupling vxlan offloading with vxlan enablement
> generally limits the flexability of vxlan setups.
>
> Add a new config option for mlx5 vxlan offloading specifically, so
> that users can use vxlan without automatically opting in to the
> offloading.
>
> To keep the same behavior as before, the new config option is enabled
> by default if vxlan is enabled.
Can we delay init of whatever makes the device slow down until the
first vxlan port is registered? A kconfig level optimization of this
sort will have rather limited applicability.
^ permalink raw reply
* [PATCH net-next] tcp: add sk->sk_synq_overflow_ts
From: Eric Dumazet @ 2026-04-29 1:49 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, netdev,
eric.dumazet, Eric Dumazet
tcp_synq_overflow() and tcp_synq_no_recent_overflow() are currently
using tp->rx_opt.ts_recent_stamp to store a 32bit jiffie value.
Use instead full "unsigned long" storage, as an union with sk->sk_stamp
which is not used by a TCP listener.
As a bonus, we can remove time_between32() from include/linux/time.h.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/linux/time.h | 13 ---------
include/net/sock.h | 5 +++-
include/net/sock_reuseport.h | 2 +-
include/net/tcp.h | 56 ++++++++++++------------------------
4 files changed, 24 insertions(+), 52 deletions(-)
diff --git a/include/linux/time.h b/include/linux/time.h
index 16cf4522d6f338176f1fa753360e8bdec2c7bc8d..7554e44ea4a9472d306c770e2e6d2907ef5f244a 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -84,19 +84,6 @@ static inline bool itimerspec64_valid(const struct itimerspec64 *its)
#define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0)
#define time_before32(b, a) time_after32(a, b)
-/**
- * time_between32 - check if a 32-bit timestamp is within a given time range
- * @t: the time which may be within [l,h]
- * @l: the lower bound of the range
- * @h: the higher bound of the range
- *
- * time_before32(t, l, h) returns true if @l <= @t <= @h. All operands are
- * treated as 32-bit integers.
- *
- * Equivalent to !(time_before32(@t, @l) || time_after32(@t, @h)).
- */
-#define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l))
-
# include <vdso/time.h>
#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index dccd3738c3687056b67c8de44fce9842dcc365ec..ed1e52de43c3394fae74f45a85527dec08c7ec48 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -548,7 +548,10 @@ struct sock {
struct pid *sk_peer_pid;
const struct cred *sk_peer_cred;
- ktime_t sk_stamp;
+ union {
+ ktime_t sk_stamp;
+ unsigned long sk_synq_overflow_ts; /* tcp_synq_overflow */
+ };
#if BITS_PER_LONG==32
seqlock_t sk_stamp_seq;
#endif
diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h
index 6e4faf3ee76fbd86e2c4ac6ff13ead5c9a9187d6..a6beda5dca40777e27ef071d777081fd8af6ea03 100644
--- a/include/net/sock_reuseport.h
+++ b/include/net/sock_reuseport.h
@@ -20,7 +20,7 @@ struct sock_reuseport {
/* The last synq overflow event timestamp of this
* reuse->socks[] group.
*/
- unsigned int synq_overflow_ts;
+ unsigned long synq_overflow_ts;
/* ID stays the same even after the size of socks[] grows. */
unsigned int reuseport_id;
unsigned int bind_inany:1;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ecbadcb3a7446cb18c245e670ba49ff574dfaff7..78ca1e336321da50953e6268c4a5d5185eb7791a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -634,56 +634,38 @@ struct bpf_tcp_req_attrs {
*/
static inline void tcp_synq_overflow(const struct sock *sk)
{
- unsigned int last_overflow;
- unsigned int now = jiffies;
-
- if (sk->sk_reuseport) {
- struct sock_reuseport *reuse;
-
- reuse = rcu_dereference(sk->sk_reuseport_cb);
- if (likely(reuse)) {
- last_overflow = READ_ONCE(reuse->synq_overflow_ts);
- if (!time_between32(now, last_overflow,
- last_overflow + HZ))
- WRITE_ONCE(reuse->synq_overflow_ts, now);
- return;
- }
- }
+ unsigned long last_overflow, now = jiffies;
+ struct sock_reuseport *reuse;
+ unsigned long *ptr;
+
+ reuse = sk->sk_reuseport ? rcu_dereference(sk->sk_reuseport_cb) : NULL;
+ ptr = reuse ? &reuse->synq_overflow_ts : &((struct sock *)sk)->sk_synq_overflow_ts;
+ last_overflow = READ_ONCE(*ptr);
- last_overflow = READ_ONCE(tcp_sk(sk)->rx_opt.ts_recent_stamp);
- if (!time_between32(now, last_overflow, last_overflow + HZ))
- WRITE_ONCE(tcp_sk_rw(sk)->rx_opt.ts_recent_stamp, now);
+ if (time_after(now, last_overflow + HZ))
+ WRITE_ONCE(*ptr, now);
}
/* syncookies: no recent synqueue overflow on this listening socket? */
static inline bool tcp_synq_no_recent_overflow(const struct sock *sk)
{
- unsigned int last_overflow;
- unsigned int now = jiffies;
-
- if (sk->sk_reuseport) {
- struct sock_reuseport *reuse;
-
- reuse = rcu_dereference(sk->sk_reuseport_cb);
- if (likely(reuse)) {
- last_overflow = READ_ONCE(reuse->synq_overflow_ts);
- return !time_between32(now, last_overflow - HZ,
- last_overflow +
- TCP_SYNCOOKIE_VALID);
- }
- }
+ unsigned long last_overflow, now = jiffies;
+ const struct sock_reuseport *reuse;
+ const unsigned long *ptr;
- last_overflow = READ_ONCE(tcp_sk(sk)->rx_opt.ts_recent_stamp);
+ reuse = sk->sk_reuseport ? rcu_dereference(sk->sk_reuseport_cb) : NULL;
+ ptr = reuse ? &reuse->synq_overflow_ts : &sk->sk_synq_overflow_ts;
+ last_overflow = READ_ONCE(*ptr);
/* If last_overflow <= jiffies <= last_overflow + TCP_SYNCOOKIE_VALID,
* then we're under synflood. However, we have to use
* 'last_overflow - HZ' as lower bound. That's because a concurrent
- * tcp_synq_overflow() could update .ts_recent_stamp after we read
- * jiffies but before we store .ts_recent_stamp into last_overflow,
+ * tcp_synq_overflow() could update synq_overflow_ts after we read
+ * jiffies but before we store synq_overflow_ts into last_overflow,
* which could lead to rejecting a valid syncookie.
*/
- return !time_between32(now, last_overflow - HZ,
- last_overflow + TCP_SYNCOOKIE_VALID);
+ return !time_in_range(now, last_overflow - HZ,
+ last_overflow + TCP_SYNCOOKIE_VALID);
}
static inline u32 tcp_cookie_time(void)
--
2.54.0.545.g6539524ca2-goog
^ permalink raw reply related
* Re: [PATCH net 0/4] mptcp: misc fixes for v7.1-rc2
From: patchwork-bot+netdevbpf @ 2026-04-29 1:50 UTC (permalink / raw)
To: Matthieu Baerts
Cc: martineau, geliang, davem, edumazet, kuba, pabeni, horms, fw,
netdev, mptcp, linux-kernel, yangang, stable, sashiko-bot, lance
In-Reply-To: <20260427-net-mptcp-misc-fixes-7-1-rc2-v1-0-7432b7f279fa@kernel.org>
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Apr 2026 21:54:32 +0200 you wrote:
> Here are various unrelated fixes:
>
> - Patches 1-2: set timestamp flags on 'ssk', not 'sk' (typo); Plus do
> that with sleepable lock_sock/release_sock. A fix for v5.14.
>
> - Patch 3: respect SO_LINGER(1, 0) by sending MP_FASTCLOSE at close time
> as expected. A fix for v6.1.
>
> [...]
Here is the summary with links:
- [net,1/4] mptcp: sockopt: set timestamp flags on subflow socket, not msk
https://git.kernel.org/netdev/net/c/5f95c21fc23a
- [net,2/4] mptcp: fix scheduling with atomic in timestamp sockopt
https://git.kernel.org/netdev/net/c/b5c52908d52c
- [net,3/4] mptcp: fastclose msk when linger time is 0
https://git.kernel.org/netdev/net/c/f14d6e9c3678
- [net,4/4] mptcp: pm: kernel: reset fullmesh counter after flush
https://git.kernel.org/netdev/net/c/1774d3cf3cf1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net-next 2/4] r8152: Add support for the RTL8159 chip
From: Andrew Lunn @ 2026-04-29 1:52 UTC (permalink / raw)
To: Birger Koblitz
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-usb, netdev, linux-kernel, Chih Kai Hsu
In-Reply-To: <20260428-rtl8159_net_next-v1-2-52d03927b46f@birger-koblitz.de>
> @@ -3431,6 +3432,7 @@ static void rtl8152_nic_reset(struct r8152 *tp)
> ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_USB_CTRL, CDC_ECM_EN);
> break;
>
> + case RTL_VER_17:
> case RTL_VER_16:
> ocp_byte_clr_bits(tp, MCU_TYPE_PLA, PLA_CR, CR_RE | CR_TE);
nitpick. The other switch statements seem to be sorted. So 17 should
be after 16.
> + /* Power level tuning */
> + // test mode power level
> + sram_write_w0w1(tp, 0x8415, 0xff00, 0x9300);
> + // normal link power level 10G, 5G, 2.5G
> + sram_write_w0w1(tp, 0x81a3, 0xff00, 0x0f00);
> + sram_write_w0w1(tp, 0x81ae, 0xff00, 0x0f00);
> + sram_write_w0w1(tp, 0x81b9, 0xff00, 0xb900);
> + //nomal link TX filter
normal? Please also add a space after the //. netdev also prefers /*
*/.
> + /* XG INRX parameters */
> + // RC coefficients
> + sram2_write(tp, 0x84ac, 0x0000);
> + sram2_write(tp, 0x84ae, 0x0000);
> + sram2_write(tp, 0x84b0, 0xf818);
> + sram2_write_w0w1(tp, 0x84b2, 0xff00, 0x6000);
> + //Training AAGC PAR (with uc2 patch)
space
> +static int r8159_wait_backup_restore(struct r8152 *tp)
> +{
> + u32 ocp_data;
> +
> + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
> + if (!(ocp_data & PCUT_STATUS))
> + return 0;
> +
> + return poll_timeout_us(ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_GPHY_CTRL),
> + ocp_data & BACKUP_RESTRORE, 200, 2000, false);
> +}
> +
> static void r8156_init(struct r8152 *tp)
> @@ -8221,6 +8421,9 @@ static void r8156_init(struct r8152 *tp)
> return;
> }
>
> + if (tp->version == RTL_VER_17 && r8159_wait_backup_restore(tp))
> + return;
You should probably do something with the return value from
r8159_wait_backup_restore(). At minimum a dev_err().
Andrew
---
pw-bot: cr
^ permalink raw reply
* Re: [PATCH net-next 1/4] r8152: Add support for 10Gbit Link Speeds and EEE
From: Andrew Lunn @ 2026-04-29 1:53 UTC (permalink / raw)
To: Birger Koblitz
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-usb, netdev, linux-kernel, Chih Kai Hsu
In-Reply-To: <20260428-rtl8159_net_next-v1-1-52d03927b46f@birger-koblitz.de>
On Tue, Apr 28, 2026 at 05:47:21AM +0200, Birger Koblitz wrote:
> The RTL8159 supports 10GBit Link speeds. Add support for this speed
> in the setup and setting/getting through ethtool. Also add 10GBit EEE.
> Add functionality for setup and ethtool get/set methods.
>
> Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply
* Re: [PATCH net-next 3/4] r8152: Add irq mitigation for RTL8157/9
From: Andrew Lunn @ 2026-04-29 1:56 UTC (permalink / raw)
To: Birger Koblitz
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-usb, netdev, linux-kernel, Chih Kai Hsu
In-Reply-To: <20260428-rtl8159_net_next-v1-3-52d03927b46f@birger-koblitz.de>
On Tue, Apr 28, 2026 at 05:47:23AM +0200, Birger Koblitz wrote:
> Add interrupt mitigation code for both RTL8157 and RTL8159 that prevents
> USB interrupt callbacks with urb->status ESHUTDOWN being triggered. While the
> issue is rarely seen on the RTL8157, without the mitigation, it is
> common on the RTL8159:
> [273.561863] r8152 7-1:1.0 enx88c9b3b5xxxx: Stop submitting intr, status -108
>
> Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
> ---
> drivers/net/usb/r8152.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 8255261d73148a7b4dabe0188faf07cb1f356437..08cc3c1dae0facb2400890ba4d093c97ed56d40b 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -8444,6 +8444,12 @@ static void r8156_init(struct r8152 *tp)
> else
> r8153_u2p3en(tp, false);
>
> + if (tp->version >= RTL_VER_16) {
> + /* Disable Interrupt Mitigation */
> + ocp_byte_clr_bits(tp, MCU_TYPE_USB, 0xcf04,
> + BIT(0) | BIT(1) | BIT(2) | BIT(7));
> + }
What does interrupt mitigation do?
Is this a different name for interrupt coalescence, where the MAC
delays interrupts for a period of time so more packets are in the
receive ring when it does interrupt, so reducing the number of
interrupts, and bigger bursts of packets are processed at once?
Andrew
^ permalink raw reply
* Re: [PATCH net-next 4/4] r8152: Add firmware upload capability for RTL8157/RTL8159
From: Andrew Lunn @ 2026-04-29 1:57 UTC (permalink / raw)
To: Birger Koblitz
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-usb, netdev, linux-kernel, Chih Kai Hsu
In-Reply-To: <20260428-rtl8159_net_next-v1-4-52d03927b46f@birger-koblitz.de>
On Tue, Apr 28, 2026 at 05:47:24AM +0200, Birger Koblitz wrote:
> The RTL8159 requires firmware for its PHY in order to work at
> connection speeds > 5GBit. Add support for uploading firmware for
> the PHYs using the existing rtl8152_apply_firmware() function
> in r8157_hw_phy_cfg() and set up the correct names for the firmware
> files.
>
> If no firmware is found, both the RTL8157 and the RTL8159 will continue
> to work.
>
> Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
> ---
> drivers/net/usb/r8152.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 08cc3c1dae0facb2400890ba4d093c97ed56d40b..56e00fe6f32405ce753df3e03e54a7daaf1a29ac 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -4663,10 +4663,11 @@ static bool rtl8152_is_fw_phy_speed_up_ok(struct r8152 *tp, struct fw_phy_speed_
> case RTL_VER_11:
> case RTL_VER_12:
> case RTL_VER_14:
> - case RTL_VER_16:
> goto out;
> case RTL_VER_13:
> case RTL_VER_15:
> + case RTL_VER_16:
> + case RTL_VER_17:
Is that a bug fix?
Andrew
^ permalink raw reply
* Re: [PATCH net-next] tcp: add sk->sk_synq_overflow_ts
From: Eric Dumazet @ 2026-04-29 1:58 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, netdev,
eric.dumazet
In-Reply-To: <20260429014913.1043836-1-edumazet@google.com>
On Tue, Apr 28, 2026 at 6:49 PM Eric Dumazet <edumazet@google.com> wrote:
>
> tcp_synq_overflow() and tcp_synq_no_recent_overflow() are currently
> using tp->rx_opt.ts_recent_stamp to store a 32bit jiffie value.
>
> Use instead full "unsigned long" storage, as an union with sk->sk_stamp
> which is not used by a TCP listener.
>
> As a bonus, we can remove time_between32() from include/linux/time.h.
Please disregard this, I sent a wrong version of this patch.
pw-bot: cr
^ permalink raw reply
* Re: [PATCH net 2/2] ip6_gre: Use cached t->net in ip6erspan_changelink().
From: Xiao Liang @ 2026-04-29 1:58 UTC (permalink / raw)
To: Maoyi Xie
Cc: netdev, kuniyu, davem, kuba, edumazet, pabeni, dsahern, kuznet,
linux-kernel, stable, security
In-Reply-To: <20260428110713.2550315-3-maoyixie.tju@gmail.com>
On Tue, Apr 28, 2026 at 7:07 PM Maoyi Xie <maoyixie.tju@gmail.com> wrote:
>
> From: Maoyi Xie <maoyi.xie@ntu.edu.sg>
>
> After commit 5e72ce3e3980 ("net: ipv6: Use link netns in newlink() of
> rtnl_link_ops"), ip6erspan_newlink() correctly resolves the per-netns
> ip6gre hash via link_net. ip6erspan_changelink() was not converted in
> that series and still uses dev_net(dev), which diverges from the
> device's creation netns after IFLA_NET_NS_FD migration.
>
> This re-inserts the tunnel into the wrong per-netns hash, leaving a
> stale entry in the original creation netns. When that netns is later
> destroyed, ip6gre_exit_rtnl_net() walks the stale entry, producing a
> slab-use-after-free reported by KASAN, followed by a kernel BUG at
> net/core/dev.c (LIST_POISON1) in unregister_netdevice_many_notify().
>
> Reachable from an unprivileged user namespace ("unshare --user
> --map-root-user --net"); cross-tenant scope on container hosts.
>
> Note: ip6gre_changelink() (the non-erspan sibling earlier in the same
> file) already uses the cached t->net correctly. The bug is specific
> to ip6erspan_changelink() copying the wrong shape.
>
> Fixes: 5e72ce3e3980 ("net: ipv6: Use link netns in newlink() of rtnl_link_ops")
The changes look good to me. But why is 5e72ce3e3980 mentioned
here? It neither introduced nor was intended to fix this bug.
Thanks.
> Reported-by: Maoyi Xie <maoyi.xie@ntu.edu.sg>
> Cc: stable@vger.kernel.org # v5.15+
> Signed-off-by: Maoyi Xie <maoyi.xie@ntu.edu.sg>
> ---
> net/ipv6/ip6_gre.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index dafcc0dcd..38ac14cc0 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -2261,7 +2261,8 @@ static int ip6erspan_changelink(struct net_device *dev, struct nlattr *tb[],
> struct nlattr *data[],
> struct netlink_ext_ack *extack)
> {
> - struct ip6gre_net *ign = net_generic(dev_net(dev), ip6gre_net_id);
> + struct ip6_tnl *nt = netdev_priv(dev);
> + struct ip6gre_net *ign = net_generic(nt->net, ip6gre_net_id);
> struct __ip6_tnl_parm p;
> struct ip6_tnl *t;
>
> --
> 2.34.1
>
^ permalink raw reply
* Re: [PATCH net 2/2] ip6_gre: Use cached t->net in ip6erspan_changelink().
From: Eric Dumazet @ 2026-04-29 2:00 UTC (permalink / raw)
To: Xiao Liang
Cc: Maoyi Xie, netdev, kuniyu, davem, kuba, pabeni, dsahern, kuznet,
linux-kernel, stable, security
In-Reply-To: <CABAhCOTmZ4hAuhtimOX1YQDGFC2fbXm5WmwT0Z8PxZU7Zq-2Fw@mail.gmail.com>
On Tue, Apr 28, 2026 at 6:58 PM Xiao Liang <shaw.leon@gmail.com> wrote:
>
> On Tue, Apr 28, 2026 at 7:07 PM Maoyi Xie <maoyixie.tju@gmail.com> wrote:
> >
> > From: Maoyi Xie <maoyi.xie@ntu.edu.sg>
> >
> > After commit 5e72ce3e3980 ("net: ipv6: Use link netns in newlink() of
> > rtnl_link_ops"), ip6erspan_newlink() correctly resolves the per-netns
> > ip6gre hash via link_net. ip6erspan_changelink() was not converted in
> > that series and still uses dev_net(dev), which diverges from the
> > device's creation netns after IFLA_NET_NS_FD migration.
> >
> > This re-inserts the tunnel into the wrong per-netns hash, leaving a
> > stale entry in the original creation netns. When that netns is later
> > destroyed, ip6gre_exit_rtnl_net() walks the stale entry, producing a
> > slab-use-after-free reported by KASAN, followed by a kernel BUG at
> > net/core/dev.c (LIST_POISON1) in unregister_netdevice_many_notify().
> >
> > Reachable from an unprivileged user namespace ("unshare --user
> > --map-root-user --net"); cross-tenant scope on container hosts.
> >
> > Note: ip6gre_changelink() (the non-erspan sibling earlier in the same
> > file) already uses the cached t->net correctly. The bug is specific
> > to ip6erspan_changelink() copying the wrong shape.
> >
> > Fixes: 5e72ce3e3980 ("net: ipv6: Use link netns in newlink() of rtnl_link_ops")
>
> The changes look good to me. But why is 5e72ce3e3980 mentioned
> here? It neither introduced nor was intended to fix this bug.
Which patch added the bug then in your opinion?
^ permalink raw reply
* Re: [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy()
From: Deepanshu Kartikey @ 2026-04-29 2:01 UTC (permalink / raw)
To: steffen.klassert, herbert, davem, edumazet, kuba, pabeni, horms,
sd
Cc: netdev, linux-kernel
In-Reply-To: <20260414020947.65905-1-kartikey406@gmail.com>
On Tue, Apr 14, 2026 at 7:39 AM Deepanshu Kartikey
<kartikey406@gmail.com> wrote:
>
> Replace the open-coded manual cleanup in the error path of
> xfrm_add_policy() with xfrm_policy_destroy(), which already
> handles all the necessary cleanup internally. This is consistent
> with how xfrm_policy_construct() handles its own error paths.
>
> The walk.dead flag must be set before calling xfrm_policy_destroy()
> as required by BUG_ON(!policy->walk.dead).
>
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> ---
> v3:
> - Changed prefix to ipsec-next as this is a cleanup
> - Dropped syzbot references as suggested by Sabrina Dubroca
> v2:
> - Reworded commit message to reflect cleanup rather than bugfix
> as suggested by Sabrina Dubroca
> - Removed incorrect Fixes: and Closes: tags
> - Corrected subject prefix to PATCH ipsec
> ---
> net/xfrm/xfrm_user.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> index d56450f61669..ae144d1e4a65 100644
> --- a/net/xfrm/xfrm_user.c
> +++ b/net/xfrm/xfrm_user.c
> @@ -2267,9 +2267,8 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
>
> if (err) {
> xfrm_dev_policy_delete(xp);
> - xfrm_dev_policy_free(xp);
> - security_xfrm_policy_free(xp->security);
> - kfree(xp);
> + xp->walk.dead = 1;
> + xfrm_policy_destroy(xp);
> return err;
> }
>
> --
> 2.43.0
>
Gentle ping on this patch . Please let me know the status of this patch.
If anything is required from my side
Thanks
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox