Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Feb 2021 13:59:39 -0900
From:      Rob Wing <rob.fx907@gmail.com>
To:        "Alexander V. Chernikov" <melifaro@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,  "dev-commits-src-branches@freebsd.org" <dev-commits-src-branches@freebsd.org>
Subject:   Re: git: f5f50ec15688 - stable/13 - MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd().
Message-ID:  <CAF3%2Bn_dPHc%2BH5HchAJWS99LnBqTusq5cJGGtC=3t2JjRSg8b=A@mail.gmail.com>
In-Reply-To: <202102042234.114MYu5E007554@gitrepo.freebsd.org>
References:  <202102042234.114MYu5E007554@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I=E2=80=99m not opinionated on this, only pointing out that most MFC commit=
s lately
have trended towards using git cherry-pick and dropping the MFC: xxxxxx in
the commit message.

I know Warner encourages this, as documented at
https://github.com/bsdimp/freebsd-git-docs/blob/main/MFC.md#marking-mfcs

-Rob


On Thursday, February 4, 2021, Alexander V. Chernikov <melifaro@freebsd.org=
>
wrote:

> The branch stable/13 has been updated by melifaro:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=3D
> f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0
>
> commit f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0
> Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
> AuthorDate: 2021-01-30 22:32:42 +0000
> Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
> CommitDate: 2021-02-04 22:34:15 +0000
>
>     MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into
> rebuild_fd().
>
>     This simplifies code a bit and allows for future non-callout
>      callers to request rebuild.
> ---
>  sys/net/route/fib_algo.c | 40 +++++++++++++++++++++++++---------------
>  1 file changed, 25 insertions(+), 15 deletions(-)
>
> diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c
> index 1f040ad259c5..f7a8b3f82431 100644
> --- a/sys/net/route/fib_algo.c
> +++ b/sys/net/route/fib_algo.c
> @@ -155,6 +155,7 @@ struct fib_data {
>         TAILQ_ENTRY(fib_data)   entries;        /* list of all fds in vne=
t
> */
>  };
>
> +static bool rebuild_fd(struct fib_data *fd);
>  static void rebuild_fd_callout(void *_data);
>  static void destroy_fd_instance_epoch(epoch_context_t ctx);
>  static enum flm_op_result attach_datapath(struct fib_data *fd);
> @@ -1011,13 +1012,28 @@ setup_fd_instance(struct fib_lookup_module *flm,
> struct rib_head *rh,
>  static void
>  rebuild_fd_callout(void *_data)
>  {
> -       struct fib_data *fd, *fd_new, *fd_tmp;
> +       struct fib_data *fd =3D (struct fib_data *)_data;
> +
> +       FD_PRINTF(LOG_INFO, fd, "running callout rebuild");
> +
> +       CURVNET_SET(fd->fd_vnet);
> +       rebuild_fd(fd);
> +       CURVNET_RESTORE();
> +}
> +
> +/*
> + * Tries to create new algo instance based on @fd data.
> + * Returns true on success.
> + */
> +static bool
> +rebuild_fd(struct fib_data *fd)
> +{
> +       struct fib_data *fd_new, *fd_tmp;
>         struct fib_lookup_module *flm_new =3D NULL;
>         struct epoch_tracker et;
>         enum flm_op_result result;
>         bool need_rebuild =3D false;
>
> -       fd =3D (struct fib_data *)_data;
>
>         FIB_MOD_LOCK();
>         need_rebuild =3D fd->fd_need_rebuild;
> @@ -1026,15 +1042,12 @@ rebuild_fd_callout(void *_data)
>         fd->fd_num_changes =3D 0;
>         FIB_MOD_UNLOCK();
>
> -       CURVNET_SET(fd->fd_vnet);
> -
>         /* First, check if we're still OK to use this algo */
>         if (!is_algo_fixed(fd->fd_rh))
>                 flm_new =3D fib_check_best_algo(fd->fd_rh, fd->fd_flm);
>         if ((flm_new =3D=3D NULL) && (!need_rebuild)) {
>                 /* Keep existing algo, no need to rebuild. */
> -               CURVNET_RESTORE();
> -               return;
> +               return (true);
>         }
>
>         if (flm_new =3D=3D NULL) {
> @@ -1051,19 +1064,16 @@ rebuild_fd_callout(void *_data)
>         }
>         if (result !=3D FLM_SUCCESS) {
>                 FD_PRINTF(LOG_NOTICE, fd, "table rebuild failed");
> -               CURVNET_RESTORE();
> -               return;
> +               return (false);
>         }
>         FD_PRINTF(LOG_INFO, fd_new, "switched to new instance");
>
> -       /* Remove old instance removal */
> -       if (fd !=3D NULL) {
> -               NET_EPOCH_ENTER(et);
> -               schedule_destroy_fd_instance(fd, true);
> -               NET_EPOCH_EXIT(et);
> -       }
> +       /* Remove old instance */
> +       NET_EPOCH_ENTER(et);
> +       schedule_destroy_fd_instance(fd, true);
> +       NET_EPOCH_EXIT(et);
>
> -       CURVNET_RESTORE();
> +       return (true);
>  }
>
>  /*
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF3%2Bn_dPHc%2BH5HchAJWS99LnBqTusq5cJGGtC=3t2JjRSg8b=A>