Re: [PATCH v5 net-next 4/4] sfc: remove expired unicast PTP filters
From: Edward Cree <ecree.xilinx@gmail.com>
Date: 2023-03-28 04:19:40
On 27/03/2023 11:57, Íñigo Huguet wrote:
Filters inserted to support unicast PTP mode might become unused after some time, so we need to remove them to avoid accumulating many of them. Refresh the expiration time of a filter each time it's used. Then check periodically if any filter hasn't been used for a long time (30s) and remove it. Reported-by: Yalin Li <redacted> Signed-off-by: Íñigo Huguet <redacted> ---
...
quoted hunk ↗ jump to hunk
@@ -1378,8 +1394,12 @@ static int efx_ptp_insert_filter(struct efx_nic *efx, rxfilter->ether_type = spec->ether_type; rxfilter->loc_port = spec->loc_port; memcpy(rxfilter->loc_host, spec->loc_host, sizeof(spec->loc_host)); + rxfilter->expiry = expiry; list_add(&rxfilter->list, filter_list); + queue_delayed_work(ptp->workwq, &ptp->cleanup_work, + UCAST_FILTER_EXPIRY_JIFFIES);
Why not +1 here...
+static void efx_ptp_cleanup_worker(struct work_struct *work)
+{
+ struct efx_ptp_data *ptp =
+ container_of(work, struct efx_ptp_data, cleanup_work.work);
+ struct efx_ptp_rxfilter *rxfilter, *tmp;
+
+ list_for_each_entry_safe(rxfilter, tmp, &ptp->rxfilters_ucast, list) {
+ if (time_is_before_jiffies(rxfilter->expiry))
+ efx_ptp_remove_one_filter(ptp->efx, rxfilter);
+ }
+
+ if (!list_empty(&ptp->rxfilters_ucast)) {
+ queue_delayed_work(ptp->workwq, &ptp->cleanup_work,
+ UCAST_FILTER_EXPIRY_JIFFIES + 1);
+ }... like you have here? (Or vice-versa.) Other than that LGTM.