lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MN2PR21MB129535044483127ED5B413BFCA4D9@MN2PR21MB1295.namprd21.prod.outlook.com>
Date:   Thu, 15 Apr 2021 21:08:58 +0000
From:   Haiyang Zhang <haiyangz@...rosoft.com>
To:     Stephen Hemminger <stephen@...workplumber.org>,
        Dexuan Cui <decui@...rosoft.com>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        KY Srinivasan <kys@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        Wei Liu <liuwe@...rosoft.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "leon@...nel.org" <leon@...nel.org>,
        "andrew@...n.ch" <andrew@...n.ch>,
        "bernd@...rovitsch.priv.at" <bernd@...rovitsch.priv.at>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>,
        Shachar Raindel <shacharr@...rosoft.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
Subject: RE: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure
 Network Adapter (MANA)



> -----Original Message-----
> From: Stephen Hemminger <stephen@...workplumber.org>
> Sent: Thursday, April 15, 2021 5:08 PM
> To: Dexuan Cui <decui@...rosoft.com>
> Cc: davem@...emloft.net; kuba@...nel.org; KY Srinivasan
> <kys@...rosoft.com>; Haiyang Zhang <haiyangz@...rosoft.com>; Stephen
> Hemminger <sthemmin@...rosoft.com>; wei.liu@...nel.org; Wei Liu
> <liuwe@...rosoft.com>; netdev@...r.kernel.org; leon@...nel.org;
> andrew@...n.ch; bernd@...rovitsch.priv.at; rdunlap@...radead.org;
> Shachar Raindel <shacharr@...rosoft.com>; linux-kernel@...r.kernel.org;
> linux-hyperv@...r.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@...rosoft.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ