From: Jakub Kicinski <kuba@kernel.org>
To: Davide Caratti <dcaratti@redhat.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next 2/4] netdevsim: generalize taprio offload
Date: Tue, 10 Mar 2026 16:38:44 -0700 [thread overview]
Message-ID: <20260310163844.58f66f93@kernel.org> (raw)
In-Reply-To: <52ae15a7e42d7754487bb744c1a1718246d032ef.1773165520.git.dcaratti@redhat.com>
On Tue, 10 Mar 2026 19:06:29 +0100 Davide Caratti wrote:
> -static void nsim_taprio_stats(struct tc_taprio_qopt_stats *stats)
> -{
> - stats->window_drops = 0;
> - stats->tx_overruns = 0;
> -}
> +static LIST_HEAD(nsim_block_cb_list);
>
> -static int nsim_setup_tc_taprio(struct net_device *dev,
> - struct tc_taprio_qopt_offload *offload)
> -{
> - int err = 0;
> -
> - switch (offload->cmd) {
> - case TAPRIO_CMD_REPLACE:
> - case TAPRIO_CMD_DESTROY:
> - break;
> - case TAPRIO_CMD_STATS:
> - nsim_taprio_stats(&offload->stats);
> - break;
> - default:
> - err = -EOPNOTSUPP;
> - }
> +#define QDISC_OFFLOAD_HANDLERS(X) \
> + X(taprio, tc_taprio_qopt_offload, cmd, TAPRIO_CMD_REPLACE, \
> + TAPRIO_CMD_DESTROY, TAPRIO_CMD_STATS, stats) \
>
> - return err;
> +#define QH(NAME, OL_TYPE, CMD_FLD, O_REPLACE, O_DESTROY, O_STATS, STATS_FLD) \
> +static int handle_##NAME(struct net_device *dev, struct OL_TYPE *offload) \
> +{ \
> + switch (offload->CMD_FLD) { \
> + case O_REPLACE: \
> + case O_DESTROY: \
> + /* Do nothing, accept offload */ \
> + return 0; \
> + case O_STATS: \
> + /* Zero out the requested stats block */ \
> + memset(&offload->STATS_FLD, 0, sizeof(offload->STATS_FLD)); \
> + return 0; \
> + default: \
> + return -EOPNOTSUPP; \
> + } \
> }
>
> -static LIST_HEAD(nsim_block_cb_list);
> +QDISC_OFFLOAD_HANDLERS(QH)
> +#undef QH
Please just type the code in. These sort of macros are too ugly to live
in code I directly maintain, sorry.
--
pw-bot: cr
next prev parent reply other threads:[~2026-03-10 23:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 18:06 [PATCH net-next 0/4] netdevsim: support ETS offload Davide Caratti
2026-03-10 18:06 ` [PATCH net-next 1/4] netdevsim: move TC offload code to a dedicated file Davide Caratti
2026-03-10 18:06 ` [PATCH net-next 2/4] netdevsim: generalize taprio offload Davide Caratti
2026-03-10 23:38 ` Jakub Kicinski [this message]
2026-03-10 18:06 ` [PATCH net-next 3/4] netdevsim: support ETS qdisc offload Davide Caratti
2026-03-10 18:06 ` [PATCH net-next 4/4] tc-testing: add a test case for ETS offload Davide Caratti
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=20260310163844.58f66f93@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.