From: Greg KH <gregkh@suse.de>
To: "Bryan O'Sullivan" <bos@pathscale.com>
Cc: rolandd@cisco.com, akpm@osdl.org, davem@davemloft.net,
linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [PATCH 8 of 20] ipath - sysfs support for core driver
Date: Thu, 9 Mar 2006 17:11:06 -0800 [thread overview]
Message-ID: <20060310011106.GD9945@suse.de> (raw)
In-Reply-To: <1123028ac13ac1de2457.1141950938@eng-12.pathscale.com>
On Thu, Mar 09, 2006 at 04:35:38PM -0800, Bryan O'Sullivan wrote:
> +static ssize_t show_node_info(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + static const size_t count = 10;
> + struct ipath_devdata *dd = dev_get_drvdata(dev);
> + u32 *nodeinfo;
> + int ret;
> +
> + if (!dd->ipath_statusp) {
> + ret = -EINVAL;
> + goto bail;
> + }
> +
> + nodeinfo = (u32 *) buf;
> +
> + /* so we only initialize non-zero fields. */
> + memset(nodeinfo, 0, count * sizeof(u32));
> +
> + nodeinfo[0] = /* BaseVersion is SMA */
> + /* ClassVersion is SMA */
> + (1 << 8) /* NodeType */
> + |(1 << 0); /* NumPorts */
> + nodeinfo[1] = (u32) (dd->ipath_guid >> 32);
> + nodeinfo[2] = (u32) (dd->ipath_guid & 0xffffffff);
> + /* PortGUID == SystemImageGUID for us */
> + nodeinfo[3] = nodeinfo[1];
> + /* PortGUID == SystemImageGUID for us */
> + nodeinfo[4] = nodeinfo[2];
> + /* PortGUID == NodeGUID for us */
> + nodeinfo[5] = nodeinfo[3];
> + /* PortGUID == NodeGUID for us */
> + nodeinfo[6] = nodeinfo[4];
> + nodeinfo[7] = (4 << 16) /* we support 4 pkeys */
> + |(dd->ipath_deviceid << 0);
> + /* our chip version as 16 bits major, 16 bits minor */
> + nodeinfo[8] = dd->ipath_minrev | (dd->ipath_majrev << 16);
> + nodeinfo[9] = (dd->ipath_unit << 24) | (dd->ipath_vendorid << 0);
> +
> + ret = count * sizeof(u32);
> +bail:
> + return ret;
> +}
> +
> +static ssize_t show_port_info(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + static const size_t count = 13;
> + int ret;
> + u32 tmp, tmp2;
> + struct ipath_devdata *dd = dev_get_drvdata(dev);
> + u32 *portinfo;
> +
> + if (!dd->ipath_statusp) {
> + ret = -EINVAL;
> + goto bail;
> + }
> +
> + portinfo = (u32 *) buf;
> +
> + /* so we only initialize non-zero fields. */
> + memset(portinfo, 0, count * sizeof portinfo);
> +
> + /*
> + * Notimpl yet M_Key (64)
> + * Notimpl yet GID (64)
> + */
> +
> + portinfo[4] = (dd->ipath_lid << 16);
> +
> + /*
> + * Notimpl yet SMLID (should we store this in the driver, in case
> + * SMA dies?) CapabilityMask is 0, we don't support any of these
> + * DiagCode is 0; we don't store any diag info for now Notimpl yet
> + * M_KeyLeasePeriod (we don't support M_Key)
> + */
> +
> + /* LocalPortNum is whichever port number they ask for */
> + portinfo[7] = (dd->ipath_unit << 24)
> + /* LinkWidthEnabled */
> + | (2 << 16)
> + /* LinkWidthSupported (really 2, but not IB valid) */
> + | (3 << 8)
> + /* LinkWidthActive */
> + | (2 << 0);
> + tmp = dd->ipath_lastibcstat & IPATH_IBSTATE_MASK;
> + tmp2 = 5;
> + if (tmp == IPATH_IBSTATE_INIT)
> + tmp = 2;
> + else if (tmp == IPATH_IBSTATE_ARM)
> + tmp = 3;
> + else if (tmp == IPATH_IBSTATE_ACTIVE)
> + tmp = 4;
> + else {
> + tmp = 0; /* down */
> + tmp2 = tmp & 0xf;
> + }
> +
> + portinfo[8] = (1 << 28) /* LinkSpeedSupported */
> + |(tmp << 24) /* PortState */
> + |(tmp2 << 20) /* PortPhysicalState */
> + |(2 << 16)
> +
> + /* LinkDownDefaultState */
> + /* M_KeyProtectBits == 0 */
> + /* NotImpl yet LMC == 0 (we can support all values) */
> + | (1 << 4) /* LinkSpeedActive */
> + |(1 << 0); /* LinkSpeedEnabled */
> + switch (dd->ipath_ibmtu) {
> + case 4096:
> + tmp = 5;
> + break;
> + case 2048:
> + tmp = 4;
> + break;
> + case 1024:
> + tmp = 3;
> + break;
> + case 512:
> + tmp = 2;
> + break;
> + case 256:
> + tmp = 1;
> + break;
> + default: /* oops, something is wrong */
> + ipath_dbg("Problem, ipath_ibmtu 0x%x not a valid IB MTU, "
> + "treat as 2048\n", dd->ipath_ibmtu);
> + tmp = 4;
> + break;
> + }
> + portinfo[9] = (tmp << 28)
> + /* NeighborMTU */
> + /* Notimpl MasterSMSL */
> + | (1 << 20)
> +
> + /* VLCap */
> + /* Notimpl InitType (actually, an SMA decision) */
> + /* VLHighLimit is 0 (only one VL) */
> + ; /* VLArbitrationHighCap is 0 (only one VL) */
> + portinfo[10] = /* VLArbitrationLowCap is 0 (only one VL) */
> + /* InitTypeReply is SMA decision */
> + (5 << 16) /* MTUCap 4096 */
> + |(7 << 13) /* VLStallCount */
> + |(0x1f << 8) /* HOQLife */
> + |(1 << 4)
> +
> + /* OperationalVLs 0 */
> + /* PartitionEnforcementInbound */
> + /* PartitionEnforcementOutbound not enforced */
> + /* FilterRawinbound not enforced */
> + ; /* FilterRawOutbound not enforced */
> + /* M_KeyViolations are not counted by hardware, SMA can count */
> + tmp = ipath_read_creg32(dd, dd->ipath_cregs->cr_errpkey);
> + /* P_KeyViolations are counted by hardware. */
> + portinfo[11] = ((tmp & 0xffff) << 0);
> + portinfo[12] =
> + /* Q_KeyViolations are not counted by hardware */
> + (1 << 8)
> +
> + /* GUIDCap */
> + /* SubnetTimeOut handled by SMA */
> + /* RespTimeValue handled by SMA */
> + ;
> + /* LocalPhyErrors are programmed to max */
> + portinfo[12] |= (0xf << 20)
> + | (0xf << 16) /* OverRunErrors are programmed to max */
> + ;
> +
> + ret = count * sizeof(u32);
> +bail:
> + return ret;
> +}
These two files sure do show a lot of different stuff, all in a
predefined structure for a single file. Please break them up into the
different individual files please.
thanks,
greg k-h
next prev parent reply other threads:[~2006-03-10 1:11 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-10 0:35 [PATCH 0 of 20] [RFC] ipath driver - another round for review Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 1 of 20] ipath - core driver header files Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 2 of 20] ipath - core device driver Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 3 of 20] ipath - copy and send routines for sending an skb Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 4 of 20] ipath - support for HyperTransport devices Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 5 of 20] ipath - support for PCI Express devices Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 6 of 20] ipath - chip initialisation code Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 7 of 20] ipath - misc driver support code Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 8 of 20] ipath - sysfs support for core driver Bryan O'Sullivan
2006-03-10 1:11 ` Greg KH [this message]
2006-03-10 5:09 ` Bryan O'Sullivan
2006-03-05 3:08 ` Pavel Machek
2006-03-10 6:37 ` Greg KH
2006-03-10 14:59 ` Roland Dreier
2006-03-10 15:08 ` [openib-general] " Hal Rosenstock
2006-03-10 16:54 ` Greg KH
2006-03-10 17:05 ` Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 9 of 20] ipath - char devices for diagnostics and lightweight subnet management Bryan O'Sullivan
2006-03-10 0:45 ` Roland Dreier
2006-03-10 0:47 ` Bryan O'Sullivan
2006-03-10 0:52 ` Roland Dreier
2006-03-10 0:35 ` [PATCH 10 of 20] ipath - support for userspace apps using core driver Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 11 of 20] ipath - layering interfaces used by higher-level driver code Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 12 of 20] ipath - infiniband header files Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 13 of 20] ipath - infiniband UC and UD protocol support Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 14 of 20] ipath - infiniband RC " Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 15 of 20] ipath - misc infiniband code, part 1 Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 16 of 20] ipath - misc infiniband code, part 2 Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 17 of 20] ipath - infiniband verbs support Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 18 of 20] ipath - kbuild infrastructure Bryan O'Sullivan
2006-03-13 18:10 ` Adrian Bunk
2006-03-13 18:38 ` Robert Walsh
2006-03-13 19:24 ` Bryan O'Sullivan
2006-03-13 19:36 ` Sam Ravnborg
2006-03-13 19:39 ` Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 19 of 20] ipath - integrate driver into infiniband " Bryan O'Sullivan
2006-03-10 0:35 ` [PATCH 20 of 20] ipath - ethernet emulation driver Bryan O'Sullivan
2006-03-10 15:35 ` [openib-general] [PATCH 0 of 20] [RFC] ipath driver - another round for review Michael S. Tsirkin
2006-03-10 16:02 ` Bryan O'Sullivan
2006-03-10 17:48 ` Grant Grundler
2006-03-10 17:54 ` Bryan O'Sullivan
2006-03-10 22:30 ` Grant Grundler
2006-03-11 4:20 ` Bryan O'Sullivan
[not found] <ef8042c934401522ed3f.1141922821@localhost.localdomain>
2006-03-09 23:18 ` [PATCH 8 of 20] ipath - sysfs support for core driver Roland Dreier
2006-03-09 23:32 ` Bryan O'Sullivan
2006-03-09 23:46 ` Greg KH
2006-03-09 23:48 ` Roland Dreier
2006-03-09 23:59 ` Bryan O'Sullivan
2006-03-10 1:02 ` Greg KH
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=20060310011106.GD9945@suse.de \
--to=gregkh@suse.de \
--cc=akpm@osdl.org \
--cc=bos@pathscale.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=rolandd@cisco.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
Powered by JetHome