From: Stephen Hemminger <stephen@networkplumber.org>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, e1000-devel@lists.sourceforge.net,
netdev@vger.kernel.org,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
gospo@redhat.com, sassmann@redhat.com
Subject: Re: [E1000-devel] [net-next v4 7/8] i40e: sysfs and debugfs interfaces
Date: Wed, 4 Sep 2013 17:37:59 -0700 [thread overview]
Message-ID: <20130904173759.7c2eec52@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1378336629-24224-8-git-send-email-jeffrey.t.kirsher@intel.com>
I don't think you need this. If you put a NULL pointer in for the __ATTR()
then it will do the right thing for you.
> +/**
> + * i40e_sys_store_ro - callback for readonly attributes in sysfs
> + * @kobj: object in the sysfs model
> + * @attr: attribute being read
> + * @buf: buffer to put data
> + * @count: buffer size
> + **/
> +static ssize_t i40e_sys_store_ro(struct kobject *kobj,
> + struct kobj_attribute *attr,
> + const char *buf, size_t count)
> +{
> + return -1;
> +}
> +
These are bogus, just return an error code or make don't define
the file in the first place. Returning error in contents
is not useful for programmatic usage.
> +
> +/**
> + * i40e_sys_veb_svlan_read - read the VEB svlan
> + **/
> +static ssize_t i40e_sys_veb_svlan_read(struct kobject *kobj,
> + struct kobj_attribute *attr,
> + char *buf)
> +{
> + return snprintf(buf, PAGE_SIZE, "(not implemented)\n");
> +}
> +
The store routines should all be checking for permissions.
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;
The sysfs API is doing writes to device state without locking.
You probably want to do:
if (!rtnl_trylock())
return restart_syscall();
...
rtnl_unlock();
Also, anything in sysfs is device specific and you really need to make
a strong case for why your device is special and needs an exception.
Other devices will have hardware switches and doing something through
sysfs is going to create a pain for any controller application.
I vote against including the sysfs VEB stuff because it will become
a lifetime ABI.
next prev parent reply other threads:[~2013-09-05 0:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 23:17 [net-next v4 0/8][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-09-04 23:17 ` [net-next v4 1/7] i40e: main driver core Jeff Kirsher
2013-09-05 16:26 ` Stephen Hemminger
2013-09-05 17:59 ` Nelson, Shannon
2013-09-04 23:17 ` [net-next v4 2/8] i40e: transmit, receive, and napi Jeff Kirsher
2013-09-04 23:17 ` [net-next v4 3/8] i40e: driver ethtool core Jeff Kirsher
2013-09-04 23:17 ` [net-next v4 4/8] i40e: driver core headers Jeff Kirsher
2013-09-04 23:17 ` [net-next v4 5/8] i40e: implement virtual device interface Jeff Kirsher
2013-09-04 23:17 ` [net-next v4 6/8] i40e: init code and hardware support Jeff Kirsher
2013-09-04 23:17 ` [net-next v4 7/8] i40e: sysfs and debugfs interfaces Jeff Kirsher
2013-09-05 0:37 ` Stephen Hemminger [this message]
2013-09-05 1:25 ` [E1000-devel] " Nelson, Shannon
2013-09-05 3:19 ` David Miller
2013-09-05 4:08 ` Brandeburg, Jesse
2013-09-05 4:37 ` David Miller
2013-09-06 3:09 ` Nelson, Shannon
2013-09-05 4:55 ` Stephen Hemminger
2013-09-05 11:10 ` Bjørn Mork
2013-09-05 15:21 ` Stephen Hemminger
2013-09-05 17:53 ` Nelson, Shannon
2013-09-05 18:32 ` [E1000-devel] " Stephen Hemminger
2013-09-05 23:38 ` John Fastabend
2013-09-04 23:17 ` [net-next v4 8/8] i40e: include i40e in kernel proper Jeff Kirsher
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=20130904173759.7c2eec52@nehalam.linuxnetplumber.net \
--to=stephen@networkplumber.org \
--cc=davem@davemloft.net \
--cc=e1000-devel@lists.sourceforge.net \
--cc=gospo@redhat.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.