From patchwork Tue May 25 13:55:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 102208 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4PDuQMD016328 for ; Tue, 25 May 2010 13:56:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758728Ab0EYNzo (ORCPT ); Tue, 25 May 2010 09:55:44 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:33369 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758700Ab0EYNzm (ORCPT ); Tue, 25 May 2010 09:55:42 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from eli@mellanox.co.il) with SMTP; 25 May 2010 16:56:02 +0300 Received: from localhost ([10.4.1.30]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 25 May 2010 16:55:36 +0300 Date: Tue, 25 May 2010 16:55:48 +0300 From: Eli Cohen To: davem@davemloft.net Cc: netdev@vger.kernel.org, Linux RDMA list , Roland Dreier , yevgenyp@mellanox.co.il Subject: [PATCH] mlx4_en: show device's port used Message-ID: <20100525135548.GA12749@mtldesk030.lab.mtl.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-OriginalArrivalTime: 25 May 2010 13:55:36.0049 (UTC) FILETIME=[F353F610:01CAFC11] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17404.007 X-TM-AS-Result: No--10.369300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 25 May 2010 13:56:27 +0000 (UTC) diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index 73c3d20..5d6f811 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c @@ -871,6 +871,16 @@ err: return -ENOMEM; } +static ssize_t show_port(struct device *d, struct device_attribute *attr, + char *buf) +{ + struct mlx4_en_priv *priv = netdev_priv(to_net_dev(d)); + + return sprintf(buf, "%d\n", priv->port); + return 0; +} + +static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); void mlx4_en_destroy_netdev(struct net_device *dev) { @@ -1067,6 +1077,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num); en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); + err = device_create_file(&dev->dev, &dev_attr_port); + if (err) { + mlx4_err(mdev, "failed to create sysfs file\n"); + goto out; + } + priv->registered = 1; queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); return 0;