* Re: [PATCH RFC v4 net-next 1/5] virtio_net: enable tx interrupt
From: Michael S. Tsirkin @ 2014-12-01 10:35 UTC (permalink / raw)
To: Jason Wang; +Cc: pagupta, netdev, linux-kernel, virtualization, davem
In-Reply-To: <1417429028-11971-2-git-send-email-jasowang@redhat.com>
On Mon, Dec 01, 2014 at 06:17:04PM +0800, Jason Wang wrote:
> On newer hosts that support delayed tx interrupts,
> we probably don't have much to gain from orphaning
> packets early.
>
> Note: this might degrade performance for
> hosts without event idx support.
> Should be addressed by the next patch.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Could you document the changes from the RFC I sent please?
Are there optimizations?
If yes, it might be easier to review (at least for me), if you refactor this,
e.g. applying the straight-forward rfc patch and then optimizations if
any on top. If it's taking a different approach, pls feel free to
disregard this.
> ---
> drivers/net/virtio_net.c | 132 +++++++++++++++++++++++++++++++----------------
> 1 file changed, 88 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index ec2a8b4..f68114e 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -72,6 +72,8 @@ struct send_queue {
>
> /* Name of the send queue: output.$index */
> char name[40];
> +
> + struct napi_struct napi;
> };
>
> /* Internal representation of a receive virtqueue */
> @@ -137,6 +139,9 @@ struct virtnet_info {
>
> /* CPU hot plug notifier */
> struct notifier_block nb;
> +
> + /* Budget for polling tx completion */
> + u32 tx_work_limit;
> };
>
> struct skb_vnet_hdr {
> @@ -211,15 +216,41 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask)
> return p;
> }
>
> +static unsigned int free_old_xmit_skbs(struct netdev_queue *txq,
> + struct send_queue *sq, int budget)
> +{
> + struct sk_buff *skb;
> + unsigned int len;
> + struct virtnet_info *vi = sq->vq->vdev->priv;
> + struct virtnet_stats *stats = this_cpu_ptr(vi->stats);
> + unsigned int packets = 0;
> +
> + while (packets < budget &&
> + (skb = virtqueue_get_buf(sq->vq, &len)) != NULL) {
> + pr_debug("Sent skb %p\n", skb);
> +
> + u64_stats_update_begin(&stats->tx_syncp);
> + stats->tx_bytes += skb->len;
> + stats->tx_packets++;
> + u64_stats_update_end(&stats->tx_syncp);
> +
> + dev_kfree_skb_any(skb);
> + packets++;
> + }
> +
> + if (sq->vq->num_free >= 2+MAX_SKB_FRAGS)
> + netif_tx_start_queue(txq);
> +
> + return packets;
> +}
> +
> static void skb_xmit_done(struct virtqueue *vq)
> {
> struct virtnet_info *vi = vq->vdev->priv;
> + struct send_queue *sq = &vi->sq[vq2txq(vq)];
>
> - /* Suppress further interrupts. */
> - virtqueue_disable_cb(vq);
> -
> - /* We were probably waiting for more output buffers. */
> - netif_wake_subqueue(vi->dev, vq2txq(vq));
> + virtqueue_disable_cb(sq->vq);
> + napi_schedule(&sq->napi);
> }
>
> static unsigned int mergeable_ctx_to_buf_truesize(unsigned long mrg_ctx)
> @@ -777,6 +808,32 @@ again:
> return received;
> }
>
> +static int virtnet_poll_tx(struct napi_struct *napi, int budget)
> +{
> + struct send_queue *sq =
> + container_of(napi, struct send_queue, napi);
> + struct virtnet_info *vi = sq->vq->vdev->priv;
> + struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq));
> + u32 limit = vi->tx_work_limit;
> + unsigned int sent;
> +
> + __netif_tx_lock(txq, smp_processor_id());
> + sent = free_old_xmit_skbs(txq, sq, limit);
> + if (sent < limit) {
> + napi_complete(napi);
> + /* Note: we must enable cb *after* napi_complete, because
> + * napi_schedule calls from callbacks that trigger before
> + * napi_complete are ignored.
> + */
> + if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
> + virtqueue_disable_cb(sq->vq);
> + napi_schedule(&sq->napi);
> + }
> + }
> + __netif_tx_unlock(txq);
> + return sent < limit ? 0 : budget;
> +}
> +
Unlike the patch I sent, this seems to ignore the budget,
and always poll the full napi_weight.
Seems strange. What is the reason for this?
> #ifdef CONFIG_NET_RX_BUSY_POLL
> /* must be called with local_bh_disable()d */
> static int virtnet_busy_poll(struct napi_struct *napi)
> @@ -825,30 +882,12 @@ static int virtnet_open(struct net_device *dev)
> if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
> schedule_delayed_work(&vi->refill, 0);
> virtnet_napi_enable(&vi->rq[i]);
> + napi_enable(&vi->sq[i].napi);
> }
>
> return 0;
> }
>
> -static void free_old_xmit_skbs(struct send_queue *sq)
> -{
> - struct sk_buff *skb;
> - unsigned int len;
> - struct virtnet_info *vi = sq->vq->vdev->priv;
> - struct virtnet_stats *stats = this_cpu_ptr(vi->stats);
> -
> - while ((skb = virtqueue_get_buf(sq->vq, &len)) != NULL) {
> - pr_debug("Sent skb %p\n", skb);
> -
> - u64_stats_update_begin(&stats->tx_syncp);
> - stats->tx_bytes += skb->len;
> - stats->tx_packets++;
> - u64_stats_update_end(&stats->tx_syncp);
> -
> - dev_kfree_skb_any(skb);
> - }
> -}
> -
> static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
> {
> struct skb_vnet_hdr *hdr;
> @@ -912,7 +951,9 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
> sg_set_buf(sq->sg, hdr, hdr_len);
> num_sg = skb_to_sgvec(skb, sq->sg + 1, 0, skb->len) + 1;
> }
> - return virtqueue_add_outbuf(sq->vq, sq->sg, num_sg, skb, GFP_ATOMIC);
> +
> + return virtqueue_add_outbuf(sq->vq, sq->sg, num_sg, skb,
> + GFP_ATOMIC);
> }
>
> static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
> @@ -924,8 +965,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
> struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
> bool kick = !skb->xmit_more;
>
> - /* Free up any pending old buffers before queueing new ones. */
> - free_old_xmit_skbs(sq);
> + virtqueue_disable_cb(sq->vq);
>
> /* Try to transmit */
> err = xmit_skb(sq, skb);
> @@ -941,27 +981,19 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
> return NETDEV_TX_OK;
> }
>
> - /* Don't wait up for transmitted skbs to be freed. */
> - skb_orphan(skb);
> - nf_reset(skb);
> -
> /* Apparently nice girls don't return TX_BUSY; stop the queue
> * before it gets out of hand. Naturally, this wastes entries. */
> - if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
> + if (sq->vq->num_free < 2+MAX_SKB_FRAGS)
> netif_stop_subqueue(dev, qnum);
> - if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
> - /* More just got used, free them then recheck. */
> - free_old_xmit_skbs(sq);
> - if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
> - netif_start_subqueue(dev, qnum);
> - virtqueue_disable_cb(sq->vq);
> - }
> - }
> - }
>
> if (kick || netif_xmit_stopped(txq))
> virtqueue_kick(sq->vq);
>
> + if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
> + virtqueue_disable_cb(sq->vq);
> + napi_schedule(&sq->napi);
> + }
> +
> return NETDEV_TX_OK;
> }
>
> @@ -1138,8 +1170,10 @@ static int virtnet_close(struct net_device *dev)
> /* Make sure refill_work doesn't re-enable napi! */
> cancel_delayed_work_sync(&vi->refill);
>
> - for (i = 0; i < vi->max_queue_pairs; i++)
> + for (i = 0; i < vi->max_queue_pairs; i++) {
> napi_disable(&vi->rq[i].napi);
> + napi_disable(&vi->sq[i].napi);
> + }
>
> return 0;
> }
> @@ -1452,8 +1486,10 @@ static void virtnet_free_queues(struct virtnet_info *vi)
> {
> int i;
>
> - for (i = 0; i < vi->max_queue_pairs; i++)
> + for (i = 0; i < vi->max_queue_pairs; i++) {
> netif_napi_del(&vi->rq[i].napi);
> + netif_napi_del(&vi->sq[i].napi);
> + }
>
> kfree(vi->rq);
> kfree(vi->sq);
> @@ -1607,6 +1643,8 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
> netif_napi_add(vi->dev, &vi->rq[i].napi, virtnet_poll,
> napi_weight);
> napi_hash_add(&vi->rq[i].napi);
> + netif_napi_add(vi->dev, &vi->sq[i].napi, virtnet_poll_tx,
> + napi_weight);
>
> sg_init_table(vi->rq[i].sg, ARRAY_SIZE(vi->rq[i].sg));
> ewma_init(&vi->rq[i].mrg_avg_pkt_len, 1, RECEIVE_AVG_WEIGHT);
> @@ -1790,6 +1828,8 @@ static int virtnet_probe(struct virtio_device *vdev)
> if (err)
> goto free_stats;
>
> + vi->tx_work_limit = napi_weight;
> +
> #ifdef CONFIG_SYSFS
> if (vi->mergeable_rx_bufs)
> dev->sysfs_rx_queue_group = &virtio_net_mrg_rx_group;
> @@ -1904,8 +1944,10 @@ static int virtnet_freeze(struct virtio_device *vdev)
> if (netif_running(vi->dev)) {
> for (i = 0; i < vi->max_queue_pairs; i++) {
> napi_disable(&vi->rq[i].napi);
> + napi_disable(&vi->sq[i].napi);
> napi_hash_del(&vi->rq[i].napi);
> netif_napi_del(&vi->rq[i].napi);
> + netif_napi_del(&vi->sq[i].napi);
> }
> }
>
> @@ -1930,8 +1972,10 @@ static int virtnet_restore(struct virtio_device *vdev)
> if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
> schedule_delayed_work(&vi->refill, 0);
>
> - for (i = 0; i < vi->max_queue_pairs; i++)
> + for (i = 0; i < vi->max_queue_pairs; i++) {
> virtnet_napi_enable(&vi->rq[i]);
> + napi_enable(&vi->sq[i].napi);
> + }
> }
>
> netif_device_attach(vi->dev);
> --
> 1.8.3.1
^ permalink raw reply
* Re: [PATCH] mips: bpf: Fix broken BPF_MOD
From: Denis Kirjanov @ 2014-12-01 10:37 UTC (permalink / raw)
To: Network Development; +Cc: stable, Markos Chandras
In-Reply-To: <547C3F2F.3070708@imgtec.com>
On 12/1/14, Markos Chandras <Markos.Chandras@imgtec.com> wrote:
> On 12/01/2014 09:57 AM, Denis Kirjanov wrote:
>> Remove optimize_div() from BPF_MOD | BPF_K case
>> since we don't know the dividend and fix the
>> emit_mod() by reading the mod operation result from HI register
>>
>> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
>> ---
>> arch/mips/net/bpf_jit.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
>> index 9b55143..9fd6834 100644
>> --- a/arch/mips/net/bpf_jit.c
>> +++ b/arch/mips/net/bpf_jit.c
>> @@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned
>> int src,
>> u32 *p = &ctx->target[ctx->idx];
>> uasm_i_divu(&p, dst, src);
>> p = &ctx->target[ctx->idx + 1];
>> - uasm_i_mflo(&p, dst);
>> + uasm_i_mfhi(&p, dst);
>
> That looks correct.
>
>> }
>> ctx->idx += 2; /* 2 insts */
>> }
>> @@ -971,7 +971,7 @@ load_ind:
>> break;
>> case BPF_ALU | BPF_MOD | BPF_K:
>> /* A %= k */
>> - if (k == 1 || optimize_div(&k)) {
>> + if (k == 1) {
>> ctx->flags |= SEEN_A;
>> emit_jit_reg_move(r_A, r_zero, ctx);
>> } else {
>>
>
> That looks correct too. Thanks for fixing these.
>
> Can you also CC stable for inclusion in >=3.16?
>
> Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: stable@vger.kernel.org
> --
> markos
>
^ permalink raw reply
* Re: [PATCH RFC v4 net-next 0/5] virtio_net: enabling tx interrupts
From: Michael S. Tsirkin @ 2014-12-01 10:42 UTC (permalink / raw)
To: Jason Wang; +Cc: pagupta, netdev, davem, linux-kernel, virtualization
In-Reply-To: <1417429028-11971-1-git-send-email-jasowang@redhat.com>
On Mon, Dec 01, 2014 at 06:17:03PM +0800, Jason Wang wrote:
> Hello:
>
> We used to orphan packets before transmission for virtio-net. This breaks
> socket accounting and can lead serveral functions won't work, e.g:
>
> - Byte Queue Limit depends on tx completion nofication to work.
> - Packet Generator depends on tx completion nofication for the last
> transmitted packet to complete.
> - TCP Small Queue depends on proper accounting of sk_wmem_alloc to work.
>
> This series tries to solve the issue by enabling tx interrupts. To minize
> the performance impacts of this, several optimizations were used:
>
> - In guest side, virtqueue_enable_cb_delayed() was used to delay the tx
> interrupt untile 3/4 pending packets were sent.
> - In host side, interrupt coalescing were used to reduce tx interrupts.
>
> Performance test results[1] (tx-frames 16 tx-usecs 16) shows:
>
> - For guest receiving. No obvious regression on throughput were
> noticed. More cpu utilization were noticed in few cases.
> - For guest transmission. Very huge improvement on througput for small
> packet transmission were noticed. This is expected since TSQ and other
> optimization for small packet transmission work after tx interrupt. But
> will use more cpu for large packets.
> - For TCP_RR, regression (10% on transaction rate and cpu utilization) were
> found. Tx interrupt won't help but cause overhead in this case. Using
> more aggressive coalescing parameters may help to reduce the regression.
OK, you do have posted coalescing patches - does it help any?
I'm not sure the regression is due to interrupts.
It would make sense for CPU but why would it
hurt transaction rate?
It's possible that we are deferring kicks too much due to BQL.
As an experiment: do we get any of it back if we do
- if (kick || netif_xmit_stopped(txq))
- virtqueue_kick(sq->vq);
+ virtqueue_kick(sq->vq);
?
If yes, we can just kick e.g. periodically, e.g. after queueing each
X bytes.
> Changes from RFC V3:
> - Don't free tx packets in ndo_start_xmit()
> - Add interrupt coalescing support for virtio-net
> Changes from RFC v2:
> - clean up code, address issues raised by Jason
> Changes from RFC v1:
> - address comments by Jason Wang, use delayed cb everywhere
> - rebased Jason's patch on top of mine and include it (with some tweaks)
>
> Please reivew. Comments were more than welcomed.
>
> [1] Performance Test result:
>
> Environment:
> - Two Intel(R) Xeon(R) CPU E5620 @ 2.40GHz machines connected back to back
> with 82599ES cards.
> - Both host and guest were net-next.git plus the patch
> - Coalescing parameters for the card:
> Adaptive RX: off TX: off
> rx-usecs: 1
> rx-frames: 0
> tx-usecs: 0
> tx-frames: 0
> - Vhost_net was enabled and zerocopy was disabled
> - Tests was done by netperf-2.6
> - Guest has 2 vcpus with single queue virtio-net
>
> Results:
> - Numbers of square brackets are whose significance is grater than 95%
>
> Guest RX:
>
> size/sessions/+throughput/+cpu/+per_cpu_throughput/
> 64/1/+2.0326/[+6.2807%]/-3.9970%/
> 64/2/-0.2104%/[+3.2012%]/[-3.3058%]/
> 64/4/+1.5956%/+2.2451%/-0.6353%/
> 64/8/+1.1732%/+3.5123%/-2.2598%/
> 256/1/+3.7619%/[+5.8117%]/-1.9372%/
> 256/2/-0.0661%/[+3.2511%]/-3.2127%/
> 256/4/+1.1435%/[-8.1842%]/[+10.1591%]/
> 256/8/[+2.2447%]/[+6.2044%]/[-3.7283%]/
> 1024/1/+9.1479%/[+12.0997%]/[-2.6332%]/
> 1024/2/[-17.3341%]/[+0.0000%]/[-17.3341%]/
> 1024/4/[-0.6284%]/-1.0376%/+0.4135%/
> 1024/8/+1.1444%/-1.6069%/+2.7961%/
> 4096/1/+0.0401%/-0.5993%/+0.6433%/
> 4096/2/[-0.5894%]/-2.2071%/+1.6542%/
> 4096/4/[-0.5560%]/-1.4969%/+0.9553%/
> 4096/8/-0.3362%/+2.7086%/-2.9645%/
> 16384/1/-0.0285%/+0.7247%/-0.7478%/
> 16384/2/-0.5286%/+0.3287%/-0.8545%/
> 16384/4/-0.3297%/-2.0543%/+1.7608%/
> 16384/8/+1.0932%/+4.0253%/-2.8187%/
> 65535/1/+0.0003%/-0.1502%/+0.1508%/
> 65535/2/[-0.6065%]/+0.2309%/-0.8355%/
> 65535/4/[-0.6861%]/[+3.9451%]/[-4.4554%]/
> 65535/8/+1.8359%/+3.1590%/-1.2825%/
>
> Guest RX:
> size/sessions/+throughput/+cpu/+per_cpu_throughput/
> 64/1/[+65.0961%]/[-8.6807%]/[+80.7900%]/
> 64/2/[+6.0288%]/[-2.2823%]/[+8.5052%]/
> 64/4/[+5.9038%]/[-2.1834%]/[+8.2677%]/
> 64/8/[+5.4154%]/[-2.1804%]/[+7.7651%]/
> 256/1/[+184.6462%]/[+4.8906%]/[+171.3742%]/
> 256/2/[+46.0731%]/[-8.9626%]/[+60.4539%]/
> 256/4/[+45.8547%]/[-8.3027%]/[+59.0612%]/
> 256/8/[+45.3486%]/[-8.4024%]/[+58.6817%]/
> 1024/1/[+432.5372%]/[+3.9566%]/[+412.2689%]/
> 1024/2/[-1.4207%]/[-23.6426%]/[+29.1025%]/
> 1024/4/-0.1003%/[-13.6416%]/[+15.6804%]/
> 1024/8/[+0.2200%]/[+2.0634%]/[-1.8061%]/
> 4096/1/[+18.4835%]/[-46.1508%]/[+120.0283%]/
> 4096/2/+0.1770%/[-26.2780%]/[+35.8848%]/
> 4096/4/-0.1012%/-0.7353%/+0.6388%/
> 4096/8/-0.6091%/+1.4159%/-1.9968%/
> 16384/1/-0.0424%/[+11.9373%]/[-10.7021%]/
> 16384/2/+0.0482%/+2.4685%/-2.3620%/
> 16384/4/+0.0840%/[+5.3587%]/[-5.0064%]/
> 16384/8/+0.0048%/[+5.0176%]/[-4.7733%]/
> 65535/1/-0.0095%/[+10.9408%]/[-9.8705%]/
> 65535/2/+0.1515%/[+8.1709%]/[-7.4137%]/
> 65535/4/+0.0203%/[+5.4316%]/[-5.1325%]/
> 65535/8/+0.1427%/[+6.2753%]/[-5.7705%]/
>
> size/sessions/+trans.rate/+cpu/+per_cpu_trans.rate/
> 64/1/+0.2346%/[+11.5080%]/[-10.1099%]/
> 64/25/[-10.7893%]/-0.5791%/[-10.2697%]/
> 64/50/[-11.5997%]/-0.3429%/[-11.2956%]/
> 256/1/+0.7219%/[+13.2374%]/[-11.0524%]/
> 256/25/-6.9567%/+0.8887%/[-7.7763%]/
> 256/50/[-4.8814%]/-0.0338%/[-4.8492%]/
> 4096/1/-1.6061%/-0.7561%/-0.8565%/
> 4096/25/[+2.2120%]/[+1.0839%]/+1.1161%/
> 4096/50/[+5.6180%]/[+3.2116%]/[+2.3315%]/
>
> Jason Wang (4):
> virtio_net: enable tx interrupt
> virtio-net: optimize free_old_xmit_skbs stats
> virtio-net: add basic interrupt coalescing support
> vhost_net: interrupt coalescing support
>
> Michael S. Tsirkin (1):
> virtio_net: bql
>
> drivers/net/virtio_net.c | 211 ++++++++++++++++++++++++++++++++--------
> drivers/vhost/net.c | 200 +++++++++++++++++++++++++++++++++++--
> include/uapi/linux/vhost.h | 12 +++
> include/uapi/linux/virtio_net.h | 12 +++
> 4 files changed, 383 insertions(+), 52 deletions(-)
>
> --
> 1.8.3.1
^ permalink raw reply
* Re: [PATCH] wireless/p54: Remove duplicated net2280 header
From: Ricardo Ribalda Delgado @ 2014-12-01 10:46 UTC (permalink / raw)
To: Christian Lamparter, John W. Linville, LKML, linux-wireless,
netdev, David Miller
Cc: Ricardo Ribalda Delgado
In-Reply-To: <1416824391-13976-1-git-send-email-ricardo.ribalda@gmail.com>
David Miller has marked the patch as "Awaiting Upstream", which I
think means that it should be merged through the wireless tree.
Any comment from there?
On Mon, Nov 24, 2014 at 11:19 AM, Ricardo Ribalda Delgado
<ricardo.ribalda@gmail.com> wrote:
> The usb gadget driver net2280 has exported a header file with the
> register definition of the net2280 chip.
>
> Remove the custom/duplicated header file in favor of that header file
> in include/linux
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> drivers/net/wireless/p54/net2280.h | 451 -------------------------------------
> drivers/net/wireless/p54/p54usb.h | 13 +-
> 2 files changed, 12 insertions(+), 452 deletions(-)
> delete mode 100644 drivers/net/wireless/p54/net2280.h
>
> diff --git a/drivers/net/wireless/p54/net2280.h b/drivers/net/wireless/p54/net2280.h
> deleted file mode 100644
> index aedfaf2..0000000
> --- a/drivers/net/wireless/p54/net2280.h
> +++ /dev/null
> @@ -1,451 +0,0 @@
> -#ifndef NET2280_H
> -#define NET2280_H
> -/*
> - * NetChip 2280 high/full speed USB device controller.
> - * Unlike many such controllers, this one talks PCI.
> - */
> -
> -/*
> - * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
> - * Copyright (C) 2003 David Brownell
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -/*-------------------------------------------------------------------------*/
> -
> -/* NET2280 MEMORY MAPPED REGISTERS
> - *
> - * The register layout came from the chip documentation, and the bit
> - * number definitions were extracted from chip specification.
> - *
> - * Use the shift operator ('<<') to build bit masks, with readl/writel
> - * to access the registers through PCI.
> - */
> -
> -/* main registers, BAR0 + 0x0000 */
> -struct net2280_regs {
> - /* offset 0x0000 */
> - __le32 devinit;
> -#define LOCAL_CLOCK_FREQUENCY 8
> -#define FORCE_PCI_RESET 7
> -#define PCI_ID 6
> -#define PCI_ENABLE 5
> -#define FIFO_SOFT_RESET 4
> -#define CFG_SOFT_RESET 3
> -#define PCI_SOFT_RESET 2
> -#define USB_SOFT_RESET 1
> -#define M8051_RESET 0
> - __le32 eectl;
> -#define EEPROM_ADDRESS_WIDTH 23
> -#define EEPROM_CHIP_SELECT_ACTIVE 22
> -#define EEPROM_PRESENT 21
> -#define EEPROM_VALID 20
> -#define EEPROM_BUSY 19
> -#define EEPROM_CHIP_SELECT_ENABLE 18
> -#define EEPROM_BYTE_READ_START 17
> -#define EEPROM_BYTE_WRITE_START 16
> -#define EEPROM_READ_DATA 8
> -#define EEPROM_WRITE_DATA 0
> - __le32 eeclkfreq;
> - u32 _unused0;
> - /* offset 0x0010 */
> -
> - __le32 pciirqenb0; /* interrupt PCI master ... */
> -#define SETUP_PACKET_INTERRUPT_ENABLE 7
> -#define ENDPOINT_F_INTERRUPT_ENABLE 6
> -#define ENDPOINT_E_INTERRUPT_ENABLE 5
> -#define ENDPOINT_D_INTERRUPT_ENABLE 4
> -#define ENDPOINT_C_INTERRUPT_ENABLE 3
> -#define ENDPOINT_B_INTERRUPT_ENABLE 2
> -#define ENDPOINT_A_INTERRUPT_ENABLE 1
> -#define ENDPOINT_0_INTERRUPT_ENABLE 0
> - __le32 pciirqenb1;
> -#define PCI_INTERRUPT_ENABLE 31
> -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
> -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
> -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
> -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
> -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
> -#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18
> -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
> -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
> -#define GPIO_INTERRUPT_ENABLE 13
> -#define DMA_D_INTERRUPT_ENABLE 12
> -#define DMA_C_INTERRUPT_ENABLE 11
> -#define DMA_B_INTERRUPT_ENABLE 10
> -#define DMA_A_INTERRUPT_ENABLE 9
> -#define EEPROM_DONE_INTERRUPT_ENABLE 8
> -#define VBUS_INTERRUPT_ENABLE 7
> -#define CONTROL_STATUS_INTERRUPT_ENABLE 6
> -#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
> -#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
> -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
> -#define RESUME_INTERRUPT_ENABLE 1
> -#define SOF_INTERRUPT_ENABLE 0
> - __le32 cpu_irqenb0; /* ... or onboard 8051 */
> -#define SETUP_PACKET_INTERRUPT_ENABLE 7
> -#define ENDPOINT_F_INTERRUPT_ENABLE 6
> -#define ENDPOINT_E_INTERRUPT_ENABLE 5
> -#define ENDPOINT_D_INTERRUPT_ENABLE 4
> -#define ENDPOINT_C_INTERRUPT_ENABLE 3
> -#define ENDPOINT_B_INTERRUPT_ENABLE 2
> -#define ENDPOINT_A_INTERRUPT_ENABLE 1
> -#define ENDPOINT_0_INTERRUPT_ENABLE 0
> - __le32 cpu_irqenb1;
> -#define CPU_INTERRUPT_ENABLE 31
> -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
> -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
> -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
> -#define PCI_INTA_INTERRUPT_ENABLE 24
> -#define PCI_PME_INTERRUPT_ENABLE 23
> -#define PCI_SERR_INTERRUPT_ENABLE 22
> -#define PCI_PERR_INTERRUPT_ENABLE 21
> -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
> -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
> -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
> -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
> -#define GPIO_INTERRUPT_ENABLE 13
> -#define DMA_D_INTERRUPT_ENABLE 12
> -#define DMA_C_INTERRUPT_ENABLE 11
> -#define DMA_B_INTERRUPT_ENABLE 10
> -#define DMA_A_INTERRUPT_ENABLE 9
> -#define EEPROM_DONE_INTERRUPT_ENABLE 8
> -#define VBUS_INTERRUPT_ENABLE 7
> -#define CONTROL_STATUS_INTERRUPT_ENABLE 6
> -#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
> -#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
> -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
> -#define RESUME_INTERRUPT_ENABLE 1
> -#define SOF_INTERRUPT_ENABLE 0
> -
> - /* offset 0x0020 */
> - u32 _unused1;
> - __le32 usbirqenb1;
> -#define USB_INTERRUPT_ENABLE 31
> -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
> -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
> -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
> -#define PCI_INTA_INTERRUPT_ENABLE 24
> -#define PCI_PME_INTERRUPT_ENABLE 23
> -#define PCI_SERR_INTERRUPT_ENABLE 22
> -#define PCI_PERR_INTERRUPT_ENABLE 21
> -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
> -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
> -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
> -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
> -#define GPIO_INTERRUPT_ENABLE 13
> -#define DMA_D_INTERRUPT_ENABLE 12
> -#define DMA_C_INTERRUPT_ENABLE 11
> -#define DMA_B_INTERRUPT_ENABLE 10
> -#define DMA_A_INTERRUPT_ENABLE 9
> -#define EEPROM_DONE_INTERRUPT_ENABLE 8
> -#define VBUS_INTERRUPT_ENABLE 7
> -#define CONTROL_STATUS_INTERRUPT_ENABLE 6
> -#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
> -#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
> -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
> -#define RESUME_INTERRUPT_ENABLE 1
> -#define SOF_INTERRUPT_ENABLE 0
> - __le32 irqstat0;
> -#define INTA_ASSERTED 12
> -#define SETUP_PACKET_INTERRUPT 7
> -#define ENDPOINT_F_INTERRUPT 6
> -#define ENDPOINT_E_INTERRUPT 5
> -#define ENDPOINT_D_INTERRUPT 4
> -#define ENDPOINT_C_INTERRUPT 3
> -#define ENDPOINT_B_INTERRUPT 2
> -#define ENDPOINT_A_INTERRUPT 1
> -#define ENDPOINT_0_INTERRUPT 0
> - __le32 irqstat1;
> -#define POWER_STATE_CHANGE_INTERRUPT 27
> -#define PCI_ARBITER_TIMEOUT_INTERRUPT 26
> -#define PCI_PARITY_ERROR_INTERRUPT 25
> -#define PCI_INTA_INTERRUPT 24
> -#define PCI_PME_INTERRUPT 23
> -#define PCI_SERR_INTERRUPT 22
> -#define PCI_PERR_INTERRUPT 21
> -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20
> -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19
> -#define PCI_RETRY_ABORT_INTERRUPT 17
> -#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16
> -#define GPIO_INTERRUPT 13
> -#define DMA_D_INTERRUPT 12
> -#define DMA_C_INTERRUPT 11
> -#define DMA_B_INTERRUPT 10
> -#define DMA_A_INTERRUPT 9
> -#define EEPROM_DONE_INTERRUPT 8
> -#define VBUS_INTERRUPT 7
> -#define CONTROL_STATUS_INTERRUPT 6
> -#define ROOT_PORT_RESET_INTERRUPT 4
> -#define SUSPEND_REQUEST_INTERRUPT 3
> -#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
> -#define RESUME_INTERRUPT 1
> -#define SOF_INTERRUPT 0
> - /* offset 0x0030 */
> - __le32 idxaddr;
> - __le32 idxdata;
> - __le32 fifoctl;
> -#define PCI_BASE2_RANGE 16
> -#define IGNORE_FIFO_AVAILABILITY 3
> -#define PCI_BASE2_SELECT 2
> -#define FIFO_CONFIGURATION_SELECT 0
> - u32 _unused2;
> - /* offset 0x0040 */
> - __le32 memaddr;
> -#define START 28
> -#define DIRECTION 27
> -#define FIFO_DIAGNOSTIC_SELECT 24
> -#define MEMORY_ADDRESS 0
> - __le32 memdata0;
> - __le32 memdata1;
> - u32 _unused3;
> - /* offset 0x0050 */
> - __le32 gpioctl;
> -#define GPIO3_LED_SELECT 12
> -#define GPIO3_INTERRUPT_ENABLE 11
> -#define GPIO2_INTERRUPT_ENABLE 10
> -#define GPIO1_INTERRUPT_ENABLE 9
> -#define GPIO0_INTERRUPT_ENABLE 8
> -#define GPIO3_OUTPUT_ENABLE 7
> -#define GPIO2_OUTPUT_ENABLE 6
> -#define GPIO1_OUTPUT_ENABLE 5
> -#define GPIO0_OUTPUT_ENABLE 4
> -#define GPIO3_DATA 3
> -#define GPIO2_DATA 2
> -#define GPIO1_DATA 1
> -#define GPIO0_DATA 0
> - __le32 gpiostat;
> -#define GPIO3_INTERRUPT 3
> -#define GPIO2_INTERRUPT 2
> -#define GPIO1_INTERRUPT 1
> -#define GPIO0_INTERRUPT 0
> -} __packed;
> -
> -/* usb control, BAR0 + 0x0080 */
> -struct net2280_usb_regs {
> - /* offset 0x0080 */
> - __le32 stdrsp;
> -#define STALL_UNSUPPORTED_REQUESTS 31
> -#define SET_TEST_MODE 16
> -#define GET_OTHER_SPEED_CONFIGURATION 15
> -#define GET_DEVICE_QUALIFIER 14
> -#define SET_ADDRESS 13
> -#define ENDPOINT_SET_CLEAR_HALT 12
> -#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11
> -#define GET_STRING_DESCRIPTOR_2 10
> -#define GET_STRING_DESCRIPTOR_1 9
> -#define GET_STRING_DESCRIPTOR_0 8
> -#define GET_SET_INTERFACE 6
> -#define GET_SET_CONFIGURATION 5
> -#define GET_CONFIGURATION_DESCRIPTOR 4
> -#define GET_DEVICE_DESCRIPTOR 3
> -#define GET_ENDPOINT_STATUS 2
> -#define GET_INTERFACE_STATUS 1
> -#define GET_DEVICE_STATUS 0
> - __le32 prodvendid;
> -#define PRODUCT_ID 16
> -#define VENDOR_ID 0
> - __le32 relnum;
> - __le32 usbctl;
> -#define SERIAL_NUMBER_INDEX 16
> -#define PRODUCT_ID_STRING_ENABLE 13
> -#define VENDOR_ID_STRING_ENABLE 12
> -#define USB_ROOT_PORT_WAKEUP_ENABLE 11
> -#define VBUS_PIN 10
> -#define TIMED_DISCONNECT 9
> -#define SUSPEND_IMMEDIATELY 7
> -#define SELF_POWERED_USB_DEVICE 6
> -#define REMOTE_WAKEUP_SUPPORT 5
> -#define PME_POLARITY 4
> -#define USB_DETECT_ENABLE 3
> -#define PME_WAKEUP_ENABLE 2
> -#define DEVICE_REMOTE_WAKEUP_ENABLE 1
> -#define SELF_POWERED_STATUS 0
> - /* offset 0x0090 */
> - __le32 usbstat;
> -#define HIGH_SPEED 7
> -#define FULL_SPEED 6
> -#define GENERATE_RESUME 5
> -#define GENERATE_DEVICE_REMOTE_WAKEUP 4
> - __le32 xcvrdiag;
> -#define FORCE_HIGH_SPEED_MODE 31
> -#define FORCE_FULL_SPEED_MODE 30
> -#define USB_TEST_MODE 24
> -#define LINE_STATE 16
> -#define TRANSCEIVER_OPERATION_MODE 2
> -#define TRANSCEIVER_SELECT 1
> -#define TERMINATION_SELECT 0
> - __le32 setup0123;
> - __le32 setup4567;
> - /* offset 0x0090 */
> - u32 _unused0;
> - __le32 ouraddr;
> -#define FORCE_IMMEDIATE 7
> -#define OUR_USB_ADDRESS 0
> - __le32 ourconfig;
> -} __packed;
> -
> -/* pci control, BAR0 + 0x0100 */
> -struct net2280_pci_regs {
> - /* offset 0x0100 */
> - __le32 pcimstctl;
> -#define PCI_ARBITER_PARK_SELECT 13
> -#define PCI_MULTI LEVEL_ARBITER 12
> -#define PCI_RETRY_ABORT_ENABLE 11
> -#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10
> -#define DMA_READ_MULTIPLE_ENABLE 9
> -#define DMA_READ_LINE_ENABLE 8
> -#define PCI_MASTER_COMMAND_SELECT 6
> -#define MEM_READ_OR_WRITE 0
> -#define IO_READ_OR_WRITE 1
> -#define CFG_READ_OR_WRITE 2
> -#define PCI_MASTER_START 5
> -#define PCI_MASTER_READ_WRITE 4
> -#define PCI_MASTER_WRITE 0
> -#define PCI_MASTER_READ 1
> -#define PCI_MASTER_BYTE_WRITE_ENABLES 0
> - __le32 pcimstaddr;
> - __le32 pcimstdata;
> - __le32 pcimststat;
> -#define PCI_ARBITER_CLEAR 2
> -#define PCI_EXTERNAL_ARBITER 1
> -#define PCI_HOST_MODE 0
> -} __packed;
> -
> -/* dma control, BAR0 + 0x0180 ... array of four structs like this,
> - * for channels 0..3. see also struct net2280_dma: descriptor
> - * that can be loaded into some of these registers.
> - */
> -struct net2280_dma_regs { /* [11.7] */
> - /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
> - __le32 dmactl;
> -#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
> -#define DMA_CLEAR_COUNT_ENABLE 21
> -#define DESCRIPTOR_POLLING_RATE 19
> -#define POLL_CONTINUOUS 0
> -#define POLL_1_USEC 1
> -#define POLL_100_USEC 2
> -#define POLL_1_MSEC 3
> -#define DMA_VALID_BIT_POLLING_ENABLE 18
> -#define DMA_VALID_BIT_ENABLE 17
> -#define DMA_SCATTER_GATHER_ENABLE 16
> -#define DMA_OUT_AUTO_START_ENABLE 4
> -#define DMA_PREEMPT_ENABLE 3
> -#define DMA_FIFO_VALIDATE 2
> -#define DMA_ENABLE 1
> -#define DMA_ADDRESS_HOLD 0
> - __le32 dmastat;
> -#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25
> -#define DMA_TRANSACTION_DONE_INTERRUPT 24
> -#define DMA_ABORT 1
> -#define DMA_START 0
> - u32 _unused0[2];
> - /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
> - __le32 dmacount;
> -#define VALID_BIT 31
> -#define DMA_DIRECTION 30
> -#define DMA_DONE_INTERRUPT_ENABLE 29
> -#define END_OF_CHAIN 28
> -#define DMA_BYTE_COUNT_MASK ((1<<24)-1)
> -#define DMA_BYTE_COUNT 0
> - __le32 dmaaddr;
> - __le32 dmadesc;
> - u32 _unused1;
> -} __packed;
> -
> -/* dedicated endpoint registers, BAR0 + 0x0200 */
> -
> -struct net2280_dep_regs { /* [11.8] */
> - /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
> - __le32 dep_cfg;
> - /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
> - __le32 dep_rsp;
> - u32 _unused[2];
> -} __packed;
> -
> -/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
> - * like this, for ep0 then the configurable endpoints A..F
> - * ep0 reserved for control; E and F have only 64 bytes of fifo
> - */
> -struct net2280_ep_regs { /* [11.9] */
> - /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
> - __le32 ep_cfg;
> -#define ENDPOINT_BYTE_COUNT 16
> -#define ENDPOINT_ENABLE 10
> -#define ENDPOINT_TYPE 8
> -#define ENDPOINT_DIRECTION 7
> -#define ENDPOINT_NUMBER 0
> - __le32 ep_rsp;
> -#define SET_NAK_OUT_PACKETS 15
> -#define SET_EP_HIDE_STATUS_PHASE 14
> -#define SET_EP_FORCE_CRC_ERROR 13
> -#define SET_INTERRUPT_MODE 12
> -#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11
> -#define SET_NAK_OUT_PACKETS_MODE 10
> -#define SET_ENDPOINT_TOGGLE 9
> -#define SET_ENDPOINT_HALT 8
> -#define CLEAR_NAK_OUT_PACKETS 7
> -#define CLEAR_EP_HIDE_STATUS_PHASE 6
> -#define CLEAR_EP_FORCE_CRC_ERROR 5
> -#define CLEAR_INTERRUPT_MODE 4
> -#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3
> -#define CLEAR_NAK_OUT_PACKETS_MODE 2
> -#define CLEAR_ENDPOINT_TOGGLE 1
> -#define CLEAR_ENDPOINT_HALT 0
> - __le32 ep_irqenb;
> -#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6
> -#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5
> -#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3
> -#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2
> -#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1
> -#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0
> - __le32 ep_stat;
> -#define FIFO_VALID_COUNT 24
> -#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22
> -#define TIMEOUT 21
> -#define USB_STALL_SENT 20
> -#define USB_IN_NAK_SENT 19
> -#define USB_IN_ACK_RCVD 18
> -#define USB_OUT_PING_NAK_SENT 17
> -#define USB_OUT_ACK_SENT 16
> -#define FIFO_OVERFLOW 13
> -#define FIFO_UNDERFLOW 12
> -#define FIFO_FULL 11
> -#define FIFO_EMPTY 10
> -#define FIFO_FLUSH 9
> -#define SHORT_PACKET_OUT_DONE_INTERRUPT 6
> -#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5
> -#define NAK_OUT_PACKETS 4
> -#define DATA_PACKET_RECEIVED_INTERRUPT 3
> -#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
> -#define DATA_OUT_PING_TOKEN_INTERRUPT 1
> -#define DATA_IN_TOKEN_INTERRUPT 0
> - /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
> - __le32 ep_avail;
> - __le32 ep_data;
> - u32 _unused0[2];
> -} __packed;
> -
> -struct net2280_reg_write {
> - __le16 port;
> - __le32 addr;
> - __le32 val;
> -} __packed;
> -
> -struct net2280_reg_read {
> - __le16 port;
> - __le32 addr;
> -} __packed;
> -#endif /* NET2280_H */
> diff --git a/drivers/net/wireless/p54/p54usb.h b/drivers/net/wireless/p54/p54usb.h
> index d273be7..a5f5f0f 100644
> --- a/drivers/net/wireless/p54/p54usb.h
> +++ b/drivers/net/wireless/p54/p54usb.h
> @@ -16,7 +16,7 @@
>
> /* for isl3886 register definitions used on ver 1 devices */
> #include "p54pci.h"
> -#include "net2280.h"
> +#include <linux/usb/net2280.h>
>
> /* pci */
> #define NET2280_BASE 0x10000000
> @@ -93,6 +93,17 @@ enum net2280_op_type {
> NET2280_DEV_CFG_U16 = 0x0883
> };
>
> +struct net2280_reg_write {
> + __le16 port;
> + __le32 addr;
> + __le32 val;
> +} __packed;
> +
> +struct net2280_reg_read {
> + __le16 port;
> + __le32 addr;
> +} __packed;
> +
> #define P54U_FW_BLOCK 2048
>
> #define X2_SIGNATURE "x2 "
> --
> 2.1.3
>
--
Ricardo Ribalda
^ permalink raw reply
* Re: [PATCH RFC v3 0/3] virtio_net: enabling tx interrupts
From: Michael S. Tsirkin @ 2014-12-01 10:48 UTC (permalink / raw)
To: Jason Wang; +Cc: linux-kernel, netdev
In-Reply-To: <547C3F8C.8000006@redhat.com>
On Mon, Dec 01, 2014 at 06:14:36PM +0800, Jason Wang wrote:
>
>
> On 10/20/2014 02:52 PM, Michael S. Tsirkin wrote:
> >RFC patches to enable tx interrupts.
> >This is to demonstrate how this can be done without
> >core virtio changes, and to make sure I understand
> >the new APIs correctly.
> >
> >Testing TBD, I was asked for a version for early testing.
> >
> >Applies on top of patch: "virtio_net: fix use after free"
> >that I recently sent.
> >
> >Changes from v3:
> > clean up code, address issues raised by Jason
> >Changes from v1:
> > address comments by Jason Wang, use delayed cb everywhere
> > rebased Jason's patch on top of mine and include it (with some tweaks)
> >
> >Jason Wang (1):
> > virtio-net: optimize free_old_xmit_skbs stats
> >
> >Michael S. Tsirkin (2):
> > virtio_net: enable tx interrupt
> > virtio_net: bql
> >
> > drivers/net/virtio_net.c | 144 +++++++++++++++++++++++++++++++++--------------
> > 1 file changed, 101 insertions(+), 43 deletions(-)
> >
>
> I've run a full tests on this series and see huge regression when zerocopy
> is disabled. Looks like the reason is zerocopy could coalescing tx
> completion which greatly reduce the number of tx interrupts.
I think you refer to this code:
/*
* Trigger polling thread if guest stopped submitting new
* buffers:
* in this case, the refcount after decrement will eventually
* reach 1.
* We also trigger polling periodically after each 16 packets
* (the value 16 here is more or less arbitrary, it's tuned to
* trigger
* less than 10% of times).
*/
if (cnt <= 1 || !(cnt % 16))
vhost_poll_queue(&vq->poll);
?
This seems unrelated to interrupt coalescing.
We can easily enable something similar for all tx
packets, without need for guest configuration.
If it's not clear how to do this, let me know, I'll try to put out a
patch like this in a couple of days.
> I will post RFC V4 shortly with interrupt coalescing support. In this
> version I remove the tx packet cleanup in ndo_start_xmit() since it may
> reduce the effects of interrupt coalescing.
Maybe split this in a separate patch?
^ permalink raw reply
* Re: Re: [bisected] xfrm: TCP connection initiating PMTU discovery stalls on v3.12+
From: Thomas Jarosch @ 2014-12-01 11:20 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev, edumazet, Steffen Klassert
In-Reply-To: <20141201102522.GA16579@gondor.apana.org.au>
On Monday, 1. December 2014 18:25:22 Herbert Xu wrote:
> Thomas Jarosch <thomas.jarosch@intra2net.com> wrote:
> > When I revert it, even kernel v3.18-rc6 starts working.
> > But I doubt this is the root problem, may be just hiding another issue.
>
> Can you do a tcpdump with this patch reverted? I would like to
> see the size of the packets that are sent out vs. the ICMP message
> that came back.
>
> My guess is that the IPsec GSO path is buggy since as you rightly
> pointed out it couldn't have been heavily tested prior to this
> patch.
>
> Though I am surprised that it only breaks when you have a PMTU event
> so it might be something else after all.
I've sent you two pcap files off list. One with the reverted patch
and one I created on Saturday showing the stalling TCP connection.
(though the mail currently seems greylisted by the receiving mail server)
One thing I can say from looking at the tcpdump with the reverted patch
is that the ESP packet size drops from 1510 to 1478. The announced MTU
of the next hop in the ICMP message is 1464. It also contains seven
duplicated ACK packets later on.
Without the reverted patch, it sends four ESP packets:
1. 1498 bytes
2. 1498 bytes
3. 1498 bytes
4. 234 bytes
That triggers the ICMP "fragmentation needed" message. I can only spot one
ESP packet of size 1466 afterwards that's sent from time to time. Only one
duplicated ACK packet can be seen. The other packets are just not resent.
May be it's stuck in some in-kernel queue because it's too big to send
and stays there until it expires?
Today I also tried changing the NIC driver on the virtual machine
from virtio_net to e1000. Luckily still the same behavior,
so it's probably not related to the virtio_net driver.
Cheers,
Thomas
^ permalink raw reply
* Re: [PATCH v7 27/46] virtio_net: enable v1.0 support
From: Cornelia Huck @ 2014-12-01 11:40 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-28-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:11:30 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Now that we have completed 1.0 support, enable it in our driver.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/net/virtio_net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index a0e64cf..c6a72d3 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2003,6 +2003,7 @@ static unsigned int features[] = {
> VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ,
> VIRTIO_NET_F_CTRL_MAC_ADDR,
> VIRTIO_F_ANY_LAYOUT,
> + VIRTIO_F_VERSION_1,
> };
>
> static struct virtio_driver virtio_net_driver = {
Shouldn't you move this after the patch disabling mac address writing?
^ permalink raw reply
* Re: [PATCH v7 34/46] virtio_net: disable mac write for virtio 1.0
From: Cornelia Huck @ 2014-12-01 11:41 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-35-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:12:04 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> The spec states that mac in config space is only driver-writable in the
> legacy case. Fence writing it in virtnet_set_mac_address() in the
> virtio 1.0 case.
>
> Suggested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/net/virtio_net.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* Re: [PATCH v7 27/46] virtio_net: enable v1.0 support
From: Michael S. Tsirkin @ 2014-12-01 11:47 UTC (permalink / raw)
To: Cornelia Huck
Cc: thuth, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <20141201124008.3d8ca343.cornelia.huck@de.ibm.com>
On Mon, Dec 01, 2014 at 12:40:08PM +0100, Cornelia Huck wrote:
> On Sun, 30 Nov 2014 17:11:30 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > Now that we have completed 1.0 support, enable it in our driver.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/net/virtio_net.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index a0e64cf..c6a72d3 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -2003,6 +2003,7 @@ static unsigned int features[] = {
> > VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ,
> > VIRTIO_NET_F_CTRL_MAC_ADDR,
> > VIRTIO_F_ANY_LAYOUT,
> > + VIRTIO_F_VERSION_1,
> > };
> >
> > static struct virtio_driver virtio_net_driver = {
>
> Shouldn't you move this after the patch disabling mac address writing?
Probably a good idea.
^ permalink raw reply
* Re: [PATCH v7 29/46] vhost: add memory access wrappers
From: Cornelia Huck @ 2014-12-01 12:13 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-30-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:11:39 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Add guest memory access wrappers to handle virtio endianness
> conversions.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vhost/vhost.h | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* Re: [PATCH 1/3] net-PPP: Deletion of unnecessary checks before the function call "kfree"
From: Sergei Shtylyov @ 2014-12-01 12:19 UTC (permalink / raw)
To: SF Markus Elfring, Paul Mackerras, linux-ppp, netdev
Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <547B496E.604@users.sourceforge.net>
Hello.
On 11/30/2014 7:44 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 30 Nov 2014 17:02:07 +0100
> The kfree() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> This issue was detected by using the Coccinelle software.
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/net/ppp/ppp_mppe.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
> diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
> index 911b216..7e44212 100644
> --- a/drivers/net/ppp/ppp_mppe.c
> +++ b/drivers/net/ppp/ppp_mppe.c
> @@ -238,8 +238,7 @@ static void *mppe_alloc(unsigned char *options, int optlen)
> return (void *)state;
>
> out_free:
> - if (state->sha1_digest)
> - kfree(state->sha1_digest);
> + kfree(state->sha1_digest);
Please keep this line aligned to the others.
> if (state->sha1)
> crypto_free_hash(state->sha1);
> if (state->arc4)
[...]
WBR, Sergei
^ permalink raw reply
* Re: [PATCH v7 30/46] vhost/net: force len for TX to host endian
From: Cornelia Huck @ 2014-12-01 12:20 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-31-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:11:44 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> vhost/net keeps a copy of some used ring but (ab)uses length
> field for internal house-keeping. This works because
> for tx used length is always 0.
> Suppress sparse errors: we use native endian-ness internally but never
> expose it to guest.
I admit that I find this patch description hard to read :)
"vhost/net keeps a copy of the used ring in host memory but (ab)uses
the length field for internal house-keeping. This works because the
length in the used ring for tx is always 0. In order to suppress sparse
errors, we need to force native endianness."
?
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vhost/net.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 8dae2f7..dce5c58 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -48,15 +48,15 @@ MODULE_PARM_DESC(experimental_zcopytx, "Enable Zero Copy TX;"
> * status internally; used for zerocopy tx only.
> */
> /* Lower device DMA failed */
> -#define VHOST_DMA_FAILED_LEN 3
> +#define VHOST_DMA_FAILED_LEN ((__force __virtio32)3)
> /* Lower device DMA done */
> -#define VHOST_DMA_DONE_LEN 2
> +#define VHOST_DMA_DONE_LEN ((__force __virtio32)2)
> /* Lower device DMA in progress */
> -#define VHOST_DMA_IN_PROGRESS 1
> +#define VHOST_DMA_IN_PROGRESS ((__force __virtio32)1)
> /* Buffer unused */
> -#define VHOST_DMA_CLEAR_LEN 0
> +#define VHOST_DMA_CLEAR_LEN ((__force __virtio32)0)
>
> -#define VHOST_DMA_IS_DONE(len) ((len) >= VHOST_DMA_DONE_LEN)
> +#define VHOST_DMA_IS_DONE(len) ((__force u32)(len) >= (__force u32)VHOST_DMA_DONE_LEN)
>
> enum {
> VHOST_NET_FEATURES = VHOST_FEATURES |
^ permalink raw reply
* Re: [PATCH v7 30/46] vhost/net: force len for TX to host endian
From: Michael S. Tsirkin @ 2014-12-01 12:33 UTC (permalink / raw)
To: Cornelia Huck
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <20141201132051.4ab028d9.cornelia.huck@de.ibm.com>
On Mon, Dec 01, 2014 at 01:20:51PM +0100, Cornelia Huck wrote:
> On Sun, 30 Nov 2014 17:11:44 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > vhost/net keeps a copy of some used ring but (ab)uses length
> > field for internal house-keeping. This works because
> > for tx used length is always 0.
> > Suppress sparse errors: we use native endian-ness internally but never
> > expose it to guest.
>
> I admit that I find this patch description hard to read :)
>
>
> "vhost/net keeps a copy of the used ring in host memory but (ab)uses
> the length field for internal house-keeping. This works because the
> length in the used ring for tx is always 0. In order to suppress sparse
> errors, we need to force native endianness."
>
> ?
Yes. Add to this "These values are never exposed to guest."
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Reviewed-by: Jason Wang <jasowang@redhat.com>
> > ---
> > drivers/vhost/net.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index 8dae2f7..dce5c58 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -48,15 +48,15 @@ MODULE_PARM_DESC(experimental_zcopytx, "Enable Zero Copy TX;"
> > * status internally; used for zerocopy tx only.
> > */
> > /* Lower device DMA failed */
> > -#define VHOST_DMA_FAILED_LEN 3
> > +#define VHOST_DMA_FAILED_LEN ((__force __virtio32)3)
> > /* Lower device DMA done */
> > -#define VHOST_DMA_DONE_LEN 2
> > +#define VHOST_DMA_DONE_LEN ((__force __virtio32)2)
> > /* Lower device DMA in progress */
> > -#define VHOST_DMA_IN_PROGRESS 1
> > +#define VHOST_DMA_IN_PROGRESS ((__force __virtio32)1)
> > /* Buffer unused */
> > -#define VHOST_DMA_CLEAR_LEN 0
> > +#define VHOST_DMA_CLEAR_LEN ((__force __virtio32)0)
> >
> > -#define VHOST_DMA_IS_DONE(len) ((len) >= VHOST_DMA_DONE_LEN)
> > +#define VHOST_DMA_IS_DONE(len) ((__force u32)(len) >= (__force u32)VHOST_DMA_DONE_LEN)
> >
> > enum {
> > VHOST_NET_FEATURES = VHOST_FEATURES |
^ permalink raw reply
* Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support
From: Cornelia Huck @ 2014-12-01 12:33 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-32-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:11:49 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/vhost.c | 93 +++++++++++++++++++++++++++++++--------------------
> 1 file changed, 56 insertions(+), 37 deletions(-)
>
> @@ -1113,18 +1120,19 @@ static int get_indirect(struct vhost_virtqueue *vq,
> {
> struct vring_desc desc;
> unsigned int i = 0, count, found = 0;
> + u32 len = vhost32_to_cpu(vq, indirect->len);
> int ret;
>
> /* Sanity check */
> - if (unlikely(indirect->len % sizeof desc)) {
> + if (unlikely(len % sizeof desc)) {
> vq_err(vq, "Invalid length in indirect descriptor: "
> "len 0x%llx not multiple of 0x%zx\n",
> - (unsigned long long)indirect->len,
> + (unsigned long long)vhost32_to_cpu(vq, indirect->len),
Can't you use len here?
> sizeof desc);
> return -EINVAL;
> }
>
> - ret = translate_desc(vq, indirect->addr, indirect->len, vq->indirect,
> + ret = translate_desc(vq, vhost64_to_cpu(vq, indirect->addr), len, vq->indirect,
> UIO_MAXIOV);
> if (unlikely(ret < 0)) {
> vq_err(vq, "Translation failure %d in indirect.\n", ret);
> @@ -1404,7 +1422,7 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
>
> /* Make sure buffer is written before we update index. */
> smp_wmb();
> - if (put_user(vq->last_used_idx, &vq->used->idx)) {
> + if (__put_user(cpu_to_vhost16(vq, vq->last_used_idx), &vq->used->idx)) {
Why s/put_user/__put_user/ - I don't see how endianness conversions
should have an influence there?
> vq_err(vq, "Failed to increment used idx");
> return -EFAULT;
> }
> @@ -1449,11 +1468,11 @@ static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
> if (unlikely(!v))
> return true;
>
> - if (get_user(event, vhost_used_event(vq))) {
> + if (__get_user(event, vhost_used_event(vq))) {
Dito: why the change?
> vq_err(vq, "Failed to get used event idx");
> return true;
> }
> - return vring_need_event(event, new, old);
> + return vring_need_event(vhost16_to_cpu(vq, event), new, old);
> }
>
> /* This actually signals the guest, using eventfd. */
^ permalink raw reply
* Re: [PATCH v7 32/46] vhost/net: virtio 1.0 byte swap
From: Cornelia Huck @ 2014-12-01 12:35 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-33-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:11:54 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/net.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* Re: [PATCH v7 33/46] vhost/net: larger header for virtio 1.0
From: Cornelia Huck @ 2014-12-01 12:35 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-34-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:11:59 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vhost/net.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support
From: Michael S. Tsirkin @ 2014-12-01 12:37 UTC (permalink / raw)
To: Cornelia Huck
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <20141201133353.0bbaa2e1.cornelia.huck@de.ibm.com>
On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote:
> On Sun, 30 Nov 2014 17:11:49 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/vhost/vhost.c | 93 +++++++++++++++++++++++++++++++--------------------
> > 1 file changed, 56 insertions(+), 37 deletions(-)
> >
>
> > @@ -1113,18 +1120,19 @@ static int get_indirect(struct vhost_virtqueue *vq,
> > {
> > struct vring_desc desc;
> > unsigned int i = 0, count, found = 0;
> > + u32 len = vhost32_to_cpu(vq, indirect->len);
> > int ret;
> >
> > /* Sanity check */
> > - if (unlikely(indirect->len % sizeof desc)) {
> > + if (unlikely(len % sizeof desc)) {
> > vq_err(vq, "Invalid length in indirect descriptor: "
> > "len 0x%llx not multiple of 0x%zx\n",
> > - (unsigned long long)indirect->len,
> > + (unsigned long long)vhost32_to_cpu(vq, indirect->len),
>
> Can't you use len here?
Not if I want error message to be readable.
> > sizeof desc);
> > return -EINVAL;
> > }
> >
> > - ret = translate_desc(vq, indirect->addr, indirect->len, vq->indirect,
> > + ret = translate_desc(vq, vhost64_to_cpu(vq, indirect->addr), len, vq->indirect,
> > UIO_MAXIOV);
> > if (unlikely(ret < 0)) {
> > vq_err(vq, "Translation failure %d in indirect.\n", ret);
>
>
> > @@ -1404,7 +1422,7 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
> >
> > /* Make sure buffer is written before we update index. */
> > smp_wmb();
> > - if (put_user(vq->last_used_idx, &vq->used->idx)) {
> > + if (__put_user(cpu_to_vhost16(vq, vq->last_used_idx), &vq->used->idx)) {
>
> Why s/put_user/__put_user/ - I don't see how endianness conversions
> should have an influence there?
We should generally to __ variants since addresses are pre-validated.
But I agree - should be a separate patch.
>
> > vq_err(vq, "Failed to increment used idx");
> > return -EFAULT;
> > }
>
> > @@ -1449,11 +1468,11 @@ static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
> > if (unlikely(!v))
> > return true;
> >
> > - if (get_user(event, vhost_used_event(vq))) {
> > + if (__get_user(event, vhost_used_event(vq))) {
>
> Dito: why the change?
Same. Will split this out, it's unrelated to virtio 1.0.
> > vq_err(vq, "Failed to get used event idx");
> > return true;
> > }
> > - return vring_need_event(event, new, old);
> > + return vring_need_event(vhost16_to_cpu(vq, event), new, old);
> > }
> >
> > /* This actually signals the guest, using eventfd. */
^ permalink raw reply
* Re: [PATCH v7 36/46] vhost/net: suppress compiler warning
From: Cornelia Huck @ 2014-12-01 12:37 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <1417359787-10138-37-git-send-email-mst@redhat.com>
On Sun, 30 Nov 2014 17:12:13 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> len is always initialized since function is called with size > 0.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 984242e..54ffbb0 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -501,7 +501,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
> int headcount = 0;
> unsigned d;
> int r, nlogs = 0;
> - u32 len;
> + u32 uninitialized_var(len);
>
> while (datalen > 0 && headcount < quota) {
> if (unlikely(seg >= UIO_MAXIOV)) {
Want to merge this with the patch introducing the variable and add a
comment there?
^ permalink raw reply
* Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support
From: Cornelia Huck @ 2014-12-01 12:42 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <20141201123701.GB17958@redhat.com>
On Mon, 1 Dec 2014 14:37:01 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote:
> > On Sun, 30 Nov 2014 17:11:49 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > > drivers/vhost/vhost.c | 93 +++++++++++++++++++++++++++++++--------------------
> > > 1 file changed, 56 insertions(+), 37 deletions(-)
> > >
> >
> > > @@ -1113,18 +1120,19 @@ static int get_indirect(struct vhost_virtqueue *vq,
> > > {
> > > struct vring_desc desc;
> > > unsigned int i = 0, count, found = 0;
> > > + u32 len = vhost32_to_cpu(vq, indirect->len);
> > > int ret;
> > >
> > > /* Sanity check */
> > > - if (unlikely(indirect->len % sizeof desc)) {
> > > + if (unlikely(len % sizeof desc)) {
> > > vq_err(vq, "Invalid length in indirect descriptor: "
> > > "len 0x%llx not multiple of 0x%zx\n",
> > > - (unsigned long long)indirect->len,
> > > + (unsigned long long)vhost32_to_cpu(vq, indirect->len),
> >
> > Can't you use len here?
>
> Not if I want error message to be readable.
Huh? Both have the same value.
^ permalink raw reply
* HELLO
From: matildawoart @ 2014-12-01 12:47 UTC (permalink / raw)
My Dearest, how are you today? I hope you are fine, I am
Barrister Matilda woart from woart & Associate Chambers. I have something very
important
to discuss with you and you can contact me via my private
email:
Matildawoart@gmail.com
Best Regards,
Honorable Matilda woart solicitor-at-law (CDF, LLM. BL)
Office: 20 Rue du Chenin de Fer
Matilda woart
Liberia.
^ permalink raw reply
* Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support
From: Michael S. Tsirkin @ 2014-12-01 12:49 UTC (permalink / raw)
To: Cornelia Huck
Cc: thuth, kvm, rusty, netdev, linux-kernel, virtualization, dahi,
pbonzini, David Miller
In-Reply-To: <20141201134247.55e68161.cornelia.huck@de.ibm.com>
On Mon, Dec 01, 2014 at 01:42:47PM +0100, Cornelia Huck wrote:
> On Mon, 1 Dec 2014 14:37:01 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote:
> > > On Sun, 30 Nov 2014 17:11:49 +0200
> > > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > >
> > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > ---
> > > > drivers/vhost/vhost.c | 93 +++++++++++++++++++++++++++++++--------------------
> > > > 1 file changed, 56 insertions(+), 37 deletions(-)
> > > >
> > >
> > > > @@ -1113,18 +1120,19 @@ static int get_indirect(struct vhost_virtqueue *vq,
> > > > {
> > > > struct vring_desc desc;
> > > > unsigned int i = 0, count, found = 0;
> > > > + u32 len = vhost32_to_cpu(vq, indirect->len);
> > > > int ret;
> > > >
> > > > /* Sanity check */
> > > > - if (unlikely(indirect->len % sizeof desc)) {
> > > > + if (unlikely(len % sizeof desc)) {
> > > > vq_err(vq, "Invalid length in indirect descriptor: "
> > > > "len 0x%llx not multiple of 0x%zx\n",
> > > > - (unsigned long long)indirect->len,
> > > > + (unsigned long long)vhost32_to_cpu(vq, indirect->len),
> > >
> > > Can't you use len here?
> >
> > Not if I want error message to be readable.
>
> Huh? Both have the same value.
Ah, good point.
^ permalink raw reply
* Re: tun issue after e0b46d0ee9c: tun: Use iovec iterators
From: Marcelo Ricardo Leitner @ 2014-12-01 13:05 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev
In-Reply-To: <20141130082106.GA9531@gondor.apana.org.au>
On 30-11-2014 06:21, Herbert Xu wrote:
> On Sat, Nov 29, 2014 at 03:08:09AM -0200, Marcelo Ricardo Leitner wrote:
>> On 28-11-2014 21:59, Herbert Xu wrote:
>>> On Fri, Nov 28, 2014 at 05:25:27PM -0200, Marcelo Ricardo Leitner wrote:
>>>>
>>>> I saw there are tun updates on Dave's queue but none seemed to handle this.
>>>>
>>>> I can't use current net-next
>>>> (799d2fff1858004526ad75d66a5dd8a5cce6ad40) on a kvm hypervisor
>>>> because tun got clogged somehow. Bisected down to:
>>>>
>>>> commit e0b46d0ee9c240c7430a47e9b0365674d4a04522
>>>> Author: Herbert Xu <herbert@gondor.apana.org.au>
>>>> Date: Fri Nov 7 21:22:23 2014 +0800
>>>
>>> Does this patch help?
>>
>> Yay, it does! Works for me, thanks Herbert.
>> I didn't test performance, but dhcp could get through.
>>
>> Are you sure about the Fixes tag? Because bisect really pointed to e0b46d0ee9c.
>
> Well according to your report you were having problems with
> tun_get_user. The bug I introduced was in tun_put_user and has
> already been fixed by Jason Wang.
Ahh yes, ok. Thanks
Cheers,
Marcelo
^ permalink raw reply
* Re: [bisected] xfrm: TCP connection initiating PMTU discovery stalls on v3.12+
From: Wolfgang Walter @ 2014-12-01 13:17 UTC (permalink / raw)
To: Thomas Jarosch; +Cc: netdev, Eric Dumazet
In-Reply-To: <1709726.jUgUSQI9sl@pikkukde.a.i2n>
Am Samstag, 29. November 2014, 12:44:07 schrieb Thomas Jarosch:
> Hello,
>
> we're in the process of updating production level machines
> from kernel 3.4.101 to kernel 3.14.25. On one mail server
> we noticed that emails destined for an IPSec tunnel sometimes
> get stuck in the mail queue with TCP timeouts.
>
> To make a long story short: When the VPN connection is initially
> set up or re-newed, the path MTU for the xfrm tunnel is undetermined.
>
> As soon as a TCP client starts to send large packets,
> it triggers path MTU detection. Some middlebox on the
> way to the final server has a lower MTU and sends back
> an "ICMP fragmentation needed" packet as normal.
>
> With the old kernel, the packet size for the TCP connection inside
> the xfrm tunnel gets adjusted and all is fine. With kernel v3.12+,
> the connection stalls completely. Same thing with kernel v3.18-rc6.
We see something similar with real nic (RTL8139). In our case only the first
tcp-connection which triggers PMTU stalls. Later tcp-connections then work
fine.
I will revert that patch and see if that fixes the problem.
>
> We wrote a small tool to mimic postfix's TCP behavior (see attached file).
> In the end it's a normal TCP client sending large packets.
> The server side is just "socat - tcp4-listen:667".
>
> If you run "socket_client" a second time, the path MTU
> for the xfrm tunnel is already known and packets flow normal, too.
>
>
> The "evil" commit in question is this one:
> ---------------------------------------------------------------------
> commit 8f26fb1c1ed81c33f5d87c5936f4d9d1b4118918
> Author: Eric Dumazet <edumazet@google.com>
> Date: Tue Oct 15 12:24:54 2013 -0700
>
> tcp: remove the sk_can_gso() check from tcp_set_skb_tso_segs()
>
> sk_can_gso() should only be used as a hint in tcp_sendmsg() to build GSO
> packets in the first place. (As a performance hint)
>
> Once we have GSO packets in write queue, we can not decide they are no
> longer GSO only because flow now uses a route which doesn't handle
> TSO/GSO.
>
> Core networking stack handles the case very well for us, all we need
> is keeping track of packet counts in MSS terms, regardless of
> segmentation done later (in GSO or hardware)
>
> Right now, if tcp_fragment() splits a GSO packet in two parts,
> @left and @right, and route changed through a non GSO device,
> both @left and @right have pcount set to 1, which is wrong,
> and leads to incorrect packet_count tracking.
>
> This problem was added in commit d5ac99a648 ("[TCP]: skb pcount with MTU
> discovery")
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Reported-by: Maciej Żenczykowski <maze@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 8fad1c1..d46f214 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -989,8 +989,7 @@ static void tcp_set_skb_tso_segs(const struct sock *sk,
> struct sk_buff *skb, /* Make sure we own this skb before messing
> gso_size/gso_segs */ WARN_ON_ONCE(skb_cloned(skb));
>
> - if (skb->len <= mss_now || !sk_can_gso(sk) ||
> - skb->ip_summed == CHECKSUM_NONE) {
> + if (skb->len <= mss_now || skb->ip_summed == CHECKSUM_NONE) {
> /* Avoid the costly divide in the normal
> * non-TSO case.
> */
> ---------------------------------------------------------------------
>
> When I revert it, even kernel v3.18-rc6 starts working.
> But I doubt this is the root problem, may be just hiding another issue.
>
> --- Sample output of socket_client using vanilla v3.12 kernel ---
> [1417258063 SEND result: 4096, strerror: Success]
> tcp max seg: res: 0, max_seg: 1370
> [1417258063 SEND result: 4096, strerror: Success]
> tcp max seg: res: 0, max_seg: 1370
> [1417258063 SEND result: 4096, strerror: Success]
> tcp max seg: res: 0, max_seg: 1370
> [1417258063 SEND result: 4096, strerror: Success]
> tcp max seg: res: 0, max_seg: 1370
> [1417258063 SEND result: 4096, strerror: Success]
> tcp max seg: res: 0, max_seg: 1338
> [1417258063 SEND result: 4096, strerror: Success]
> tcp max seg: res: 0, max_seg: 1338
> *STUCK*
> --------------------------------------------------------
>
> The "machine" is running on KVM and using "virtio_net" as NIC driver.
> I've played with the ethtool offload settings:
>
> *** eth1 defaults ***
> Offload parameters for eth1:
> rx-checksumming: on
> tx-checksumming: on
> scatter-gather: on
> tcp-segmentation-offload: on
> udp-fragmentation-offload: on
> generic-segmentation-offload: on
> generic-receive-offload: on
> large-receive-offload: off
>
> *** eth1 working (no stalls) using vanilla kernel ***
> Offload parameters for eth1:
> rx-checksumming: on
> tx-checksumming: off <-- the magic switch
> scatter-gather: off
> tcp-segmentation-offload: off
> udp-fragmentation-offload: off
> generic-segmentation-offload: off
> generic-receive-offload: off
> large-receive-offload: off
>
> When I turn "tx-checksumming" back on, it fails again.
> Though that is probably also just a side effect.
>
> I can provide tcpdumps if needed but they are no real help
> since you can just see the kernel stops sending TCP packets.
> (and the outgoing TCP packets are encrypted in ESP packets)
>
>
> Any vague idea what might be the root cause?
>
> I also tried reverting commit 4d53eff48b5f03ce67f4f301d6acca1d2145cb7a
> ("xfrm: Don't queue retransmitted packets if the original is still on the
> host") but that didn't change the situation. In fact it wasn't even
> triggered.
>
> Please CC: comments. Thanks.
>
> Best regards,
> Thomas
Regards,
--
Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts
^ permalink raw reply
* Re: [Xen-devel] [PATCH] xen-netfront: Remove BUGs on paged skb data which crosses a page boundary
From: David Vrabel @ 2014-12-01 13:27 UTC (permalink / raw)
To: David Miller, seth.forshee
Cc: zoltan.kiss, eric.dumazet, netdev, linux-kernel, stefan.bader,
david.vrabel, xen-devel, boris.ostrovsky
In-Reply-To: <20141126.122812.223757363894961994.davem@davemloft.net>
On 26/11/14 17:28, David Miller wrote:
> From: Seth Forshee <seth.forshee@canonical.com>
> Date: Tue, 25 Nov 2014 20:28:24 -0600
>
>> These BUGs can be erroneously triggered by frags which refer to
>> tail pages within a compound page. The data in these pages may
>> overrun the hardware page while still being contained within the
>> compound page, but since compound_order() evaluates to 0 for tail
>> pages the assertion fails. The code already iterates through
>> subsequent pages correctly in this scenario, so the BUGs are
>> unnecessary and can be removed.
>>
>> Fixes: f36c374782e4 ("xen/netfront: handle compound page fragments on transmit")
>> Cc: <stable@vger.kernel.org> # 3.7+
>> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
>
> Can I get some Xen developer reviews?
Sorry for the delay, I've been on holiday.
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Thanks.
David
^ permalink raw reply
* Re: [Xen-devel] [PATCH] xen-netfront: Fix handling packets on compound pages with skb_linearize
From: David Vrabel @ 2014-12-01 13:36 UTC (permalink / raw)
To: Stefan Bader, Zoltan Kiss, Konrad Rzeszutek Wilk, Boris Ostrovsky,
David Vrabel
Cc: Wei Liu, Ian Campbell, netdev, linux-kernel, Paul Durrant,
xen-devel
In-Reply-To: <547C2CFC.7060908@canonical.com>
On 01/12/14 08:55, Stefan Bader wrote:
> On 11.08.2014 19:32, Zoltan Kiss wrote:
>> There is a long known problem with the netfront/netback interface: if the guest
>> tries to send a packet which constitues more than MAX_SKB_FRAGS + 1 ring slots,
>> it gets dropped. The reason is that netback maps these slots to a frag in the
>> frags array, which is limited by size. Having so many slots can occur since
>> compound pages were introduced, as the ring protocol slice them up into
>> individual (non-compound) page aligned slots. The theoretical worst case
>> scenario looks like this (note, skbs are limited to 64 Kb here):
>> linear buffer: at most PAGE_SIZE - 17 * 2 bytes, overlapping page boundary,
>> using 2 slots
>> first 15 frags: 1 + PAGE_SIZE + 1 bytes long, first and last bytes are at the
>> end and the beginning of a page, therefore they use 3 * 15 = 45 slots
>> last 2 frags: 1 + 1 bytes, overlapping page boundary, 2 * 2 = 4 slots
>> Although I don't think this 51 slots skb can really happen, we need a solution
>> which can deal with every scenario. In real life there is only a few slots
>> overdue, but usually it causes the TCP stream to be blocked, as the retry will
>> most likely have the same buffer layout.
>> This patch solves this problem by linearizing the packet. This is not the
>> fastest way, and it can fail much easier as it tries to allocate a big linear
>> area for the whole packet, but probably easier by an order of magnitude than
>> anything else. Probably this code path is not touched very frequently anyway.
>>
>> Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
>> Cc: Wei Liu <wei.liu2@citrix.com>
>> Cc: Ian Campbell <Ian.Campbell@citrix.com>
>> Cc: Paul Durrant <paul.durrant@citrix.com>
>> Cc: netdev@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Cc: xen-devel@lists.xenproject.org
>
> This does not seem to be marked explicitly as stable. Has someone already asked
> David Miller to put it on his stable queue? IMO it qualifies quite well and the
> actual change should be simple to pick/backport.
I think it's a candidate, yes.
Can you expand on the user visible impact of the bug this patch fixes?
I think it results in certain types of traffic not working (because the
domU always generates skb's with the problematic frag layout), but I
can't remember the details.
David
^ 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