mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander H Duyck <alexander.duyck@gmail.com>
To: Peter Delevoryas <peter@pjd.dev>
Cc: sam@mendozajonas.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/ncsi: Always use unicast source MAC address
Date: Tue, 13 Dec 2022 08:41:44 -0800	[thread overview]
Message-ID: <ac48b381b11c875cf36a471002658edafe04d9b9.camel@gmail.com> (raw)
In-Reply-To: <20221213004754.2633429-1-peter@pjd.dev>

On Mon, 2022-12-12 at 16:47 -0800, Peter Delevoryas wrote:
> I use QEMU for development, and I noticed that NC-SI packets get dropped by
> the Linux software bridge[1] because we use a broadcast source MAC address
> for the first few NC-SI packets.

Normally NC-SI packets should never be seen by a bridge. Isn't NC-SI
really supposed to just be between the BMC and the NIC firmware?
Depending on your setup it might make more sense to use something like
macvtap or a socket connection to just bypass the need for the bridge
entirely.

> The spec requires that the destination MAC address is FF:FF:FF:FF:FF:FF,
> but it doesn't require anything about the source MAC address as far as I
> know. From testing on a few different NC-SI NIC's (Broadcom 57502, Nvidia
> CX4, CX6) I don't think it matters to the network card. I mean, Meta has
> been using this in mass production with millions of BMC's [2].
> 
> In general, I think it's probably just a good idea to use a unicast MAC.

I'm not sure I agree there. What is the initial value of the address?
If I am not mistaken the gma_flag is used to indicate that the MAC
address has been acquired isn't it? If using the broadcast is an issue
the maybe an all 0's MAC address might be more appropriate. My main
concern would be that the dev_addr is not initialized for those first
few messages so you may be leaking information.

> This might have the effect of causing the NIC to learn 2 MAC addresses from
> an NC-SI link if the BMC uses OEM Get MAC Address commands to change its
> initial MAC address, but it shouldn't really matter. Who knows if NIC's
> even have MAC learning enabled from the out-of-band BMC link, lol.
> 
> [1]: https://tinyurl.com/4933mhaj
> [2]: https://tinyurl.com/mr3tyadb

The thing is the OpenBMC approach initializes the value themselves to
broadcast[3]. As a result the two code bases are essentially doing the
same thing since mac_addr is defaulted to the broadcast address when
the ncsi interface is registered.

[3]: tinyurl.com/mr3cxf3b

> 
> Signed-off-by: Peter Delevoryas <peter@pjd.dev>
> ---
>  net/ncsi/ncsi-cmd.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c
> index dda8b76b7798..fd090156cf0d 100644
> --- a/net/ncsi/ncsi-cmd.c
> +++ b/net/ncsi/ncsi-cmd.c
> @@ -377,15 +377,7 @@ int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca)
>  	eh = skb_push(nr->cmd, sizeof(*eh));
>  	eh->h_proto = htons(ETH_P_NCSI);
>  	eth_broadcast_addr(eh->h_dest);
> -
> -	/* If mac address received from device then use it for
> -	 * source address as unicast address else use broadcast
> -	 * address as source address
> -	 */
> -	if (nca->ndp->gma_flag == 1)
> -		memcpy(eh->h_source, nca->ndp->ndev.dev->dev_addr, ETH_ALEN);
> -	else
> -		eth_broadcast_addr(eh->h_source);
> +	memcpy(eh->h_source, nca->ndp->ndev.dev->dev_addr, ETH_ALEN);
>  
>  	/* Start the timer for the request that might not have
>  	 * corresponding response. Given NCSI is an internal


  reply	other threads:[~2022-12-13 16:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  0:47 Peter Delevoryas
2022-12-13 16:41 ` Alexander H Duyck [this message]
2022-12-16  1:07   ` Peter Delevoryas
2022-12-16  1:31     ` Peter Delevoryas
2022-12-16 18:29     ` Alexander Duyck
2022-12-17  4:20       ` Peter Delevoryas
2022-12-17 20:57         ` Alexander Duyck
2022-12-19  3:16           ` Peter Delevoryas

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=ac48b381b11c875cf36a471002658edafe04d9b9.camel@gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peter@pjd.dev \
    --cc=sam@mendozajonas.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

all inboxes | Powered by JetHome®