From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Zhao Subject: Re: [SR-IOV driver example 2/3] PF driver: integrate with SR-IOV core Date: Tue, 2 Dec 2008 00:46:22 +0800 Message-ID: <20081201164622.GC1464@yzhao12-linux.sh.intel.com> References: <20081121183605.GA7810@yzhao12-linux.sh.intel.com> <20081126140303.GA13641@yzhao12-linux.sh.intel.com> <20081126142156.GB13668@yzhao12-linux.sh.intel.com> <20081126165859.GA28251@kroah.com> <20081126175427.GE19881@sequoia.sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Greg KH , "xen-devel@lists.xensource.com" , "kvm@vger.kernel.org" , "matthew@wil.cx" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" To: Chris Wright Return-path: Content-Disposition: inline In-Reply-To: <20081126175427.GE19881@sequoia.sous-sol.org> Sender: linux-pci-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Thu, Nov 27, 2008 at 01:54:27AM +0800, Chris Wright wrote: > * Greg KH (greg@kroah.com) wrote: > > > +static int > > > +igb_virtual(struct pci_dev *pdev, int nr_virtfn) > > > +{ > > > + unsigned char my_mac_addr[6] = {0x00, 0xDE, 0xAD, 0xBE, 0xEF, 0xFF}; > > > + struct net_device *netdev = pci_get_drvdata(pdev); > > > + struct igb_adapter *adapter = netdev_priv(netdev); > > > + int i; > > > + > > > + if (nr_virtfn > 7) > > > + return -EINVAL; > > > > Why the check for 7? Is that the max virtual functions for this card? > > Shouldn't that be a define somewhere so it's easier to fix in future > > versions of this hardware? :) > > IIRC it's 8 for the card, 1 reserved for PF. I think both notions > should be captured w/ commented constants. You remember correctly! I'll put some comments there as suggested. Thanks, Yu