From: Hariprasad Shenai <hariprasad@chelsio.com>
To: Yuval Mintz <Yuval.Mintz@qlogic.com>
Cc: netdev <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>,
"leedom@chelsio.com" <leedom@chelsio.com>,
"nirranjan@chelsio.com" <nirranjan@chelsio.com>
Subject: Re: [PATCH net-next 2/2] cxgb4: Add support for ndo_get_vf_config
Date: Wed, 24 Aug 2016 13:28:49 +0530 [thread overview]
Message-ID: <20160824075848.GA9955@hari-Latitude-E5550> (raw)
In-Reply-To: <SN2PR11MB0094F2A207BDF5404D6BCDD597EA0@SN2PR11MB0094.namprd11.prod.outlook.com>
On Wednesday, August 08/24/16, 2016 at 07:15:49 +0000, Yuval Mintz wrote:
> > +static void fill_vf_station_mac_addr(struct adapter *adap)
> > +{
> > + unsigned int i;
> > + u8 hw_addr[ETH_ALEN], macaddr[ETH_ALEN];
> > + int err;
> > + u8 *na;
> > + u16 a, b;
> > +
> > + err = t4_get_raw_vpd_params(adap, &adap->params.vpd);
> > + if (!err) {
> > + na = adap->params.vpd.na;
> > + for (i = 0; i < ETH_ALEN; i++)
> > + hw_addr[i] = (hex2val(na[2 * i + 0]) * 16 +
> > + hex2val(na[2 * i + 1]));
> > + a = (hw_addr[0] << 8) | hw_addr[1];
> > + b = (hw_addr[1] << 8) | hw_addr[2];
> > + a ^= b;
> > + a |= 0x0200; /* locally assigned Ethernet MAC address */
> > + a &= ~0x0100; /* not a multicast Ethernet MAC address */
> > + macaddr[0] = a >> 8;
> > + macaddr[1] = a & 0xff;
> > +
> > + for (i = 2; i < 5; i++)
> > + macaddr[i] = hw_addr[i + 1];
> > +
> > + for (i = 0; i < adap->num_vfs; i++) {
> > + macaddr[5] = adap->pf * 16 + i;
> > + ether_addr_copy(adap->vfinfo[i].vf_mac_addr,
> > macaddr);
> > + }
> > + }
> > +}
>
> That's some... magical magic? :-)
> But I couldn't see anywhere in the patch where this MAC is propagated
> to the VF, only to the new NDO(). Care to explain how does the VF learn it?
>
The same logic is used by the firmware to generate the MAC address for the VF.
If MAC address isn't provided through IFLA_VF_MAC. This function is only used
to populate the stationary MAC's for the VF, when user hasn't provided one.
-Hari
prev parent reply other threads:[~2016-08-24 7:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 6:50 [PATCH net-next 0/2] cxgb4: Adds support for VF mgmt ndo's Hariprasad Shenai
2016-08-24 6:50 ` [PATCH net-next 1/2] cxgb4/cxgb4vf: Add support for ndo_set_vf_vlan Hariprasad Shenai
2016-08-24 7:08 ` Yuval Mintz
2016-08-24 8:22 ` Hariprasad Shenai
2016-08-24 8:31 ` Yuval Mintz
2016-08-24 9:40 ` Hariprasad Shenai
2016-08-24 10:02 ` Yuval Mintz
2016-08-25 23:24 ` David Miller
2016-08-24 6:50 ` [PATCH net-next 2/2] cxgb4: Add support for ndo_get_vf_config Hariprasad Shenai
2016-08-24 7:15 ` Yuval Mintz
2016-08-24 7:58 ` Hariprasad Shenai [this message]
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=20160824075848.GA9955@hari-Latitude-E5550 \
--to=hariprasad@chelsio.com \
--cc=Yuval.Mintz@qlogic.com \
--cc=davem@davemloft.net \
--cc=leedom@chelsio.com \
--cc=netdev@vger.kernel.org \
--cc=nirranjan@chelsio.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