From: Haiyang Zhang <haiyangz@microsoft.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
Dexuan Cui <decui@microsoft.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
KY Srinivasan <kys@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
Wei Liu <liuwe@microsoft.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"leon@kernel.org" <leon@kernel.org>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"bernd@petrovitsch.priv.at" <bernd@petrovitsch.priv.at>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
Shachar Raindel <shacharr@microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>
Subject: RE: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)
Date: Thu, 15 Apr 2021 21:08:58 +0000 [thread overview]
Message-ID: <MN2PR21MB129535044483127ED5B413BFCA4D9@MN2PR21MB1295.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20210415140740.7fac720e@hermes.local>
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Thursday, April 15, 2021 5:08 PM
> To: Dexuan Cui <decui@microsoft.com>
> Cc: davem@davemloft.net; kuba@kernel.org; KY Srinivasan
> <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>; Stephen
> Hemminger <sthemmin@microsoft.com>; wei.liu@kernel.org; Wei Liu
> <liuwe@microsoft.com>; netdev@vger.kernel.org; leon@kernel.org;
> andrew@lunn.ch; bernd@petrovitsch.priv.at; rdunlap@infradead.org;
> Shachar Raindel <shacharr@microsoft.com>; linux-kernel@vger.kernel.org;
> linux-hyperv@vger.kernel.org
> Subject: Re: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure
> Network Adapter (MANA)
>
> On Wed, 14 Apr 2021 22:45:19 -0700
> Dexuan Cui <decui@microsoft.com> wrote:
>
> > +static int mana_query_vport_cfg(struct mana_port_context *apc, u32
> vport_index,
> > + u32 *max_sq, u32 *max_rq, u32
> *num_indir_entry) {
> > + struct mana_query_vport_cfg_resp resp = {};
> > + struct mana_query_vport_cfg_req req = {};
> > + int err;
> > +
> > + mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_VPORT_CONFIG,
> > + sizeof(req), sizeof(resp));
> > +
> > + req.vport_index = vport_index;
> > +
> > + err = mana_send_request(apc->ac, &req, sizeof(req), &resp,
> > + sizeof(resp));
> > + if (err)
> > + return err;
> > +
> > + err = mana_verify_resp_hdr(&resp.hdr,
> MANA_QUERY_VPORT_CONFIG,
> > + sizeof(resp));
> > + if (err)
> > + return err;
> > +
> > + if (resp.hdr.status)
> > + return -EPROTO;
> > +
> > + *max_sq = resp.max_num_sq;
> > + *max_rq = resp.max_num_rq;
> > + *num_indir_entry = resp.num_indirection_ent;
> > +
> > + apc->port_handle = resp.vport;
> > + memcpy(apc->mac_addr, resp.mac_addr, ETH_ALEN);
>
> You could use ether_addr_copy here.
>
>
> > +int mana_do_attach(struct net_device *ndev, enum mana_attach_caller
> > +caller) {
> > + struct mana_port_context *apc = netdev_priv(ndev);
> > + struct gdma_dev *gd = apc->ac->gdma_dev;
> > + u32 max_txq, max_rxq, max_queues;
> > + int port_idx = apc->port_idx;
> > + u32 num_indirect_entries;
> > + int err;
> > +
> > + if (caller == MANA_OPEN)
> > + goto start_open;
> > +
> > + err = mana_init_port_context(apc);
> > + if (err)
> > + return err;
> > +
> > + err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq,
> > + &num_indirect_entries);
> > + if (err) {
> > + netdev_err(ndev, "Failed to query info for vPort 0\n");
> > + goto reset_apc;
> > + }
> > +
> > + max_queues = min_t(u32, max_txq, max_rxq);
> > + if (apc->max_queues > max_queues)
> > + apc->max_queues = max_queues;
> > +
> > + if (apc->num_queues > apc->max_queues)
> > + apc->num_queues = apc->max_queues;
> > +
> > + memcpy(ndev->dev_addr, apc->mac_addr, ETH_ALEN);
>
> And here use ether_addr_copy().
Thanks, I will update these.
- Haiyang
next prev parent reply other threads:[~2021-04-15 21:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-15 5:45 [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Dexuan Cui
2021-04-15 17:44 ` Jakub Kicinski
2021-04-15 18:14 ` Dexuan Cui
2021-04-15 21:07 ` Stephen Hemminger
2021-04-15 21:08 ` Haiyang Zhang [this message]
2021-04-15 21:15 ` Stephen Hemminger
2021-04-15 21:27 ` Dexuan Cui
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=MN2PR21MB129535044483127ED5B413BFCA4D9@MN2PR21MB1295.namprd21.prod.outlook.com \
--to=haiyangz@microsoft.com \
--cc=andrew@lunn.ch \
--cc=bernd@petrovitsch.priv.at \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuwe@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=shacharr@microsoft.com \
--cc=stephen@networkplumber.org \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@kernel.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).