* linux-next: manual merge of the rr tree with the net tree
@ 2010-04-27 1:58 Stephen Rothwell
2010-04-27 4:09 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2010-04-27 1:58 UTC (permalink / raw)
To: Rusty Russell
Cc: linux-next, linux-kernel, Michael S. Tsirkin, David Miller,
netdev
Hi Rusty,
Today's linux-next merge of the rr tree got a conflict in
drivers/net/virtio_net.c between commit
5e01d2f91df62be4d6f282149bc2a8858992ceca ("virtio-net: move sg off
stack") from the net tree and commit
7f62a724a65f864d84f50857bbfd36c240155c8f ("virtio_net: use virtqueue_xxx
wrappers") from the rr tree.
I fixed it up (see below) and can carry the fix as necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/net/virtio_net.c
index b0a85d0,91738d8..0000000
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@@ -336,11 -335,11 +336,11 @@@ static int add_recvbuf_small(struct vir
skb_put(skb, MAX_PACKET_LEN);
hdr = skb_vnet_hdr(skb);
- sg_set_buf(sg, &hdr->hdr, sizeof hdr->hdr);
+ sg_set_buf(vi->rx_sg, &hdr->hdr, sizeof hdr->hdr);
- skb_to_sgvec(skb, sg + 1, 0, skb->len);
+ skb_to_sgvec(skb, vi->rx_sg + 1, 0, skb->len);
- err = vi->rvq->vq_ops->add_buf(vi->rvq, vi->rx_sg, 0, 2, skb);
- err = virtqueue_add_buf(vi->rvq, sg, 0, 2, skb);
++ err = virtqueue_add_buf(vi->rvq, vi->rx_sg, 0, 2, skb);
if (err < 0)
dev_kfree_skb(skb);
@@@ -385,7 -386,7 +385,7 @@@ static int add_recvbuf_big(struct virtn
/* chain first in list head */
first->private = (unsigned long)list;
- err = vi->rvq->vq_ops->add_buf(vi->rvq, vi->rx_sg, 0, MAX_SKB_FRAGS + 2,
- err = virtqueue_add_buf(vi->rvq, sg, 0, MAX_SKB_FRAGS + 2,
++ err = virtqueue_add_buf(vi->rvq, vi->rx_sg, 0, MAX_SKB_FRAGS + 2,
first);
if (err < 0)
give_pages(vi, first);
@@@ -402,9 -404,9 +402,9 @@@ static int add_recvbuf_mergeable(struc
if (!page)
return -ENOMEM;
- sg_init_one(&sg, page_address(page), PAGE_SIZE);
+ sg_init_one(vi->rx_sg, page_address(page), PAGE_SIZE);
- err = vi->rvq->vq_ops->add_buf(vi->rvq, vi->rx_sg, 0, 1, page);
- err = virtqueue_add_buf(vi->rvq, &sg, 0, 1, page);
++ err = virtqueue_add_buf(vi->rvq, vi->rx_sg, 0, 1, page);
if (err < 0)
give_pages(vi, page);
@@@ -549,13 -554,12 +549,12 @@@ static int xmit_skb(struct virtnet_inf
/* Encode metadata header at front. */
if (vi->mergeable_rx_bufs)
- sg_set_buf(sg, &hdr->mhdr, sizeof hdr->mhdr);
+ sg_set_buf(vi->tx_sg, &hdr->mhdr, sizeof hdr->mhdr);
else
- sg_set_buf(sg, &hdr->hdr, sizeof hdr->hdr);
+ sg_set_buf(vi->tx_sg, &hdr->hdr, sizeof hdr->hdr);
- hdr->num_sg = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
- return virtqueue_add_buf(vi->svq, sg, hdr->num_sg, 0, skb);
+ hdr->num_sg = skb_to_sgvec(skb, vi->tx_sg + 1, 0, skb->len) + 1;
- return vi->svq->vq_ops->add_buf(vi->svq, vi->tx_sg, hdr->num_sg,
- 0, skb);
++ return virtqueue_add_buf(vi->svq, vi->tx_sg, hdr->num_sg, 0, skb);
}
static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: linux-next: manual merge of the rr tree with the net tree
2010-04-27 1:58 linux-next: manual merge of the rr tree with the net tree Stephen Rothwell
@ 2010-04-27 4:09 ` Michael S. Tsirkin
2010-04-28 15:54 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2010-04-27 4:09 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Rusty Russell, linux-next, linux-kernel, David Miller, netdev
On Tue, Apr 27, 2010 at 11:58:52AM +1000, Stephen Rothwell wrote:
> Hi Rusty,
>
> Today's linux-next merge of the rr tree got a conflict in
> drivers/net/virtio_net.c between commit
> 5e01d2f91df62be4d6f282149bc2a8858992ceca ("virtio-net: move sg off
> stack") from the net tree and commit
> 7f62a724a65f864d84f50857bbfd36c240155c8f ("virtio_net: use virtqueue_xxx
> wrappers") from the rr tree.
>
> I fixed it up (see below) and can carry the fix as necessary.
Hmm, Rusty, do you intend for the patches to go through netdev this
time? If you do, it might be simplest to just ask Dave to merge
them in net-next-2.6 now. I can prepare and send them if you like.
> --
> Cheers,
> Stephen Rothwell sfr@canb.auug.org.au
>
> diff --cc drivers/net/virtio_net.c
> index b0a85d0,91738d8..0000000
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@@ -336,11 -335,11 +336,11 @@@ static int add_recvbuf_small(struct vir
> skb_put(skb, MAX_PACKET_LEN);
>
> hdr = skb_vnet_hdr(skb);
> - sg_set_buf(sg, &hdr->hdr, sizeof hdr->hdr);
> + sg_set_buf(vi->rx_sg, &hdr->hdr, sizeof hdr->hdr);
>
> - skb_to_sgvec(skb, sg + 1, 0, skb->len);
> + skb_to_sgvec(skb, vi->rx_sg + 1, 0, skb->len);
>
> - err = vi->rvq->vq_ops->add_buf(vi->rvq, vi->rx_sg, 0, 2, skb);
> - err = virtqueue_add_buf(vi->rvq, sg, 0, 2, skb);
> ++ err = virtqueue_add_buf(vi->rvq, vi->rx_sg, 0, 2, skb);
> if (err < 0)
> dev_kfree_skb(skb);
>
> @@@ -385,7 -386,7 +385,7 @@@ static int add_recvbuf_big(struct virtn
>
> /* chain first in list head */
> first->private = (unsigned long)list;
> - err = vi->rvq->vq_ops->add_buf(vi->rvq, vi->rx_sg, 0, MAX_SKB_FRAGS + 2,
> - err = virtqueue_add_buf(vi->rvq, sg, 0, MAX_SKB_FRAGS + 2,
> ++ err = virtqueue_add_buf(vi->rvq, vi->rx_sg, 0, MAX_SKB_FRAGS + 2,
> first);
> if (err < 0)
> give_pages(vi, first);
> @@@ -402,9 -404,9 +402,9 @@@ static int add_recvbuf_mergeable(struc
> if (!page)
> return -ENOMEM;
>
> - sg_init_one(&sg, page_address(page), PAGE_SIZE);
> + sg_init_one(vi->rx_sg, page_address(page), PAGE_SIZE);
>
> - err = vi->rvq->vq_ops->add_buf(vi->rvq, vi->rx_sg, 0, 1, page);
> - err = virtqueue_add_buf(vi->rvq, &sg, 0, 1, page);
> ++ err = virtqueue_add_buf(vi->rvq, vi->rx_sg, 0, 1, page);
> if (err < 0)
> give_pages(vi, page);
>
> @@@ -549,13 -554,12 +549,12 @@@ static int xmit_skb(struct virtnet_inf
>
> /* Encode metadata header at front. */
> if (vi->mergeable_rx_bufs)
> - sg_set_buf(sg, &hdr->mhdr, sizeof hdr->mhdr);
> + sg_set_buf(vi->tx_sg, &hdr->mhdr, sizeof hdr->mhdr);
> else
> - sg_set_buf(sg, &hdr->hdr, sizeof hdr->hdr);
> + sg_set_buf(vi->tx_sg, &hdr->hdr, sizeof hdr->hdr);
>
> - hdr->num_sg = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
> - return virtqueue_add_buf(vi->svq, sg, hdr->num_sg, 0, skb);
> + hdr->num_sg = skb_to_sgvec(skb, vi->tx_sg + 1, 0, skb->len) + 1;
> - return vi->svq->vq_ops->add_buf(vi->svq, vi->tx_sg, hdr->num_sg,
> - 0, skb);
> ++ return virtqueue_add_buf(vi->svq, vi->tx_sg, hdr->num_sg, 0, skb);
> }
>
> static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: linux-next: manual merge of the rr tree with the net tree
2010-04-27 4:09 ` Michael S. Tsirkin
@ 2010-04-28 15:54 ` Michael S. Tsirkin
2010-04-29 12:53 ` Rusty Russell
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2010-04-28 15:54 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Rusty Russell, linux-next, linux-kernel, David Miller, netdev
On Tue, Apr 27, 2010 at 07:09:13AM +0300, Michael S. Tsirkin wrote:
> On Tue, Apr 27, 2010 at 11:58:52AM +1000, Stephen Rothwell wrote:
> > Hi Rusty,
> >
> > Today's linux-next merge of the rr tree got a conflict in
> > drivers/net/virtio_net.c between commit
> > 5e01d2f91df62be4d6f282149bc2a8858992ceca ("virtio-net: move sg off
> > stack") from the net tree and commit
> > 7f62a724a65f864d84f50857bbfd36c240155c8f ("virtio_net: use virtqueue_xxx
> > wrappers") from the rr tree.
> >
> > I fixed it up (see below) and can carry the fix as necessary.
>
> Hmm, Rusty, do you intend for the patches to go through netdev this
> time? If you do, it might be simplest to just ask Dave to merge
> them in net-next-2.6 now. I can prepare and send them if you like.
For whoever develops on top of -rr, the following backports
virtio_net change from net-next. Hope this helps
commit 77416b2a007b67f92d2f7b3b1edac7405c5890f7
Author: Michael S. Tsirkin <mst@redhat.com>
Date: Wed Apr 28 18:48:27 2010 +0300
virtio-net: move sg off stack
Move sg structure off stack and into virtnet_info structure.
This helps remove extra sg_init_table calls as well as reduce
stack usage.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Conflicts:
drivers/net/virtio_net.c
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fca44b2..dc872ba 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -40,8 +40,7 @@ module_param(gso, bool, 0444);
#define VIRTNET_SEND_COMMAND_SG_MAX 2
-struct virtnet_info
-{
+struct virtnet_info {
struct virtio_device *vdev;
struct virtqueue *rvq, *svq, *cvq;
struct net_device *dev;
@@ -62,6 +61,10 @@ struct virtnet_info
/* Chain pages by the private ptr. */
struct page *pages;
+
+ /* fragments + linear part + virtio header */
+ struct scatterlist rx_sg[MAX_SKB_FRAGS + 2];
+ struct scatterlist tx_sg[MAX_SKB_FRAGS + 2];
};
struct skb_vnet_hdr {
@@ -324,10 +327,8 @@ static int add_recvbuf_small(struct virtnet_info *vi, gfp_t gfp)
{
struct sk_buff *skb;
struct skb_vnet_hdr *hdr;
- struct scatterlist sg[2];
int err;
- sg_init_table(sg, 2);
skb = netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN);
if (unlikely(!skb))
return -ENOMEM;
@@ -335,11 +336,11 @@ static int add_recvbuf_small(struct virtnet_info *vi, gfp_t gfp)
skb_put(skb, MAX_PACKET_LEN);
hdr = skb_vnet_hdr(skb);
- sg_set_buf(sg, &hdr->hdr, sizeof hdr->hdr);
+ sg_set_buf(vi->rx_sg, &hdr->hdr, sizeof hdr->hdr);
- skb_to_sgvec(skb, sg + 1, 0, skb->len);
+ skb_to_sgvec(skb, vi->rx_sg + 1, 0, skb->len);
- err = virtqueue_add_buf_gfp(vi->rvq, sg, 0, 2, skb, gfp);
+ err = virtqueue_add_buf_gfp(vi->rvq, vi->rx_sg, 0, 2, skb, gfp);
if (err < 0)
dev_kfree_skb(skb);
@@ -348,13 +349,11 @@ static int add_recvbuf_small(struct virtnet_info *vi, gfp_t gfp)
static int add_recvbuf_big(struct virtnet_info *vi, gfp_t gfp)
{
- struct scatterlist sg[MAX_SKB_FRAGS + 2];
struct page *first, *list = NULL;
char *p;
int i, err, offset;
- sg_init_table(sg, MAX_SKB_FRAGS + 2);
- /* page in sg[MAX_SKB_FRAGS + 1] is list tail */
+ /* page in vi->rx_sg[MAX_SKB_FRAGS + 1] is list tail */
for (i = MAX_SKB_FRAGS + 1; i > 1; --i) {
first = get_a_page(vi, gfp);
if (!first) {
@@ -362,7 +361,7 @@ static int add_recvbuf_big(struct virtnet_info *vi, gfp_t gfp)
give_pages(vi, list);
return -ENOMEM;
}
- sg_set_buf(&sg[i], page_address(first), PAGE_SIZE);
+ sg_set_buf(&vi->rx_sg[i], page_address(first), PAGE_SIZE);
/* chain new page in list head to match sg */
first->private = (unsigned long)list;
@@ -376,17 +375,17 @@ static int add_recvbuf_big(struct virtnet_info *vi, gfp_t gfp)
}
p = page_address(first);
- /* sg[0], sg[1] share the same page */
- /* a separated sg[0] for virtio_net_hdr only during to QEMU bug*/
- sg_set_buf(&sg[0], p, sizeof(struct virtio_net_hdr));
+ /* vi->rx_sg[0], vi->rx_sg[1] share the same page */
+ /* a separated vi->rx_sg[0] for virtio_net_hdr only due to QEMU bug */
+ sg_set_buf(&vi->rx_sg[0], p, sizeof(struct virtio_net_hdr));
- /* sg[1] for data packet, from offset */
+ /* vi->rx_sg[1] for data packet, from offset */
offset = sizeof(struct padded_vnet_hdr);
- sg_set_buf(&sg[1], p + offset, PAGE_SIZE - offset);
+ sg_set_buf(&vi->rx_sg[1], p + offset, PAGE_SIZE - offset);
/* chain first in list head */
first->private = (unsigned long)list;
- err = virtqueue_add_buf_gfp(vi->rvq, sg, 0, MAX_SKB_FRAGS + 2,
+ err = virtqueue_add_buf_gfp(vi->rvq, vi->rx_sg, 0, MAX_SKB_FRAGS + 2,
first, gfp);
if (err < 0)
give_pages(vi, first);
@@ -397,16 +396,15 @@ static int add_recvbuf_big(struct virtnet_info *vi, gfp_t gfp)
static int add_recvbuf_mergeable(struct virtnet_info *vi, gfp_t gfp)
{
struct page *page;
- struct scatterlist sg;
int err;
page = get_a_page(vi, gfp);
if (!page)
return -ENOMEM;
- sg_init_one(&sg, page_address(page), PAGE_SIZE);
+ sg_init_one(vi->rx_sg, page_address(page), PAGE_SIZE);
- err = virtqueue_add_buf_gfp(vi->rvq, &sg, 0, 1, page);
+ err = virtqueue_add_buf_gfp(vi->rvq, &vi->rx_sg, 0, 1, page);
if (err < 0)
give_pages(vi, page);
@@ -515,12 +513,9 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi)
static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
{
- struct scatterlist sg[2+MAX_SKB_FRAGS];
struct skb_vnet_hdr *hdr = skb_vnet_hdr(skb);
const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
- sg_init_table(sg, 2+MAX_SKB_FRAGS);
-
pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest);
if (skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -554,12 +549,12 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
/* Encode metadata header at front. */
if (vi->mergeable_rx_bufs)
- sg_set_buf(sg, &hdr->mhdr, sizeof hdr->mhdr);
+ sg_set_buf(vi->tx_sg, &hdr->mhdr, sizeof hdr->mhdr);
else
- sg_set_buf(sg, &hdr->hdr, sizeof hdr->hdr);
+ sg_set_buf(vi->tx_sg, &hdr->hdr, sizeof hdr->hdr);
- hdr->num_sg = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
- return virtqueue_add_buf(vi->svq, sg, hdr->num_sg, 0, skb);
+ hdr->num_sg = skb_to_sgvec(skb, vi->tx_sg + 1, 0, skb->len) + 1;
+ return virtqueue_add_buf(vi->svq, vi->tx_sg, hdr->num_sg, 0, skb);
}
static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -942,6 +937,8 @@ static int virtnet_probe(struct virtio_device *vdev)
vdev->priv = vi;
vi->pages = NULL;
INIT_DELAYED_WORK(&vi->refill, refill_work);
+ sg_init_table(vi->rx_sg, ARRAY_SIZE(vi->rx_sg));
+ sg_init_table(vi->tx_sg, ARRAY_SIZE(vi->tx_sg));
/* If we can receive ANY GSO packets, we must allocate large ones. */
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
--
MST
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: linux-next: manual merge of the rr tree with the net tree
2010-04-28 15:54 ` Michael S. Tsirkin
@ 2010-04-29 12:53 ` Rusty Russell
2010-04-29 14:06 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Rusty Russell @ 2010-04-29 12:53 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Stephen Rothwell, linux-next, linux-kernel, David Miller, netdev
On Thu, 29 Apr 2010 01:24:57 am Michael S. Tsirkin wrote:
> On Tue, Apr 27, 2010 at 07:09:13AM +0300, Michael S. Tsirkin wrote:
> > On Tue, Apr 27, 2010 at 11:58:52AM +1000, Stephen Rothwell wrote:
> > > Hi Rusty,
> > >
> > > Today's linux-next merge of the rr tree got a conflict in
> > > drivers/net/virtio_net.c between commit
> > > 5e01d2f91df62be4d6f282149bc2a8858992ceca ("virtio-net: move sg off
> > > stack") from the net tree and commit
> > > 7f62a724a65f864d84f50857bbfd36c240155c8f ("virtio_net: use virtqueue_xxx
> > > wrappers") from the rr tree.
> > >
> > > I fixed it up (see below) and can carry the fix as necessary.
> >
> > Hmm, Rusty, do you intend for the patches to go through netdev this
> > time? If you do, it might be simplest to just ask Dave to merge
> > them in net-next-2.6 now. I can prepare and send them if you like.
Naah, they hit too many random virtio drivers. It's pretty simple to keep
them separate, and once the new API is in place I'll send to Dave to merge.
It could take two cycles, but there's no huge rush.
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: linux-next: manual merge of the rr tree with the net tree
2010-04-29 12:53 ` Rusty Russell
@ 2010-04-29 14:06 ` Michael S. Tsirkin
0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2010-04-29 14:06 UTC (permalink / raw)
To: Rusty Russell
Cc: Stephen Rothwell, linux-next, linux-kernel, David Miller, netdev
On Thu, Apr 29, 2010 at 10:23:36PM +0930, Rusty Russell wrote:
> On Thu, 29 Apr 2010 01:24:57 am Michael S. Tsirkin wrote:
> > On Tue, Apr 27, 2010 at 07:09:13AM +0300, Michael S. Tsirkin wrote:
> > > On Tue, Apr 27, 2010 at 11:58:52AM +1000, Stephen Rothwell wrote:
> > > > Hi Rusty,
> > > >
> > > > Today's linux-next merge of the rr tree got a conflict in
> > > > drivers/net/virtio_net.c between commit
> > > > 5e01d2f91df62be4d6f282149bc2a8858992ceca ("virtio-net: move sg off
> > > > stack") from the net tree and commit
> > > > 7f62a724a65f864d84f50857bbfd36c240155c8f ("virtio_net: use virtqueue_xxx
> > > > wrappers") from the rr tree.
> > > >
> > > > I fixed it up (see below) and can carry the fix as necessary.
> > >
> > > Hmm, Rusty, do you intend for the patches to go through netdev this
> > > time? If you do, it might be simplest to just ask Dave to merge
> > > them in net-next-2.6 now. I can prepare and send them if you like.
>
> Naah, they hit too many random virtio drivers. It's pretty simple to keep
> them separate, and once the new API is in place I'll send to Dave to merge.
> It could take two cycles, but there's no huge rush.
>
> Cheers,
> Rusty.
Well, I'm just thinking of a way to make working on virtio-net less painful.
Maybe you could just put a copy of the two patches above on your tree?
--
MST
^ permalink raw reply [flat|nested] 6+ messages in thread
* linux-next: manual merge of the rr tree with the net tree
@ 2010-04-07 3:51 Stephen Rothwell
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2010-04-07 3:51 UTC (permalink / raw)
To: Rusty Russell
Cc: linux-next, linux-kernel, David Woodhouse, Ben Hutchings,
David Miller, netdev, Ondrej Zary
Hi Rusty,
Today's linux-next merge of the rr tree got a conflict in
include/linux/mod_devicetable.h scripts/mod/file2alias.c between commit
8626d3b4328061f5b82b11ae1d6918a0c3602f42 ("phylib: Support phy module
autoloading") from the net tree and commits
df73f69d6a29eb5a22327009627f23c7ae4be007
("modules:isapnp-mod_devicetable.h") and a8e67afa03daca8b570115ba9b33f508cc5a9133 ("MODULE_DEVICE_TABLE(isapnp, ...) does nothing") from the rr tree.
Just overlapping additions. I fixed it up (see below) and can carry the
fix as necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc include/linux/mod_devicetable.h
index 55f1f9c,e69d69f..0000000
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@@ -474,30 -474,11 +474,37 @@@ struct platform_device_id
__attribute__((aligned(sizeof(kernel_ulong_t))));
};
+#define MDIO_MODULE_PREFIX "mdio:"
+
+#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d"
+#define MDIO_ID_ARGS(_id) \
+ (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
+ ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
+ ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
+ ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
+ ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
+ ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
+ ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
+ ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
+
+/**
+ * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
+ * @phy_id: The result of
+ * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask
+ * for this PHY type
+ * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
+ * is used to terminate an array of struct mdio_device_id.
+ */
+struct mdio_device_id {
+ __u32 phy_id;
+ __u32 phy_id_mask;
+};
+
+ #define ISAPNP_ANY_ID 0xffff
+ struct isapnp_device_id {
+ unsigned short card_vendor, card_device;
+ unsigned short vendor, function;
+ kernel_ulong_t driver_data; /* data private to the driver */
+ };
+
#endif /* LINUX_MOD_DEVICETABLE_H */
diff --cc scripts/mod/file2alias.c
index 36a60a8,6494f5b..0000000
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@@ -796,28 -796,19 +796,41 @@@ static int do_platform_entry(const cha
return 1;
}
+static int do_mdio_entry(const char *filename,
+ struct mdio_device_id *id, char *alias)
+{
+ int i;
+
+ alias += sprintf(alias, MDIO_MODULE_PREFIX);
+
+ for (i = 0; i < 32; i++) {
+ if (!((id->phy_id_mask >> (31-i)) & 1))
+ *(alias++) = '?';
+ else if ((id->phy_id >> (31-i)) & 1)
+ *(alias++) = '1';
+ else
+ *(alias++) = '0';
+ }
+
+ /* Terminate the string */
+ *alias = 0;
+
+ return 1;
+}
+
+ /* looks like: "pnp:dD" */
+ static int do_isapnp_entry(const char *filename,
+ struct isapnp_device_id *id, char *alias)
+ {
+ sprintf(alias, "pnp:d%c%c%c%x%x%x%x*",
+ 'A' + ((id->vendor >> 2) & 0x3f) - 1,
+ 'A' + (((id->vendor & 3) << 3) | ((id->vendor >> 13) & 7)) - 1,
+ 'A' + ((id->vendor >> 8) & 0x1f) - 1,
+ (id->function >> 4) & 0x0f, id->function & 0x0f,
+ (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f);
+ return 1;
+ }
+
/* Ignore any prefix, eg. some architectures prepend _ */
static inline int sym_is(const char *symbol, const char *name)
{
@@@ -965,10 -956,10 +978,14 @@@ void handle_moddevtable(struct module *
do_table(symval, sym->st_size,
sizeof(struct platform_device_id), "platform",
do_platform_entry, mod);
+ else if (sym_is(symname, "__mod_mdio_device_table"))
+ do_table(symval, sym->st_size,
+ sizeof(struct mdio_device_id), "mdio",
+ do_mdio_entry, mod);
+ else if (sym_is(symname, "__mod_isapnp_device_table"))
+ do_table(symval, sym->st_size,
+ sizeof(struct isapnp_device_id), "isa",
+ do_isapnp_entry, mod);
free(zeros);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-29 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-27 1:58 linux-next: manual merge of the rr tree with the net tree Stephen Rothwell
2010-04-27 4:09 ` Michael S. Tsirkin
2010-04-28 15:54 ` Michael S. Tsirkin
2010-04-29 12:53 ` Rusty Russell
2010-04-29 14:06 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2010-04-07 3:51 Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).