qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Peter Delevoryas <pdel@fb.com>
Cc: jasowang@redhat.com, eblake@redhat.com, armbru@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 3/4] slirp: Add mfr-id to -netdev options
Date: Sat, 18 Jun 2022 12:05:08 +0200	[thread overview]
Message-ID: <20220618100508.g7fkar6c6jvrzfwz@begin> (raw)
In-Reply-To: <20220616010526.1895564-4-pdel@fb.com>

Peter Delevoryas, le mer. 15 juin 2022 18:05:25 -0700, a ecrit:
> This lets you set the manufacturer's ID for a slirp netdev, which can be
> queried from the guest through the Get Version ID NC-SI command. For
> example, by setting the manufacturer's ID to 0x8119:
> 
>     wget https://github.com/facebook/openbmc/releases/download/openbmc-e2294ff5d31d/fby35.mtd
>     qemu-system-arm -machine fby35-bmc \
>         -drive file=fby35.mtd,format=raw,if=mtd -nographic \
>         -netdev user,id=nic,mfr-id=0x8119,hostfwd=::2222-:22 \
>         -net nic,model=ftgmac100,netdev=nic
>     ...
>     username: root
>     password: 0penBmc
>     ...
>     root@bmc-oob:~# ncsi-util 0x15
>     NC-SI Command Response:
>     cmd: GET_VERSION_ID(0x15)
>     Response: COMMAND_COMPLETED(0x0000)  Reason: NO_ERROR(0x0000)
>     Payload length = 40
> 
>     20: 0xf1 0xf0 0xf0 0x00
>     24: 0x00 0x00 0x00 0x00
>     28: 0x00 0x00 0x00 0x00
>     32: 0x00 0x00 0x00 0x00
>     36: 0x00 0x00 0x00 0x00
>     40: 0x00 0x00 0x00 0x00
>     44: 0x00 0x00 0x00 0x00
>     48: 0x00 0x00 0x00 0x00
>     52: 0x00 0x00 0x81 0x19
> 
> Signed-off-by: Peter Delevoryas <pdel@fb.com>
> ---
>  net/slirp.c   | 5 +++--
>  qapi/net.json | 5 ++++-
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/net/slirp.c b/net/slirp.c
> index 75e5ccafd9..231068c1e2 100644
> --- a/net/slirp.c
> +++ b/net/slirp.c
> @@ -413,7 +413,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
>                            const char *vnameserver, const char *vnameserver6,
>                            const char *smb_export, const char *vsmbserver,
>                            const char **dnssearch, const char *vdomainname,
> -                          const char *tftp_server_name,
> +                          const char *tftp_server_name, uint32_t mfr_id,
>                            Error **errp)
>  {
>      /* default settings according to historic slirp */
> @@ -636,6 +636,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
>      cfg.vnameserver6 = ip6_dns;
>      cfg.vdnssearch = dnssearch;
>      cfg.vdomainname = vdomainname;
> +    cfg.mfr_id = mfr_id;

You will need a #if to only include it with slirp 4.8.0 indeed.
Otherwise the mfr_id field won't exist.

In the #else part, it would probably useful to give the user at least a
warning that tells her to upgrade slirp to 4.8.0 to get the mfr_id
functionality working.

>      s->slirp = slirp_new(&cfg, &slirp_cb, s);
>      QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);
>  
> @@ -1172,7 +1173,7 @@ int net_init_slirp(const Netdev *netdev, const char *name,
>                           user->bootfile, user->dhcpstart,
>                           user->dns, user->ipv6_dns, user->smb,
>                           user->smbserver, dnssearch, user->domainname,
> -                         user->tftp_server_name, errp);
> +                         user->tftp_server_name, user->mfr_id, errp);
>  
>      while (slirp_configs) {
>          config = slirp_configs;
> diff --git a/qapi/net.json b/qapi/net.json
> index d6f7cfd4d6..efc5cb3fb6 100644
> --- a/qapi/net.json
> +++ b/qapi/net.json
> @@ -167,6 +167,8 @@
>  #
>  # @tftp-server-name: RFC2132 "TFTP server name" string (Since 3.1)
>  #
> +# @mfr-id: Manufacturer ID (Private Enterprise Number: IANA)
> +#
>  # Since: 1.2
>  ##
>  { 'struct': 'NetdevUserOptions',
> @@ -192,7 +194,8 @@
>      '*smbserver': 'str',
>      '*hostfwd':   ['String'],
>      '*guestfwd':  ['String'],
> -    '*tftp-server-name': 'str' } }
> +    '*tftp-server-name': 'str',
> +    '*mfr-id': 'uint32' } }
>  
>  ##
>  # @NetdevTapOptions:
> -- 
> 2.30.2
> 


  reply	other threads:[~2022-06-18 10:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16  1:05 [PATCH 0/4] slirp: Update submodule to include NC-SI features Peter Delevoryas
2022-06-16  1:05 ` [PATCH 1/4] slirp: Update submodule to include NC-SI updates Peter Delevoryas
2022-06-16  1:05 ` [PATCH 2/4] slirp: Update SlirpConfig version to 5 Peter Delevoryas
2022-06-18 10:03   ` Samuel Thibault
2022-06-20 21:33     ` Peter Delevoryas
2022-06-16  1:05 ` [PATCH 3/4] slirp: Add mfr-id to -netdev options Peter Delevoryas
2022-06-18 10:05   ` Samuel Thibault [this message]
2022-06-20 22:58     ` Peter Delevoryas
2022-06-20  7:16   ` Markus Armbruster
2022-06-20 21:27     ` Peter Delevoryas
2022-06-21  9:01       ` Markus Armbruster
2022-06-16  1:05 ` [PATCH 4/4] slirp: Add oob-eth-addr " Peter Delevoryas
2022-06-18 10:05   ` Samuel Thibault
2022-06-20 23:01     ` 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=20220618100508.g7fkar6c6jvrzfwz@begin \
    --to=samuel.thibault@gnu.org \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=pdel@fb.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).