* [PATCH net-next 2/7] r8152: replace void * with struct r8152 *
From: Hayes Wang @ 2013-08-16 8:09 UTC (permalink / raw)
To: romieu, netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
In-Reply-To: <1376640578-4258-1-git-send-email-hayeswang@realtek.com>
Change the type of contex of tx_agg and rx_agg from void * to
staruc r8152 *.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index c13662b..a18f02d 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -329,10 +329,12 @@ struct tx_desc {
#define IPV6_CS (1 << 28) /* Calculate IPv6 checksum */
};
+struct r8152;
+
struct rx_agg {
struct list_head list;
struct urb *urb;
- void *context;
+ struct r8152 *context;
void *buffer;
void *head;
};
@@ -340,7 +342,7 @@ struct rx_agg {
struct tx_agg {
struct list_head list;
struct urb *urb;
- void *context;
+ struct r8152 *context;
void *buffer;
void *head;
u32 skb_num;
--
1.8.3.1
^ permalink raw reply related
* [PATCH net-next 1/7] r8152: remove clearing the memory to zero for netdev priv
From: Hayes Wang @ 2013-08-16 8:09 UTC (permalink / raw)
To: romieu-W8zweXLXuWQS+FvcfC7Uqw, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: nic_swsd-Rasf1IRRPZFBDgjK7y7TUQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA, Hayes Wang
Remove memset(tp, 0, sizeof(*tp));
Signed-off-by: Hayes Wang <hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
---
drivers/net/usb/r8152.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index ef2498c..c13662b 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2105,7 +2105,6 @@ static int rtl8152_probe(struct usb_interface *intf,
SET_NETDEV_DEV(netdev, &intf->dev);
tp = netdev_priv(netdev);
- memset(tp, 0, sizeof(*tp));
tp->msg_enable = 0x7FFF;
tasklet_init(&tp->tl, bottom_half, (unsigned long)tp);
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCH v3 RESEND 5/7] net: sunhme: use platform_{get,set}_drvdata()
From: David Miller @ 2013-08-16 7:32 UTC (permalink / raw)
To: clbchenlibo.chen
Cc: jg1.han, wfp5p, netdev, linux-kernel, sergei.shtylyov, lizefan
In-Reply-To: <520D8F91.2060605@huawei.com>
You can't just update one patch and resend it by itself.
You must resubmit the entire series.
^ permalink raw reply
* Re: [PATCH] vhost: Drop linux/socket.h
From: David Miller @ 2013-08-16 7:31 UTC (permalink / raw)
To: asias; +Cc: netdev, virtualization, kvm, mst
In-Reply-To: <20130816012743.GA5944@hj.localdomain>
From: Asias He <asias@redhat.com>
Date: Fri, 16 Aug 2013 09:27:43 +0800
> On Thu, Aug 15, 2013 at 02:07:40PM -0700, David Miller wrote:
>> From: Asias He <asias@redhat.com>
>> Date: Thu, 15 Aug 2013 11:20:16 +0800
>>
>> > memcpy_fromiovec is moved to lib/iovec.c. No need to include
>> > linux/socket.h for it.
>> >
>> > Signed-off-by: Asias He <asias@redhat.com>
>>
>> You can't do this.
>>
>> Because this file doesn't include the header file that
>> provides the declaration, which is linux/uio.h
>
> vhost.c includes drivers/vhost/vhost.h. In drivers/vhost/vhost.h, we
> have linux/uio.h included.
Nothing in vhost.h needs linux/uio.h right? That's very poor style,
include the header where the dependency exists which is vhost.c
^ permalink raw reply
* Re: [PATCH] ip monitor: Enable prefix labels when monitoring more than 1 object
From: Martin Schwenke @ 2013-08-16 6:52 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20130815234047.0018f3dd@nehalam.linuxnetplumber.net>
On Thu, 15 Aug 2013 23:40:47 -0700, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Thu, 15 Aug 2013 07:05:27 +1000
> Martin Schwenke <martin@meltin.net> wrote:
>
> > Prefix labelling is currently only activated when monitoring "all"
> > objects. However, the output can still be confusing when monitoring
> > more than 1 object, so enable prefix labels in this case.
> >
> > Signed-off-by: Martin Schwenke <martin@meltin.net>
>
> I understand where you are coming from, but changing the output format
> might break people with scripts doing parsing the current format.
>
> Since there is already a flag to ip monitor to put on prefix labels,
> why not just use that if you need to?
Sorry, I can't see that option in either the usage message or in the
code. In the current code the only place I can see prefix_banner
being set is in the "all" case. I think "prefix" is about monitoring
IPv6 prefixes or similar.
Perhaps I could add a "label" option instead?
> This seems like a change likely to upset more people than it pleases.
Yeah, perhaps... :-(
peace & happiness,
martin
^ permalink raw reply
* Re: [PATCH] ip monitor: Enable prefix labels when monitoring more than 1 object
From: Stephen Hemminger @ 2013-08-16 6:40 UTC (permalink / raw)
To: Martin Schwenke; +Cc: netdev
In-Reply-To: <20130815070527.1df23bea@martins.ozlabs.org>
On Thu, 15 Aug 2013 07:05:27 +1000
Martin Schwenke <martin@meltin.net> wrote:
> Prefix labelling is currently only activated when monitoring "all"
> objects. However, the output can still be confusing when monitoring
> more than 1 object, so enable prefix labels in this case.
>
> Signed-off-by: Martin Schwenke <martin@meltin.net>
I understand where you are coming from, but changing the output format
might break people with scripts doing parsing the current format.
Since there is already a flag to ip monitor to put on prefix labels,
why not just use that if you need to?
This seems like a change likely to upset more people than it pleases.
^ permalink raw reply
* Re: [PATCH net-next v2 1/3] net/usb/r8152: support aggregation
From: Francois Romieu @ 2013-08-16 5:54 UTC (permalink / raw)
To: hayeswang
Cc: netdev, 'nic_swsd', linux-kernel, linux-usb,
'David Miller'
In-Reply-To: <4C3BE5B36641404DBF9ED8943729871B@realtek.com.tw>
hayeswang <hayeswang@realtek.com> :
> Francois Romieu [mailto:romieu@fr.zoreil.com]
[...]
> > The forward declaration is not needed.
>
> The r8152_submit_rx() need the declaration of read_bulk_callback(), and the
> read_bulk_callback() need the declaration of r8152_submit_rx(), too. It likes
> a dead lock, so I have no idea how to do it without another declaration.
Ok, send me a brain for Xmas.
[...]
> > How is it related to the subject of the patch ?
>
> When link down, the driver would cancel all bulks. This avoid the re-submitting
> bulk.
It's quite orthogonal to aggregation and could thus had been done in its own
patch for readability sake.
[...]
> > It should be possible to retrieve more items in the spinlocked section
> > so as to have a chance to batch more work. I have not thought
> > too deeply
> > about it.
>
> I only lock when I want to remove or inser the agg list, and unlock as soon as
> possible. I don't think I keep locking for a long time.
Sure. It doesn't make a difference if tp->rx_done doesn't grow much.
Thanks.
--
Ueimor
^ permalink raw reply
* [PATCH 6/6] vhost_net: remove the max pending check
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1376630190-5912-1-git-send-email-jasowang@redhat.com>
We used to limit the max pending DMAs to prevent guest from pinning too many
pages. But this could be removed since:
- We have the sk_wmem_alloc check in both tun/macvtap to do the same work
- This max pending check were almost useless since it was one done when there's
no new buffers coming from guest. Guest can easily exceeds the limitation.
- We've already check upend_idx != done_idx and switch to non zerocopy then. So
even if all vq->heads were used, we can still does the packet transmission.
So remove this check completely.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index a035a89..ed3f165 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -38,8 +38,6 @@ MODULE_PARM_DESC(experimental_zcopytx, "Enable Zero Copy TX;"
* Using this limit prevents one virtqueue from starving others. */
#define VHOST_NET_WEIGHT 0x80000
-/* MAX number of TX used buffers for outstanding zerocopy */
-#define VHOST_MAX_PEND 128
#define VHOST_GOODCOPY_LEN 256
/*
@@ -372,17 +370,6 @@ static void handle_tx(struct vhost_net *net)
break;
/* Nothing new? Wait for eventfd to tell us they refilled. */
if (head == vq->num) {
- int num_pends;
-
- /* If more outstanding DMAs, queue the work.
- * Handle upend_idx wrap around
- */
- num_pends = likely(nvq->upend_idx >= nvq->done_idx) ?
- (nvq->upend_idx - nvq->done_idx) :
- (nvq->upend_idx + UIO_MAXIOV -
- nvq->done_idx);
- if (unlikely(num_pends > VHOST_MAX_PEND))
- break;
if (unlikely(vhost_enable_notify(&net->dev, vq))) {
vhost_disable_notify(&net->dev, vq);
continue;
--
1.7.1
^ permalink raw reply related
* [PATCH 5/6] vhost_net: poll vhost queue after marking DMA is done
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1376630190-5912-1-git-send-email-jasowang@redhat.com>
We used to poll vhost queue before making DMA is done, this is racy if vhost
thread were waked up before marking DMA is done which can result the signal to
be missed. Fix this by always poll the vhost thread before DMA is done.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 70cab75..a035a89 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -308,6 +308,11 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
struct vhost_virtqueue *vq = ubufs->vq;
int cnt = atomic_read(&ubufs->kref.refcount);
+ /* set len to mark this desc buffers done DMA */
+ vq->heads[ubuf->desc].len = success ?
+ VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
+ vhost_net_ubuf_put(ubufs);
+
/*
* Trigger polling thread if guest stopped submitting new buffers:
* in this case, the refcount after decrement will eventually reach 1
@@ -318,10 +323,6 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
*/
if (cnt <= 2 || !(cnt % 16))
vhost_poll_queue(&vq->poll);
- /* set len to mark this desc buffers done DMA */
- vq->heads[ubuf->desc].len = success ?
- VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
- vhost_net_ubuf_put(ubufs);
}
/* Expects to be always run from workqueue - which acts as
--
1.7.1
^ permalink raw reply related
* [PATCH 4/6] vhost_net: determine whether or not to use zerocopy at one time
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1376630190-5912-1-git-send-email-jasowang@redhat.com>
Currently, even if the packet length is smaller than VHOST_GOODCOPY_LEN, if
upend_idx != done_idx we still set zcopy_used to true and rollback this choice
later. This could be avoided by determine zerocopy once by checking all
conditions at one time before.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 46 +++++++++++++++++++---------------------------
1 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 8a6dd0d..70cab75 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -404,43 +404,35 @@ static void handle_tx(struct vhost_net *net)
iov_length(nvq->hdr, s), hdr_size);
break;
}
- zcopy_used = zcopy && (len >= VHOST_GOODCOPY_LEN ||
- nvq->upend_idx != nvq->done_idx);
+
+ zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN
+ && nvq->upend_idx != nvq->done_idx
+ && vhost_net_tx_select_zcopy(net);
/* use msg_control to pass vhost zerocopy ubuf info to skb */
if (zcopy_used) {
+ struct ubuf_info *ubuf;
+ ubuf = nvq->ubuf_info + nvq->upend_idx;
+
vq->heads[nvq->upend_idx].id = head;
- if (!vhost_net_tx_select_zcopy(net) ||
- len < VHOST_GOODCOPY_LEN) {
- /* copy don't need to wait for DMA done */
- vq->heads[nvq->upend_idx].len =
- VHOST_DMA_DONE_LEN;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- ubufs = NULL;
- } else {
- struct ubuf_info *ubuf;
- ubuf = nvq->ubuf_info + nvq->upend_idx;
-
- vq->heads[nvq->upend_idx].len =
- VHOST_DMA_IN_PROGRESS;
- ubuf->callback = vhost_zerocopy_callback;
- ubuf->ctx = nvq->ubufs;
- ubuf->desc = nvq->upend_idx;
- msg.msg_control = ubuf;
- msg.msg_controllen = sizeof(ubuf);
- ubufs = nvq->ubufs;
- kref_get(&ubufs->kref);
- }
+ vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS;
+ ubuf->callback = vhost_zerocopy_callback;
+ ubuf->ctx = nvq->ubufs;
+ ubuf->desc = nvq->upend_idx;
+ msg.msg_control = ubuf;
+ msg.msg_controllen = sizeof(ubuf);
+ ubufs = nvq->ubufs;
+ kref_get(&ubufs->kref);
nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;
- } else
+ } else {
msg.msg_control = NULL;
+ ubufs = NULL;
+ }
/* TODO: Check specific error and bomb out unless ENOBUFS? */
err = sock->ops->sendmsg(NULL, sock, &msg, len);
if (unlikely(err < 0)) {
if (zcopy_used) {
- if (ubufs)
- vhost_net_ubuf_put(ubufs);
+ vhost_net_ubuf_put(ubufs);
nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
% UIO_MAXIOV;
}
--
1.7.1
^ permalink raw reply related
* [PATCH 3/6] vhost: switch to use vhost_add_used_n()
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1376630190-5912-1-git-send-email-jasowang@redhat.com>
Let vhost_add_used() to use vhost_add_used_n() to reduce the code duplication.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/vhost.c | 43 ++-----------------------------------------
1 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index e58cf00..c479452 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1332,48 +1332,9 @@ EXPORT_SYMBOL_GPL(vhost_discard_vq_desc);
* want to notify the guest, using eventfd. */
int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
{
- struct vring_used_elem __user *used;
+ struct vring_used_elem heads = { head, len };
- /* The virtqueue contains a ring of used buffers. Get a pointer to the
- * next entry in that used ring. */
- used = &vq->used->ring[vq->last_used_idx % vq->num];
- if (__put_user(head, &used->id)) {
- vq_err(vq, "Failed to write used id");
- return -EFAULT;
- }
- if (__put_user(len, &used->len)) {
- vq_err(vq, "Failed to write used len");
- return -EFAULT;
- }
- /* Make sure buffer is written before we update index. */
- smp_wmb();
- if (__put_user(vq->last_used_idx + 1, &vq->used->idx)) {
- vq_err(vq, "Failed to increment used idx");
- return -EFAULT;
- }
- if (unlikely(vq->log_used)) {
- /* Make sure data is seen before log. */
- smp_wmb();
- /* Log used ring entry write. */
- log_write(vq->log_base,
- vq->log_addr +
- ((void __user *)used - (void __user *)vq->used),
- sizeof *used);
- /* Log used index update. */
- log_write(vq->log_base,
- vq->log_addr + offsetof(struct vring_used, idx),
- sizeof vq->used->idx);
- if (vq->log_ctx)
- eventfd_signal(vq->log_ctx, 1);
- }
- vq->last_used_idx++;
- /* If the driver never bothers to signal in a very long while,
- * used index might wrap around. If that happens, invalidate
- * signalled_used index we stored. TODO: make sure driver
- * signals at least once in 2^16 and remove this. */
- if (unlikely(vq->last_used_idx == vq->signalled_used))
- vq->signalled_used_valid = false;
- return 0;
+ return vhost_add_used_n(vq, &heads, 1);
}
EXPORT_SYMBOL_GPL(vhost_add_used);
--
1.7.1
^ permalink raw reply related
* [PATCH 2/6] vhost_net: use vhost_add_used_and_signal_n() in vhost_zerocopy_signal_used()
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1376630190-5912-1-git-send-email-jasowang@redhat.com>
Switch to use vhost_add_used_and_signal_n() to avoid multiple calls to
vhost_add_used_and_signal(). With the patch we will call at most 2 times
(consider done_idx warp around) compared to N times w/o this patch.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 280ee66..8a6dd0d 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -281,7 +281,7 @@ static void vhost_zerocopy_signal_used(struct vhost_net *net,
{
struct vhost_net_virtqueue *nvq =
container_of(vq, struct vhost_net_virtqueue, vq);
- int i;
+ int i, add;
int j = 0;
for (i = nvq->done_idx; i != nvq->upend_idx; i = (i + 1) % UIO_MAXIOV) {
@@ -289,14 +289,17 @@ static void vhost_zerocopy_signal_used(struct vhost_net *net,
vhost_net_tx_err(net);
if (VHOST_DMA_IS_DONE(vq->heads[i].len)) {
vq->heads[i].len = VHOST_DMA_CLEAR_LEN;
- vhost_add_used_and_signal(vq->dev, vq,
- vq->heads[i].id, 0);
++j;
} else
break;
}
- if (j)
- nvq->done_idx = i;
+ while (j) {
+ add = min(UIO_MAXIOV - nvq->done_idx, j);
+ vhost_add_used_and_signal_n(vq->dev, vq,
+ &vq->heads[nvq->done_idx], add);
+ nvq->done_idx = (nvq->done_idx + add) % UIO_MAXIOV;
+ j -= add;
+ }
}
static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
--
1.7.1
^ permalink raw reply related
* [PATCH 1/6] vhost_net: make vhost_zerocopy_signal_used() returns void
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1376630190-5912-1-git-send-email-jasowang@redhat.com>
None of its caller use its return value, so let it return void.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 969a859..280ee66 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -276,8 +276,8 @@ static void copy_iovec_hdr(const struct iovec *from, struct iovec *to,
* of used idx. Once lower device DMA done contiguously, we will signal KVM
* guest used idx.
*/
-static int vhost_zerocopy_signal_used(struct vhost_net *net,
- struct vhost_virtqueue *vq)
+static void vhost_zerocopy_signal_used(struct vhost_net *net,
+ struct vhost_virtqueue *vq)
{
struct vhost_net_virtqueue *nvq =
container_of(vq, struct vhost_net_virtqueue, vq);
@@ -297,7 +297,6 @@ static int vhost_zerocopy_signal_used(struct vhost_net *net,
}
if (j)
nvq->done_idx = i;
- return j;
}
static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
--
1.7.1
^ permalink raw reply related
* [PATCH 0/6] vhost code cleanup and minor enhancement
From: Jason Wang @ 2013-08-16 5:16 UTC (permalink / raw)
To: mst, kvm, virtualization, netdev, linux-kernel
Hi all:
This series tries to unify and simplify vhost codes especially for zerocopy.
Plase review.
Thanks
Jason Wang (6):
vhost_net: make vhost_zerocopy_signal_used() returns void
vhost_net: use vhost_add_used_and_signal_n() in
vhost_zerocopy_signal_used()
vhost: switch to use vhost_add_used_n()
vhost_net: determine whether or not to use zerocopy at one time
vhost_net: poll vhost queue after marking DMA is done
vhost_net: remove the max pending check
drivers/vhost/net.c | 86 +++++++++++++++++++-----------------------------
drivers/vhost/vhost.c | 43 +-----------------------
2 files changed, 36 insertions(+), 93 deletions(-)
^ permalink raw reply
* Re: Where are OVS VXLAN patches?
From: Cong Wang @ 2013-08-16 4:50 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, David S. Miller, Jesse Gross, Pravin B Shelar
In-Reply-To: <CAOaVG16Vx11DV4gxfSf2f0BceOk1y+aP6rtz-_h9b0Ckp0r2Jw@mail.gmail.com>
(Re-adding netdev and davem...)
On Thu, 2013-08-15 at 21:33 -0700, Stephen Hemminger wrote:
> Send them to netdev. The vxlan-next tree was temporary when there were
> 3 people working on VXLAN at
> same time (Pravin, ong, and me). I see no point in keeping a separate
> tree over the long term.
>
I agree. There is some misunderstanding between you and David on taking
these patches. :)
^ permalink raw reply
* Re: [PATCH net-next 2/2] ipv4: processing ancillary IP_TOS or IP_TTL
From: Eric Dumazet @ 2013-08-16 4:35 UTC (permalink / raw)
To: Francesco Fusco; +Cc: davem, netdev
In-Reply-To: <d54a214ad9301352128f2b3300c0eaf91cc6e12e.1376494032.git.ffusco@redhat.com>
On Wed, 2013-08-14 at 17:48 +0200, Francesco Fusco wrote:
> @@ -1511,6 +1517,11 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
> inet = &get_cpu_var(unicast_sock);
>
> inet->tos = arg->tos;
> +
> + ipc.tos = ip_hdr(skb)->tos;
Why both inet->tos and ipc.tos must be set ?
This is very confusing, as if you were not 100% sure of your patch.
> + ipc.ttl = inet->uc_ttl;
ipc.ttl = -1;
> + ipc.priority = skb->priority;
> +
> sk = &inet->sk;
> sk->sk_priority = skb->priority;
Why both sk->sk_priority and ipc.priority must be set ?
> sk->sk_protocol = ip_hdr(skb)->protocol;
^ permalink raw reply
* Re: [PATCH net-next 2/2] ipv4: processing ancillary IP_TOS or IP_TTL
From: Eric Dumazet @ 2013-08-16 4:26 UTC (permalink / raw)
To: Francesco Fusco; +Cc: davem, netdev
In-Reply-To: <d54a214ad9301352128f2b3300c0eaf91cc6e12e.1376494032.git.ffusco@redhat.com>
On Wed, 2013-08-14 at 17:48 +0200, Francesco Fusco wrote:
> If IP_TOS or IP_TTL are specified as ancillary data, then sendmsg() sends out
> packets with the specified TTL or TOS overriding the socket values specified
> with the traditional setsockopt().
>
> If there is a per-packet specified tos, the skb->priority is set accordingly.
> The ipv4_is_multicast() function is used to fill in the right TTL value in case
> of multicast destinations.
>
> Signed-off-by: Francesco Fusco <ffusco@redhat.com>
> ---
> @@ -1327,7 +1332,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
> iph = (struct iphdr *)skb->data;
> iph->version = 4;
> iph->ihl = 5;
> - iph->tos = inet->tos;
> + iph->tos = (cork->tos != inet->tos) ? cork->tos : inet->tos;
Strange construct, as the following has same meaning.
iph->tos = cork->tos;
^ permalink raw reply
* Re: [PATCH v4 5/5] ARM: davinci: da850: add OF_DEV_AUXDATA entry for eth0.
From: Prabhakar Lad @ 2013-08-16 4:08 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Sekhar Nori, DLOS, LKML, device-tree, LAK, netdev
In-Reply-To: <520D2CAE.3090501@cogentembedded.com>
Hi Sergei,
On Fri, Aug 16, 2013 at 1:01 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
>
> On 15-08-2013 10:01, Lad, Prabhakar wrote:
>
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>
>
>> Add OF_DEV_AUXDATA for eth0 driver in da850 board dt
>> file to use emac clock.
>
>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>
> [...]
>
>
>> diff --git a/arch/arm/mach-davinci/da8xx-dt.c
>> b/arch/arm/mach-davinci/da8xx-dt.c
>> index d172563..caa9202 100644
>> --- a/arch/arm/mach-davinci/da8xx-dt.c
>> +++ b/arch/arm/mach-davinci/da8xx-dt.c
>> @@ -44,6 +44,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[]
>> __initdata = {
>> OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL),
>> OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL),
>> OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0",
>> NULL),
>> + OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000,
>> "davinci_emac.1",
>> + NULL),
>> +
>
>
> Empty line hardly needed here.
>
Ah my bad, will fix and repost.
Regards,
--Prabhakar Lad
^ permalink raw reply
* Re: [PATCH v4 4/5] ARM: davinci: da850: add DT node for eth0.
From: Prabhakar Lad @ 2013-08-16 4:07 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Sekhar Nori, DLOS, LKML, device-tree, LAK, netdev
In-Reply-To: <520D2C50.4040902@cogentembedded.com>
Hi Sergei,
On Fri, Aug 16, 2013 at 1:00 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
>
> On 15-08-2013 10:01, Lad, Prabhakar wrote:
>
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>
>
>> Add eth0 device tree node information and pinmux for mii to da850 by
>> providing interrupt details and local mac address of eth0.
>
>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>
> [...]
>
>
>> @@ -226,6 +242,20 @@
>> #size-cells = <0>;
>> reg = <0x224000 0x1000>;
>> };
>> + eth0: emac@1e20000 {
>
>
> According to the ePAPR spec[1] section 2.2.2, the node should be named
> "ethernet".
>
Thanks for pointing it, I'll fix and repost it.
Regards,
--Prabhakar Lad
> [1] http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf
>
> WBR, Sergei
>
^ permalink raw reply
* RE: [PATCH net-next v2 1/3] net/usb/r8152: support aggregation
From: hayeswang @ 2013-08-16 3:44 UTC (permalink / raw)
To: 'Francois Romieu'
Cc: netdev, 'nic_swsd', linux-kernel, linux-usb,
'David Miller'
In-Reply-To: <20130815122617.GA18057@electric-eye.fr.zoreil.com>
Francois Romieu [mailto:romieu@fr.zoreil.com]
> Sent: Thursday, August 15, 2013 8:26 PM
> To: Hayeswang
> Cc: netdev@vger.kernel.org; nic_swsd;
> linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org; David Miller
> Subject: Re: [PATCH net-next v2 1/3] net/usb/r8152: support
> aggregation
>
[...]
> > +static
> > +int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg,
> gfp_t mem_flags);
> > +
>
> It's a new, less than 10 lines function without driver
> internal dependencies.
>
> The forward declaration is not needed.
The r8152_submit_rx() need the declaration of read_bulk_callback(), and the
read_bulk_callback() need the declaration of r8152_submit_rx(), too. It likes
a dead lock, so I have no idea how to do it without another declaration.
[...]
> > - if (!netif_device_present(netdev))
> > + if (!netif_carrier_ok(netdev))
> > return;
>
> How is it related to the subject of the patch ?
When link down, the driver would cancel all bulks. This avoid the re-submitting
bulk.
> [...]
> > +static void rx_bottom(struct r8152 *tp)
> > +{
> > + struct net_device_stats *stats;
> > + struct net_device *netdev;
> > + struct rx_agg *agg;
> > + struct rx_desc *rx_desc;
> > + unsigned long lockflags;
>
> Idiom: 'flags'.
>
> > + struct list_head *cursor, *next;
> > + struct sk_buff *skb;
> > + struct urb *urb;
> > + unsigned pkt_len;
> > + int len_used;
> > + u8 *rx_data;
> > + int ret;
>
> The scope of these variables is needlessly wide.
>
> > +
> > + netdev = tp->netdev;
> > +
> > + stats = rtl8152_get_stats(netdev);
> > +
> > + spin_lock_irqsave(&tp->rx_lock, lockflags);
> > + list_for_each_safe(cursor, next, &tp->rx_done) {
> > + list_del_init(cursor);
> > + spin_unlock_irqrestore(&tp->rx_lock, lockflags);
> > +
> > + agg = list_entry(cursor, struct rx_agg, list);
> > + urb = agg->urb;
> > + if (urb->actual_length < ETH_ZLEN) {
>
> goto submit;
>
> > + ret = r8152_submit_rx(tp, agg, GFP_ATOMIC);
> > + spin_lock_irqsave(&tp->rx_lock, lockflags);
> > + if (ret && ret != -ENODEV) {
> > + list_add_tail(&agg->list, next);
> > + tasklet_schedule(&tp->tl);
> > + }
> > + continue;
> > + }
>
> (remove the line above)
>
> [...]
> > + rx_data = rx_agg_align(rx_data + pkt_len + 4);
> > + rx_desc = (struct rx_desc *)rx_data;
> > + pkt_len = le32_to_cpu(rx_desc->opts1) &
> RX_LEN_MASK;
> > + len_used = (int)(rx_data - (u8 *)agg->head);
> > + len_used += sizeof(struct rx_desc) + pkt_len;
> > + }
> > +
>
> submit:
>
> > + ret = r8152_submit_rx(tp, agg, GFP_ATOMIC);
> > + spin_lock_irqsave(&tp->rx_lock, lockflags);
> > + if (ret && ret != -ENODEV) {
> > + list_add_tail(&agg->list, next);
> > + tasklet_schedule(&tp->tl);
> > + }
> > + }
> > + spin_unlock_irqrestore(&tp->rx_lock, lockflags);
> > +}
>
> It should be possible to retrieve more items in the spinlocked section
> so as to have a chance to batch more work. I have not thought
> too deeply
> about it.
I only lock when I want to remove or inser the agg list, and unlock as soon as
possible. I don't think I keep locking for a long time.
Best Regards,
Hayes
^ permalink raw reply
* [PATCH v3 RESEND 5/7] net: sunhme: use platform_{get,set}_drvdata()
From: Libo Chen @ 2013-08-16 2:33 UTC (permalink / raw)
To: David Miller
Cc: jg1.han, Bill Pemberton, netdev, LKML, Sergei Shtylyov, Li Zefan
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &of_dev->dev,
so we can directly pass a struct platform_device.
changelog:
remove modify about happy_meal_pci_probe && happy_meal_pci_remove
Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
drivers/net/ethernet/sun/sunhme.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index 171f5b0..b90d311 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -3231,7 +3231,7 @@ static int hme_sbus_probe(struct platform_device *op)
static int hme_sbus_remove(struct platform_device *op)
{
- struct happy_meal *hp = dev_get_drvdata(&op->dev);
+ struct happy_meal *hp = platform_get_drvdata(op);
struct net_device *net_dev = hp->dev;
unregister_netdev(net_dev);
--
1.7.1
^ permalink raw reply related
* Re: [PATCH v3 0/7] net: use platform_{get,set}_drvdata()
From: Libo Chen @ 2013-08-16 2:15 UTC (permalink / raw)
To: David Miller
Cc: netdev, lizefan, leoli, linuxppc-dev, pantelis.antoniou, vbordug,
gregkh, jg1.han, sergei.shtylyov
In-Reply-To: <20130815.153903.859166500375208182.davem@davemloft.net>
On 2013/8/16 6:39, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Thu, 15 Aug 2013 15:23:59 -0700 (PDT)
>
>> From: Libo Chen <clbchenlibo.chen@huawei.com>
>> Date: Thu, 15 Aug 2013 21:01:17 +0800
>>
>>> Use the wrapper functions for getting and setting the driver data using
>>> platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
>>> so we can directly pass a struct platform_device.
>>>
>>> changelog v3:
>>> remove modify about dev_set_drvdata()
>>> changelog v2:
>>> this version add modify record about dev_set_drvdata().
>>
>> Series applied.
>
> Actually, I had to revert, these patches break the build.
>
> drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_probe’:
> drivers/net/ethernet/sun/sunhme.c:3114:2: error: implicit declaration of function ‘platform_set_drvdata’ [-Werror=implicit-function-declaration]
> drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_remove’:
> drivers/net/ethernet/sun/sunhme.c:3162:9: error: implicit declaration of function ‘platform_get_drvdata’ [-Werror=implicit-function-declaration]
> drivers/net/ethernet/sun/sunhme.c:3162:26: warning: initialization makes pointer from integer without a cast [enabled by default]
>
oh, it is my fault, I will update!
^ permalink raw reply
* Re: [PATCH net-next] bonding: lacp_port_id setting for 802.3ad
From: Krisztian Ivancso @ 2013-08-16 2:07 UTC (permalink / raw)
To: Ding Tianhong, Jay Vosburgh; +Cc: netdev
In-Reply-To: <520AE16B.3040705@huawei.com>
On 08/14/2013 03:46 AM, Ding Tianhong wrote:
> On 2013/8/14 7:34, Krisztian Ivancso wrote:
>> On 08/13/2013 08:25 PM, Jay Vosburgh wrote:
>>> Krisztian Ivancso <github-ivan@ivancso.net> wrote:
>>>
>>>> On 08/13/2013 11:39 AM, Ding Tianhong wrote:
>>>>> On 2013/8/13 17:20, Krisztian Ivancso wrote:
>>>>>> On 08/13/2013 03:07 AM, Ding Tianhong wrote:
>>>>>>> On 2013/8/12 19:19, Krisztian Ivancso wrote:
>>>>>>>> >From 472fffa5a8f170daed9e4cc677af8e2560b86be2 Mon Sep 17 00:00:00 2001
>>>>>>>> From: Krisztian Ivancso <github-ivan@ivancso.net>
>>>>>>>> Date: Sun, 11 Aug 2013 20:30:44 +0200
>>>>>>>> Subject: [PATCH net-next] bonding: lacp_port_id setting for 802.3ad ports
>>>>>
>>>>> ok, for example: the bonding has four slave, slave1 and slave2 aggregation to 1 group,
>>>>> and slave3 and slave4 aggregtion to 2 group, how you distinguish the 1 and 2 group by initialize id.
>>>>
>>>> this is not possible, because all slave have to be a member of the same
>>>> aggregation group.
>>>
>>> Just on the above point, bonding can group slaves into multiple
>>> aggregators, but only one aggregator will be active at any given time.
>>>
>>> To answer the question, the four slaves would each be given
>>> unique port IDs that do not conflict.
>>>
>>>> i think we misunderstood each other.
>>>>
>>>> here is a new example:
>>>> - switch1 is a switch with a configured lag with two members ports
>>>> (member1 and member2)
>>>> - two linux (linux1 and linux2) box with a configured bonding device
>>>> (bond0) with the same MAC set in both box and one
>>>> slave on each
>>>> - lacp_port_id is set to 10 in linux1 and 20 in linux2
>>>>
>>>> you can attach the slave from both linux boxes to the same
>>>> lag on switch1. (slave from linux1 to port member1 and
>>>> slave from linux2 to port member2 on switch1)
>>>>
>>>> port id must be unique within a system.
>>>> bonding implementation set a unique system id for every bonding device
>>>> which is derived from MAC of one of the slave interfaces.
>>>>
>>>> if we use the current bonding implementation second linux box can't be
>>>> a member on switch1 because port id is 1 in both linux bonding device.
>>>>
>>>> if we can set different starting port id for bonding in different boxes
>>>> the second box can be a member also.
>>>
>>> I understand what you're trying to do here (permit multiple
>>> instances of bonding on different systems to connect to a single
>>> aggregator on a switch), and I don't really have a problem with it in
>>> general.
>>>
>>> I do have some comments:
>>>
>>> First, altering the lacp_port_id (via sysfs) should only be
>>> permitted when there are no slaves in the bond, otherwise the
>>> /proc/net/bonding/bond0 output for the first port id will not match the
>>> actual first port id value assigned to the slaves. As a practical
>>> matter, altering lacp_port_id while slaves are present in the bond has
>>> no effect until all slaves are released and the first new slave is
>>> added, so this is not reducing functionality.
fixed in bonding_store_lacp_port_id():
( struct slave *first_slave = bond_first_slave(bond);
if (first_slave) {
pr_err("%s: Can't set port id because device have slave(s).\n",
bond->dev->name);
return -EPERM;
}
)
>>>
>>> Second, the lacp_port_id is global across all bonds created
>>> within the loaded module, and so multiple bonds will all use the same
>>> starting value. Setting the lacp_port_id via sysfs has no effect, as it
>>> alters a per-bond value, bond->params.lacp_port_id, that is never
>>> actually used to set the port ID of a first slave in bond_enslave.
>>>
>>> The global default value should only be used to initialize the
>>> per-bond value when a bond is created, and that per-bond value should be
>>> used when setting the port id in bond_enslave(). The per-bond value is
>>> already displayed in /proc/net/bonding/bond0, and is the value modified
>>> by the sysfs functions
global default value is used to initialize bonding_defaults.lacp_port_id now.
(params->lacp_port_id = lacp_port_id;)
first slave is initialized by per-bond port id in bond_enslave().
(SLAVE_AD_INFO(new_slave).id = bond->params.lacp_port_id;)
>>>
>>> Third, consider adding the port ID to the 803.2ad section in
>>> bond_info_show_slave.
slave port id is shown in bond_info_show_slave():
(seq_printf(seq, "Slave port id: %d\n", SLAVE_AD_INFO(slave).id);)
>>
>> Thanks for these great comments. I'll soon fix sysfs related bug and
>> rework patch.
>>
>>>
>>> Lastly, I think this should be tested against systems other than
>>> Cisco to insure that it really interoperates with, for example,
>>> Juniper's methodology for spanning an aggregator across physical
>>> chassis. I'm not sure why it wouldn't, but once new functionality
>>> becomes part of the kernel, changing it in non-backwards compatible ways
>>> is difficult.
>>
>
> agreed
>
> Ding Tianhong
port id overflow check in bond_enslave():
( prev_slave = bond_prev_slave(bond, new_slave);
if (SLAVE_AD_INFO(prev_slave).id == 65535) {
pr_err("%s: Error: Couldn't add new slave (%s) because maximum port id (65535) is reached.\n",
bond_dev->name, slave_dev->name);
res = -EPERM;
goto err_detach;
}
)
i'm not sure "goto err_detach" is the proper jump but it seems to be good.
i hope next week i can test this solution with devices other than cisco.
(older juniper and low-end hp 3com)
btw i welcome any test with any network devices related to this feature.
>From 974763f179cf741a8b9b0459be2e9c84d23e8989 Mon Sep 17 00:00:00 2001
From: Krisztian Ivancso <github-ivan@ivancso.net>
Date: Fri, 16 Aug 2013 02:25:45 +0200
Subject: [PATCH net-next] bonding: lacp_port_id setting for 802.3ad
---
drivers/net/bonding/bond_main.c | 24 +++++++++++++++++++++--
drivers/net/bonding/bond_procfs.c | 2 ++
drivers/net/bonding/bond_sysfs.c | 40 +++++++++++++++++++++++++++++++++++++++
drivers/net/bonding/bonding.h | 1 +
4 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4264a76..3580866 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -110,6 +110,7 @@ static char *fail_over_mac;
static int all_slaves_active;
static struct bond_params bonding_defaults;
static int resend_igmp = BOND_DEFAULT_RESEND_IGMP;
+static int lacp_port_id = 1;
module_param(max_bonds, int, 0);
MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
@@ -150,7 +151,7 @@ module_param(lacp_rate, charp, 0);
MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; "
"0 for slow, 1 for fast");
module_param(ad_select, charp, 0);
-MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; "
+MODULE_PARM_DESC(ad_select, "802.3ad aggregation selection logic; "
"0 for stable (default), 1 for bandwidth, "
"2 for count");
module_param(min_links, int, 0);
@@ -181,6 +182,8 @@ MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface"
module_param(resend_igmp, int, 0);
MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on "
"link failure");
+module_param(lacp_port_id, int, 0);
+MODULE_PARM_DESC(lacp_port_id, "802.3ad port id to send to switch in LACPDU");
/*----------------------------- Global variables ----------------------------*/
@@ -1699,7 +1702,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
bond_set_slave_inactive_flags(new_slave);
/* if this is the first slave */
if (bond_first_slave(bond) == new_slave) {
- SLAVE_AD_INFO(new_slave).id = 1;
+ SLAVE_AD_INFO(new_slave).id = bond->params.lacp_port_id;
/* Initialize AD with the number of times that the AD timer is called in 1 second
* can be called only after the mac address of the bond is set
*/
@@ -1708,6 +1711,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
struct slave *prev_slave;
prev_slave = bond_prev_slave(bond, new_slave);
+ if (SLAVE_AD_INFO(prev_slave).id == 65535) {
+ pr_err("%s: Error: Couldn't add new slave (%s) because maximum port id (65535) is reached.\n",
+ bond_dev->name, slave_dev->name);
+ res = -EPERM;
+ goto err_detach;
+ }
SLAVE_AD_INFO(new_slave).id =
SLAVE_AD_INFO(prev_slave).id + 1;
}
@@ -4377,6 +4386,16 @@ static int bond_check_params(struct bond_params *params)
resend_igmp = BOND_DEFAULT_RESEND_IGMP;
}
+ if (bond_mode == BOND_MODE_8023AD) {
+ /* we set upper limit to 65000 because new slaves will increase port
+ id so we don't want id to overflow */
+ if (lacp_port_id < 1 || lacp_port_id > 65000) {
+ pr_warning("Warning: lacp_port_id (%d) should be between "
+ "1 and 65000, resetting to 1\n", lacp_port_id);
+ lacp_port_id = 1;
+ }
+ }
+
/* reset values for TLB/ALB */
if ((bond_mode == BOND_MODE_TLB) ||
(bond_mode == BOND_MODE_ALB)) {
@@ -4565,6 +4584,7 @@ static int bond_check_params(struct bond_params *params)
params->all_slaves_active = all_slaves_active;
params->resend_igmp = resend_igmp;
params->min_links = min_links;
+ params->lacp_port_id = lacp_port_id;
if (primary) {
strncpy(params->primary, primary, IFNAMSIZ);
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 20a6ee2..96977d5 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -129,6 +129,7 @@ static void bond_info_show_master(struct seq_file *seq)
seq_printf(seq, "Min links: %d\n", bond->params.min_links);
seq_printf(seq, "Aggregator selection policy (ad_select): %s\n",
ad_select_tbl[bond->params.ad_select].modename);
+ seq_printf(seq, "802.3ad starting port id: %d\n", bond->params.lacp_port_id);
if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
seq_printf(seq, "bond %s has no active aggregator\n",
@@ -193,6 +194,7 @@ static void bond_info_show_slave(struct seq_file *seq,
agg->aggregator_identifier);
else
seq_puts(seq, "Aggregator ID: N/A\n");
+ seq_printf(seq, "Slave port id: %d\n", SLAVE_AD_INFO(slave).id);
}
seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id);
}
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 0f539de..35b4bdd 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -920,6 +920,45 @@ static ssize_t bonding_store_min_links(struct device *d,
static DEVICE_ATTR(min_links, S_IRUGO | S_IWUSR,
bonding_show_min_links, bonding_store_min_links);
+static ssize_t bonding_show_lacp_port_id(struct device *d,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct bonding *bond = to_bond(d);
+
+ return sprintf(buf, "%d\n", bond->params.lacp_port_id);
+}
+
+static ssize_t bonding_store_lacp_port_id(struct device *d,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct bonding *bond = to_bond(d);
+ int ret;
+ unsigned int new_value;
+
+ struct slave *first_slave = bond_first_slave(bond);
+ if (first_slave) {
+ pr_err("%s: Can't set port id because device have slave(s).\n",
+ bond->dev->name);
+ return -EPERM;
+ }
+
+ ret = kstrtouint(buf, 0, &new_value);
+ if ((ret < 0) || (new_value < 1) || (new_value > 65000)) {
+ pr_err("%s: Ignoring invalid 802.3ad port id value %s.\n",
+ bond->dev->name, buf);
+ return -EINVAL;
+ }
+
+ pr_info("%s: Setting 802.3ad port id value to %u\n",
+ bond->dev->name, new_value);
+ bond->params.lacp_port_id = new_value;
+ return count;
+}
+static DEVICE_ATTR(lacp_port_id, S_IRUGO | S_IWUSR,
+ bonding_show_lacp_port_id, bonding_store_lacp_port_id);
+
static ssize_t bonding_show_ad_select(struct device *d,
struct device_attribute *attr,
char *buf)
@@ -1705,6 +1744,7 @@ static struct attribute *per_bond_attrs[] = {
&dev_attr_all_slaves_active.attr,
&dev_attr_resend_igmp.attr,
&dev_attr_min_links.attr,
+ &dev_attr_lacp_port_id.attr,
NULL,
};
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 4bf52d5..8a078d6 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -176,6 +176,7 @@ struct bond_params {
int tx_queues;
int all_slaves_active;
int resend_igmp;
+ int lacp_port_id;
};
struct bond_parm_tbl {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] vhost: Drop linux/socket.h
From: Asias He @ 2013-08-16 1:27 UTC (permalink / raw)
To: David Miller; +Cc: netdev, virtualization, kvm, mst
In-Reply-To: <20130815.140740.1781732332793977170.davem@davemloft.net>
On Thu, Aug 15, 2013 at 02:07:40PM -0700, David Miller wrote:
> From: Asias He <asias@redhat.com>
> Date: Thu, 15 Aug 2013 11:20:16 +0800
>
> > memcpy_fromiovec is moved to lib/iovec.c. No need to include
> > linux/socket.h for it.
> >
> > Signed-off-by: Asias He <asias@redhat.com>
>
> You can't do this.
>
> Because this file doesn't include the header file that
> provides the declaration, which is linux/uio.h
vhost.c includes drivers/vhost/vhost.h. In drivers/vhost/vhost.h, we
have linux/uio.h included.
> linux/socket.h includes linux/uio.h, so honestly leaving
> things the way they are is a 1000 times better than your
> patch.
Vhost is a separate module and a generic infrastructure which is not
bound to network anymore. I guess it's better to include the real one
instead of the socket one.
--
Asias
^ permalink raw reply
* Re: [PATCH 1/3 v4] ipv6: do not disable temp_address when reaching max_address
From: Ding Tianhong @ 2013-08-16 0:48 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Jon Maloy, Eric Dumazet,
Netdev, kargig, ppandit
In-Reply-To: <20130815190754.GB30746@order.stressinduktion.org>
On 2013/8/16 3:07, Hannes Frederic Sowa wrote:
> On Thu, Aug 15, 2013 at 07:36:03PM +0200, Hannes Frederic Sowa wrote:
>> Now we have to check why these addresses don't go out of tentative state.
>
> Just looked at it. flood_router26 just emits pretty high values for
> RetransTime:
>
> 21:05:52.050159 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 192) fe80::c:2a47:1360:1101 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 192
> hop limit 255, Flags [none], pref high, router lifetime 65535s, reachable time 16384000ms, retrans time 1966080ms
> mtu option (5), length 8 (1): 1500
> 0x0000: 0000 0000 05dc
>
> We are completly in spec here. Just DAD needs a lot of time to finish.
>
> Greetings,
>
> Hannes
>
>
Great job, more and more close to the truth, let's find a better way to finish it.
> .
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox