From: Patrick McHardy <kaber@trash.net>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Sergey Lapin <slapin@ossfans.org>
Subject: Re: [PATCH 4/5] ieee802154: add virtual loopback driver
Date: Thu, 18 Jun 2009 18:14:38 +0200 [thread overview]
Message-ID: <4A3A67EE.3000809@trash.net> (raw)
In-Reply-To: <1245335177-16810-5-git-send-email-dbaryshkov@gmail.com>
Dmitry Eremin-Solenikov wrote:
> fakelb is a virtual loopback driver implementing one or several
> interconnected radios. Packets from the radio are either sent
> back to the node (if no other fake radio are registered) or to
> all other fake radio.
>
> +static ssize_t
> +adddev_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t n)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct fake_priv *priv = platform_get_drvdata(pdev);
> + char hw[8] = {};
> + int i, j, ch, err;
> +
> + for (i = 0, j = 0; i < 16 && j < n; j++) {
> + ch = buf[j];
> + switch (buf[j]) {
> + default:
> + return -EINVAL;
> + case '0'...'9':
> + ch -= '0';
> + break;
> + case 'A'...'F':
> + ch -= 'A' - 10;
> + break;
> + case 'a'...'f':
> + ch -= 'a' - 10;
> + break;
> + case ':':
> + case '.':
> + continue;
> + }
> + if (i % 2)
> + hw[i/2] = (hw[i/2] & 0xf0) | ch;
> + else
> + hw[i/2] = ch << 4;
> + i++;
> + }
> + if (i != 16)
> + return -EINVAL;
> + err = ieee802154fake_add_priv(dev, priv, hw);
> + if (err)
> + return err;
> + return n;
> +}
> +
> +static DEVICE_ATTR(adddev, 0200, NULL, adddev_store);
> +
> +static struct attribute *fake_attrs[] = {
> + &dev_attr_adddev.attr,
> + NULL,
> +};
No new sysfs interfaces for network device creation please.
Please use the rtnl_link API.
next prev parent reply other threads:[~2009-06-18 16:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-18 14:26 Dmitry Eremin-Solenikov
2009-06-18 14:26 ` [PATCH 1/5] ieee802154: use standard routine for printing dumps Dmitry Eremin-Solenikov
2009-06-18 14:26 ` [PATCH 2/5] crc-itu-t: add bit-reversed calculation Dmitry Eremin-Solenikov
2009-06-18 14:26 ` [PATCH 3/5] mac802154: add a software MAC 802.15.4 implementation Dmitry Eremin-Solenikov
2009-06-18 14:26 ` [PATCH 4/5] ieee802154: add virtual loopback driver Dmitry Eremin-Solenikov
2009-06-18 14:26 ` [PATCH 5/5] MAINTAINERS: fix IEEE 802.15.4 entry Dmitry Eremin-Solenikov
2009-06-18 16:14 ` Patrick McHardy [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-05-26 11:21 [RFC][WIP] IEEE 802.15.4 implementation for Linux Dmitry Eremin-Solenikov
2009-05-26 11:23 ` [PATCH 1/5] Add constants for the ieee 802.15.4/ZigBee stack Dmitry Eremin-Solenikov
2009-05-26 11:23 ` [PATCH 2/5] net: add IEEE 802.15.4 partial implementation Dmitry Eremin-Solenikov
2009-05-26 11:23 ` [PATCH 3/5] ieee802154: add socket address family code Dmitry Eremin-Solenikov
2009-05-26 11:23 ` [PATCH 4/5] ieee802154: add virtual loopback driver Dmitry Eremin-Solenikov
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=4A3A67EE.3000809@trash.net \
--to=kaber@trash.net \
--cc=dbaryshkov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=slapin@ossfans.org \
/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.