Re: git: 9e772f203ff2 - main - mana: Fix a couple i386 build errors

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Mon, 29 Aug 2022 07:16:13 UTC
On 29 Aug 2022, at 07:35, Wei Hu <whu@FreeBSD.org> wrote:
> 
> The branch main has been updated by whu:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=9e772f203ff2bd296d8ef234681b6db5d43c7582
> 
> commit 9e772f203ff2bd296d8ef234681b6db5d43c7582
> Author:     Wei Hu <whu@FreeBSD.org>
> AuthorDate: 2022-08-29 06:30:49 +0000
> Commit:     Wei Hu <whu@FreeBSD.org>
> CommitDate: 2022-08-29 06:35:02 +0000
> 
>    mana: Fix a couple i386 build errors
> 
>    Fix a couple i386 build errors
> 
>    Fixes:  b685df314f138
>    Sponsored by:   Microsoft
> ---
> sys/dev/mana/mana_en.c | 6 ++++++
> 1 file changed, 6 insertions(+)
> 
> diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c
> index e504df1c8a8d..5e5e3939753f 100644
> --- a/sys/dev/mana/mana_en.c
> +++ b/sys/dev/mana/mana_en.c
> @@ -1054,8 +1054,11 @@ mana_cfg_vport(struct mana_port_context *apc, uint32_t protection_dom_id,
> 	apc->tx_shortform_allowed = resp.short_form_allowed;
> 	apc->tx_vp_offset = resp.tx_vport_offset;
> 
> +#if defined(__amd64__)
> 	if_printf(apc->ndev, "Configured vPort %lu PD %u DB %u\n",
> 	    apc->port_handle, protection_dom_id, doorbell_pg_id);
> +#endif
> +
> out:
> 	if (err)
> 		mana_uncfg_vport(apc);
> @@ -1124,8 +1127,11 @@ mana_cfg_vport_steering(struct mana_port_context *apc,
> 		err = EPROTO;
> 	}
> 
> +#if defined(__amd64__)
> 	if_printf(ndev, "Configured steering vPort %lu entries %u\n",
> 	    apc->port_handle, num_entries);
> +#endif
> +
> out:
> 	free(req, M_DEVBUF);
> 	return err;

This is highly dubious. Why not fix the code to work for 32-bit? It
seems the only problem is port_handle is a uint64_t not unsigned long,
so you either need to use PRIu64 or cast to something like uintmax_t
and use %ju. Just closing your eyes and ifdef’ing out printfs for i386
isn’t the right approach.

Jess