From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Wojciech Drewek <wojciech.drewek@intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net-next 10/12] ice: implement static version of ageing
Date: Fri, 21 Apr 2023 18:22:46 +0200 [thread overview]
Message-ID: <a868e53c-add1-986e-7c96-a02afbddde1e@intel.com> (raw)
In-Reply-To: <20230417093412.12161-11-wojciech.drewek@intel.com>
From: Wojciech Drewek <wojciech.drewek@intel.com>
Date: Mon, 17 Apr 2023 11:34:10 +0200
> From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> Remove fdb entries always when ageing time expired.
>
> Allow user to set ageing time using port object attribute.
>
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> ---
> .../net/ethernet/intel/ice/ice_eswitch_br.c | 46 +++++++++++++++++++
> .../net/ethernet/intel/ice/ice_eswitch_br.h | 11 +++++
> 2 files changed, 57 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> index a21eca5088f7..6c3144f98100 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> @@ -8,6 +8,8 @@
> #include "ice_vlan.h"
> #include "ice_vf_vsi_vlan_ops.h"
>
> +#define ICE_ESW_BRIDGE_UPDATE_INTERVAL_MS 1000
I think you can define it without '_MS' and as msecs_to_jiffies(1000)
right here, so that you wouldn't need to convert it at use sites (it's
more expensive to do there in terms of chars vs line width).
> +
> static const struct rhashtable_params ice_fdb_ht_params = {
> .key_offset = offsetof(struct ice_esw_br_fdb_entry, data),
> .key_len = sizeof(struct ice_esw_br_fdb_data),
> @@ -440,6 +442,7 @@ ice_eswitch_br_fdb_entry_create(struct net_device *netdev,
> fdb_entry->br_port = br_port;
> fdb_entry->flow = flow;
> fdb_entry->dev = netdev;
> + fdb_entry->last_use = jiffies;
> event = SWITCHDEV_FDB_ADD_TO_BRIDGE;
>
> if (added_by_user) {
> @@ -838,6 +841,10 @@ ice_eswitch_br_port_obj_attr_set(struct net_device *netdev, const void *ctx,
> ice_eswitch_br_vlan_filtering_set(br_port->bridge,
> attr->u.vlan_filtering);
> break;
> + case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
> + br_port->bridge->ageing_time =
> + clock_t_to_jiffies(attr->u.ageing_time);
Why reviews also teach the reviewer himself -- because I never knew of
clock_t and that userspace has its own ticks, which we have to convert O_.
(sounds as a joke BTW, why not just use ms/us/ns everywhere, "tick" is
something very intimate/internal)
> + break;
> default:
> return -EOPNOTSUPP;
> }
[...]
> + if (!bridge)
> + return;
> +
> + rtnl_lock();
> + list_for_each_entry_safe(entry, tmp, &bridge->fdb_list, list) {
> + if (entry->flags & ICE_ESWITCH_BR_FDB_ADDED_BY_USER)
> + continue;
> +
> + if (time_is_before_jiffies(entry->last_use +
> + bridge->ageing_time))
> + ice_eswitch_br_fdb_entry_notify_and_cleanup(bridge,
> + entry);
Maybe invert the condition to give a bit more space for arguments?
if (time_is_after_eq_jiffies(entry->last_use +
bridge->ageing_time))
continue;
ice_eswitch_br_fdb_entry_notify_and_cleanup(bridge, entry);
}
> + }
> + rtnl_unlock();
> +}
> +
> +static void ice_eswitch_br_update_work(struct work_struct *work)
> +{
> + struct ice_esw_br_offloads *br_offloads =
> + ice_work_to_br_offloads(work);
Assign it in a separate line pls :s
> +
> + ice_eswitch_br_update(br_offloads);
> +
> + queue_delayed_work(br_offloads->wq, &br_offloads->update_work,
> + msecs_to_jiffies(ICE_ESW_BRIDGE_UPDATE_INTERVAL_MS));
> +}
[...]
Thanks,
Olek
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-04-21 16:24 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 9:34 [Intel-wired-lan] [PATCH net-next 00/12] ice: switchdev bridge offload Wojciech Drewek
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 01/12] ice: Minor switchdev fixes Wojciech Drewek
2023-04-19 14:35 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 02/12] ice: Remove exclusion code for RDMA+SRIOV Wojciech Drewek
2023-04-19 14:38 ` Alexander Lobakin
2023-04-25 15:26 ` Michal Schmidt
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 03/12] ice: Unset src prune on uplink VSI Wojciech Drewek
2023-04-19 14:49 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 04/12] ice: Implement basic eswitch bridge setup Wojciech Drewek
2023-04-19 15:23 ` Alexander Lobakin
2023-04-20 9:54 ` Drewek, Wojciech
2023-04-20 10:46 ` Drewek, Wojciech
2023-04-20 16:53 ` Alexander Lobakin
2023-04-20 16:51 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 05/12] ice: Switchdev FDB events support Wojciech Drewek
2023-04-19 15:38 ` Alexander Lobakin
2023-04-20 11:27 ` Drewek, Wojciech
2023-04-20 16:59 ` Alexander Lobakin
2023-04-21 8:45 ` Drewek, Wojciech
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 06/12] ice: Add guard rule when creating FDB in switchdev Wojciech Drewek
2023-04-21 14:22 ` Alexander Lobakin
2023-04-25 9:17 ` Drewek, Wojciech
2023-04-26 9:50 ` Drewek, Wojciech
2023-04-26 15:24 ` Alexander Lobakin
2023-04-27 7:24 ` Drewek, Wojciech
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 07/12] ice: Accept LAG netdevs in bridge offloads Wojciech Drewek
2023-04-21 14:40 ` Alexander Lobakin
2023-04-26 11:31 ` Drewek, Wojciech
2023-04-26 15:31 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 08/12] ice: Add VLAN FDB support in switchdev mode Wojciech Drewek
2023-04-21 15:25 ` Alexander Lobakin
2023-04-27 10:28 ` Drewek, Wojciech
2023-05-08 14:09 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 09/12] ice: implement bridge port vlan Wojciech Drewek
2023-04-21 16:35 ` Alexander Lobakin
2023-05-09 11:25 ` Drewek, Wojciech
2023-05-09 15:06 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 10/12] ice: implement static version of ageing Wojciech Drewek
2023-04-21 16:22 ` Alexander Lobakin [this message]
2023-05-09 10:55 ` Drewek, Wojciech
2023-05-09 14:55 ` Alexander Lobakin
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 11/12] ice: add tracepoints for the switchdev bridge Wojciech Drewek
2023-04-17 9:34 ` [Intel-wired-lan] [PATCH net-next 12/12] ice: Ethtool fdb_cnt stats Wojciech Drewek
2023-04-21 16:32 ` Alexander Lobakin
2023-05-09 12:52 ` Drewek, Wojciech
2023-05-09 15:14 ` Alexander Lobakin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a868e53c-add1-986e-7c96-a02afbddde1e@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=wojciech.drewek@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox