* RE: [PATCH net 1/2] r8152: fix the sw rx checksum is unavailable
From: Hayes Wang @ 2016-11-24 12:37 UTC (permalink / raw)
To: Mark Lord, netdev@vger.kernel.org
Cc: nic_swsd, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
In-Reply-To: <b61a0e10-c737-8912-3e4e-393f4eb32077@pobox.com>
Mark Lord [mailto:mlord@pobox.com]
> Sent: Wednesday, November 23, 2016 9:41 PM
[...]
> >static void r8153_set_rx_early_size(struct r8152 *tp)
> >{
> > u32 mtu = tp->netdev->mtu;
> > u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
> >
> > ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
> >}
>
> How is ocp_data used by the hardware?
> Shouldn't the calculation also include sizeof(rx_desc) in there somewhere?
I check your question with our hw engineers, and you are right.
The size of rx descriptor should be calculated, too.
Best Regards,
Hayes
^ permalink raw reply
* Re: [PATCH net-next] mlx4: reorganize struct mlx4_en_tx_ring
From: Tariq Toukan @ 2016-11-24 12:36 UTC (permalink / raw)
To: Eric Dumazet, David Miller; +Cc: netdev, Tariq Toukan
In-Reply-To: <1479858970.8455.461.camel@edumazet-glaptop3.roam.corp.google.com>
Hi Eric,
Thanks for your patch.
On 23/11/2016 1:56 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Goal is to reorganize this critical structure to increase performance.
>
> ndo_start_xmit() should only dirty one cache line, and access as few
> cache lines as possible.
>
> Add sp_ (Slow Path) prefix to fields that are not used in fast path,
> to make clear what is going on.
>
> After this patch pahole reports something much better, as all
> ndo_start_xmit() needed fields are packed into two cache lines instead
> of seven or eight
>
> struct mlx4_en_tx_ring {
> u32 last_nr_txbb; /* 0 0x4 */
> u32 cons; /* 0x4 0x4 */
> long unsigned int wake_queue; /* 0x8 0x8 */
> struct netdev_queue * tx_queue; /* 0x10 0x8 */
> u32 (*free_tx_desc)(struct mlx4_en_priv *, struct mlx4_en_tx_ring *, int, u8, u64, int); /* 0x18 0x8 */
> struct mlx4_en_rx_ring * recycle_ring; /* 0x20 0x8 */
>
> /* XXX 24 bytes hole, try to pack */
>
> /* --- cacheline 1 boundary (64 bytes) --- */
> u32 prod; /* 0x40 0x4 */
> unsigned int tx_dropped; /* 0x44 0x4 */
> long unsigned int bytes; /* 0x48 0x8 */
> long unsigned int packets; /* 0x50 0x8 */
> long unsigned int tx_csum; /* 0x58 0x8 */
> long unsigned int tso_packets; /* 0x60 0x8 */
> long unsigned int xmit_more; /* 0x68 0x8 */
> struct mlx4_bf bf; /* 0x70 0x18 */
> /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
> __be32 doorbell_qpn; /* 0x88 0x4 */
> __be32 mr_key; /* 0x8c 0x4 */
> u32 size; /* 0x90 0x4 */
> u32 size_mask; /* 0x94 0x4 */
> u32 full_size; /* 0x98 0x4 */
> u32 buf_size; /* 0x9c 0x4 */
> void * buf; /* 0xa0 0x8 */
> struct mlx4_en_tx_info * tx_info; /* 0xa8 0x8 */
> int qpn; /* 0xb0 0x4 */
> u8 queue_index; /* 0xb4 0x1 */
> bool bf_enabled; /* 0xb5 0x1 */
> bool bf_alloced; /* 0xb6 0x1 */
> u8 hwtstamp_tx_type; /* 0xb7 0x1 */
> u8 * bounce_buf; /* 0xb8 0x8 */
> /* --- cacheline 3 boundary (192 bytes) --- */
> long unsigned int queue_stopped; /* 0xc0 0x8 */
> struct mlx4_hwq_resources sp_wqres; /* 0xc8 0x58 */
> /* --- cacheline 4 boundary (256 bytes) was 32 bytes ago --- */
> struct mlx4_qp sp_qp; /* 0x120 0x30 */
> /* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
> struct mlx4_qp_context sp_context; /* 0x150 0xf8 */
> /* --- cacheline 9 boundary (576 bytes) was 8 bytes ago --- */
> cpumask_t sp_affinity_mask; /* 0x248 0x20 */
> enum mlx4_qp_state sp_qp_state; /* 0x268 0x4 */
> u16 sp_stride; /* 0x26c 0x2 */
> u16 sp_cqn; /* 0x26e 0x2 */
>
> /* size: 640, cachelines: 10, members: 36 */
> /* sum members: 600, holes: 1, sum holes: 24 */
> /* padding: 16 */
> };
>
> Instead of this silly placement :
>
> struct mlx4_en_tx_ring {
> u32 last_nr_txbb; /* 0 0x4 */
> u32 cons; /* 0x4 0x4 */
> long unsigned int wake_queue; /* 0x8 0x8 */
>
> /* XXX 48 bytes hole, try to pack */
>
> /* --- cacheline 1 boundary (64 bytes) --- */
> u32 prod; /* 0x40 0x4 */
>
> /* XXX 4 bytes hole, try to pack */
>
> long unsigned int bytes; /* 0x48 0x8 */
> long unsigned int packets; /* 0x50 0x8 */
> long unsigned int tx_csum; /* 0x58 0x8 */
> long unsigned int tso_packets; /* 0x60 0x8 */
> long unsigned int xmit_more; /* 0x68 0x8 */
> unsigned int tx_dropped; /* 0x70 0x4 */
>
> /* XXX 4 bytes hole, try to pack */
>
> struct mlx4_bf bf; /* 0x78 0x18 */
> /* --- cacheline 2 boundary (128 bytes) was 16 bytes ago --- */
> long unsigned int queue_stopped; /* 0x90 0x8 */
> cpumask_t affinity_mask; /* 0x98 0x10 */
> struct mlx4_qp qp; /* 0xa8 0x30 */
> /* --- cacheline 3 boundary (192 bytes) was 24 bytes ago --- */
> struct mlx4_hwq_resources wqres; /* 0xd8 0x58 */
> /* --- cacheline 4 boundary (256 bytes) was 48 bytes ago --- */
> u32 size; /* 0x130 0x4 */
> u32 size_mask; /* 0x134 0x4 */
> u16 stride; /* 0x138 0x2 */
>
> /* XXX 2 bytes hole, try to pack */
>
> u32 full_size; /* 0x13c 0x4 */
> /* --- cacheline 5 boundary (320 bytes) --- */
> u16 cqn; /* 0x140 0x2 */
>
> /* XXX 2 bytes hole, try to pack */
>
> u32 buf_size; /* 0x144 0x4 */
> __be32 doorbell_qpn; /* 0x148 0x4 */
> __be32 mr_key; /* 0x14c 0x4 */
> void * buf; /* 0x150 0x8 */
> struct mlx4_en_tx_info * tx_info; /* 0x158 0x8 */
> struct mlx4_en_rx_ring * recycle_ring; /* 0x160 0x8 */
> u32 (*free_tx_desc)(struct mlx4_en_priv *, struct mlx4_en_tx_ring *, int, u8, u64, int); /* 0x168 0x8 */
> u8 * bounce_buf; /* 0x170 0x8 */
> struct mlx4_qp_context context; /* 0x178 0xf8 */
> /* --- cacheline 9 boundary (576 bytes) was 48 bytes ago --- */
> int qpn; /* 0x270 0x4 */
> enum mlx4_qp_state qp_state; /* 0x274 0x4 */
> u8 queue_index; /* 0x278 0x1 */
> bool bf_enabled; /* 0x279 0x1 */
> bool bf_alloced; /* 0x27a 0x1 */
>
> /* XXX 5 bytes hole, try to pack */
>
> /* --- cacheline 10 boundary (640 bytes) --- */
> struct netdev_queue * tx_queue; /* 0x280 0x8 */
> int hwtstamp_tx_type; /* 0x288 0x4 */
>
> /* size: 704, cachelines: 11, members: 36 */
> /* sum members: 587, holes: 6, sum holes: 65 */
> /* padding: 52 */
> };
>
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2
> drivers/net/ethernet/mellanox/mlx4/en_tx.c | 48 +++++++--------
> drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 42 +++++++------
> 3 files changed, 48 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index 9a807e93c9fdd81e61e561208aa1480a244d0bdb..9018bb1b2e12142e048281a9d28ddf95e0023a61 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -1305,7 +1305,7 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
> if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, i)))
> continue;
> en_warn(priv, "TX timeout on queue: %d, QP: 0x%x, CQ: 0x%x, Cons: 0x%x, Prod: 0x%x\n",
> - i, tx_ring->qpn, tx_ring->cqn,
> + i, tx_ring->qpn, tx_ring->sp_cqn,
> tx_ring->cons, tx_ring->prod);
> }
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index 5de3cbe24f2bf467f9a8f7d499e131b6d2a1844c..4b597dca5c52d114344d638895275ed0d378bd96 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> @@ -66,7 +66,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
>
> ring->size = size;
> ring->size_mask = size - 1;
> - ring->stride = stride;
> + ring->sp_stride = stride;
> ring->full_size = ring->size - HEADROOM - MAX_DESC_TXBBS;
>
> tmp = size * sizeof(struct mlx4_en_tx_info);
> @@ -90,22 +90,22 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
> goto err_info;
> }
> }
> - ring->buf_size = ALIGN(size * ring->stride, MLX4_EN_PAGE_SIZE);
> + ring->buf_size = ALIGN(size * ring->sp_stride, MLX4_EN_PAGE_SIZE);
>
> /* Allocate HW buffers on provided NUMA node */
> set_dev_node(&mdev->dev->persist->pdev->dev, node);
> - err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
> + err = mlx4_alloc_hwq_res(mdev->dev, &ring->sp_wqres, ring->buf_size);
> set_dev_node(&mdev->dev->persist->pdev->dev, mdev->dev->numa_node);
> if (err) {
> en_err(priv, "Failed allocating hwq resources\n");
> goto err_bounce;
> }
>
> - ring->buf = ring->wqres.buf.direct.buf;
> + ring->buf = ring->sp_wqres.buf.direct.buf;
>
> en_dbg(DRV, priv, "Allocated TX ring (addr:%p) - buf:%p size:%d buf_size:%d dma:%llx\n",
> ring, ring->buf, ring->size, ring->buf_size,
> - (unsigned long long) ring->wqres.buf.direct.map);
> + (unsigned long long) ring->sp_wqres.buf.direct.map);
>
> err = mlx4_qp_reserve_range(mdev->dev, 1, 1, &ring->qpn,
> MLX4_RESERVE_ETH_BF_QP);
> @@ -114,12 +114,12 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
> goto err_hwq_res;
> }
>
> - err = mlx4_qp_alloc(mdev->dev, ring->qpn, &ring->qp, GFP_KERNEL);
> + err = mlx4_qp_alloc(mdev->dev, ring->qpn, &ring->sp_qp, GFP_KERNEL);
> if (err) {
> en_err(priv, "Failed allocating qp %d\n", ring->qpn);
> goto err_reserve;
> }
> - ring->qp.event = mlx4_en_sqp_event;
> + ring->sp_qp.event = mlx4_en_sqp_event;
>
> err = mlx4_bf_alloc(mdev->dev, &ring->bf, node);
> if (err) {
> @@ -141,7 +141,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
> if (queue_index < priv->num_tx_rings_p_up)
> cpumask_set_cpu(cpumask_local_spread(queue_index,
> priv->mdev->dev->numa_node),
> - &ring->affinity_mask);
> + &ring->sp_affinity_mask);
>
> *pring = ring;
> return 0;
> @@ -149,7 +149,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
> err_reserve:
> mlx4_qp_release_range(mdev->dev, ring->qpn, 1);
> err_hwq_res:
> - mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
> + mlx4_free_hwq_res(mdev->dev, &ring->sp_wqres, ring->buf_size);
> err_bounce:
> kfree(ring->bounce_buf);
> ring->bounce_buf = NULL;
> @@ -171,10 +171,10 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv,
>
> if (ring->bf_alloced)
> mlx4_bf_free(mdev->dev, &ring->bf);
> - mlx4_qp_remove(mdev->dev, &ring->qp);
> - mlx4_qp_free(mdev->dev, &ring->qp);
> + mlx4_qp_remove(mdev->dev, &ring->sp_qp);
> + mlx4_qp_free(mdev->dev, &ring->sp_qp);
> mlx4_qp_release_range(priv->mdev->dev, ring->qpn, 1);
> - mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
> + mlx4_free_hwq_res(mdev->dev, &ring->sp_wqres, ring->buf_size);
> kfree(ring->bounce_buf);
> ring->bounce_buf = NULL;
> kvfree(ring->tx_info);
> @@ -190,7 +190,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
> struct mlx4_en_dev *mdev = priv->mdev;
> int err;
>
> - ring->cqn = cq;
> + ring->sp_cqn = cq;
> ring->prod = 0;
> ring->cons = 0xffffffff;
> ring->last_nr_txbb = 1;
> @@ -198,21 +198,21 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
> memset(ring->buf, 0, ring->buf_size);
> ring->free_tx_desc = mlx4_en_free_tx_desc;
>
> - ring->qp_state = MLX4_QP_STATE_RST;
> - ring->doorbell_qpn = cpu_to_be32(ring->qp.qpn << 8);
> + ring->sp_qp_state = MLX4_QP_STATE_RST;
> + ring->doorbell_qpn = cpu_to_be32(ring->sp_qp.qpn << 8);
> ring->mr_key = cpu_to_be32(mdev->mr.key);
>
> - mlx4_en_fill_qp_context(priv, ring->size, ring->stride, 1, 0, ring->qpn,
> - ring->cqn, user_prio, &ring->context);
> + mlx4_en_fill_qp_context(priv, ring->size, ring->sp_stride, 1, 0, ring->qpn,
> + ring->sp_cqn, user_prio, &ring->sp_context);
> if (ring->bf_alloced)
> - ring->context.usr_page =
> + ring->sp_context.usr_page =
> cpu_to_be32(mlx4_to_hw_uar_index(mdev->dev,
> ring->bf.uar->index));
>
> - err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, &ring->context,
> - &ring->qp, &ring->qp_state);
> - if (!cpumask_empty(&ring->affinity_mask))
> - netif_set_xps_queue(priv->dev, &ring->affinity_mask,
> + err = mlx4_qp_to_ready(mdev->dev, &ring->sp_wqres.mtt, &ring->sp_context,
> + &ring->sp_qp, &ring->sp_qp_state);
> + if (!cpumask_empty(&ring->sp_affinity_mask))
> + netif_set_xps_queue(priv->dev, &ring->sp_affinity_mask,
> ring->queue_index);
>
> return err;
> @@ -223,8 +223,8 @@ void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
> {
> struct mlx4_en_dev *mdev = priv->mdev;
>
> - mlx4_qp_modify(mdev->dev, NULL, ring->qp_state,
> - MLX4_QP_STATE_RST, NULL, 0, 0, &ring->qp);
> + mlx4_qp_modify(mdev->dev, NULL, ring->sp_qp_state,
> + MLX4_QP_STATE_RST, NULL, 0, 0, &ring->sp_qp);
> }
>
> static inline bool mlx4_en_is_tx_ring_full(struct mlx4_en_tx_ring *ring)
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> index eff21651b67308a17fe3d60d236cd0b6800a3fd2..574bcbb1b38fc4758511d8f7bd17a87b0a507a73 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> @@ -281,46 +281,50 @@ struct mlx4_en_tx_ring {
> u32 last_nr_txbb;
> u32 cons;
> unsigned long wake_queue;
> + struct netdev_queue *tx_queue;
> + u32 (*free_tx_desc)(struct mlx4_en_priv *priv,
> + struct mlx4_en_tx_ring *ring,
> + int index, u8 owner,
> + u64 timestamp, int napi_mode);
> + struct mlx4_en_rx_ring *recycle_ring;
>
> /* cache line used and dirtied in mlx4_en_xmit() */
> u32 prod ____cacheline_aligned_in_smp;
> + unsigned int tx_dropped;
> unsigned long bytes;
> unsigned long packets;
> unsigned long tx_csum;
> unsigned long tso_packets;
> unsigned long xmit_more;
> - unsigned int tx_dropped;
> struct mlx4_bf bf;
> - unsigned long queue_stopped;
>
> /* Following part should be mostly read */
> - cpumask_t affinity_mask;
> - struct mlx4_qp qp;
> - struct mlx4_hwq_resources wqres;
> + __be32 doorbell_qpn;
> + __be32 mr_key;
> u32 size; /* number of TXBBs */
> u32 size_mask;
> - u16 stride;
> u32 full_size;
> - u16 cqn; /* index of port CQ associated with this ring */
> u32 buf_size;
> - __be32 doorbell_qpn;
> - __be32 mr_key;
> void *buf;
> struct mlx4_en_tx_info *tx_info;
> - struct mlx4_en_rx_ring *recycle_ring;
> - u32 (*free_tx_desc)(struct mlx4_en_priv *priv,
> - struct mlx4_en_tx_ring *ring,
> - int index, u8 owner,
> - u64 timestamp, int napi_mode);
> - u8 *bounce_buf;
> - struct mlx4_qp_context context;
> int qpn;
> - enum mlx4_qp_state qp_state;
> u8 queue_index;
> bool bf_enabled;
> bool bf_alloced;
> - struct netdev_queue *tx_queue;
> - int hwtstamp_tx_type;
> + u8 hwtstamp_tx_type;
> + u8 *bounce_buf;
> +
> + /* Not used in fast path
> + * Only queue_stopped might be used if BQL is not properly working.
> + */
> + unsigned long queue_stopped;
> + struct mlx4_hwq_resources sp_wqres;
> + struct mlx4_qp sp_qp;
> + struct mlx4_qp_context sp_context;
> + cpumask_t sp_affinity_mask;
> + enum mlx4_qp_state sp_qp_state;
> + u16 sp_stride;
> + u16 sp_cqn; /* index of port CQ associated with this ring */
> } ____cacheline_aligned_in_smp;
>
> struct mlx4_en_rx_desc {
>
>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Regards,
Tariq
^ permalink raw reply
* Re: [Patch net-next] net_sched: move the empty tp check from ->destroy() to ->delete()
From: Roi Dayan @ 2016-11-24 11:01 UTC (permalink / raw)
To: Daniel Borkmann, Cong Wang, netdev; +Cc: roid, jiri, John Fastabend
In-Reply-To: <5836BD82.6080407@iogearbox.net>
On 24/11/2016 12:14, Daniel Borkmann wrote:
> On 11/24/2016 09:29 AM, Roi Dayan wrote:
>> Hi,
>>
>> I'm testing this patch with KASAN enabled and got into a new kernel
>> crash I didn't hit before.
>>
>> [ 1860.725065]
>> ==================================================================
>> [ 1860.733893] BUG: KASAN: use-after-free in
>> __netif_receive_skb_core+0x1ebe/0x29a0 at addr ffff880a68b04028
>> [ 1860.745415] Read of size 8 by task CPU 0/KVM/5334
>> [ 1860.751368] CPU: 8 PID: 5334 Comm: CPU 0/KVM Tainted: G O
>> 4.9.0-rc3+ #18
>> [ 1860.760547] Hardware name: HP ProLiant DL380p Gen8, BIOS P70
>> 07/01/2015
>> [ 1860.768036] Call Trace:
>> [ 1860.771307] [<ffffffffa9b6dc42>] dump_stack+0x63/0x81
>> [ 1860.777167] [<ffffffffa95fb751>] kasan_object_err+0x21/0x70
>> [ 1860.783826] [<ffffffffa95fb9dd>] kasan_report_error+0x1ed/0x4e0
>> [ 1860.790640] [<ffffffffa9b9b841>] ? csum_partial+0x11/0x20
>> [ 1860.796871] [<ffffffffaa44a6b9>] ? csum_partial_ext+0x9/0x10
>> [ 1860.803571] [<ffffffffaa453155>] ? __skb_checksum+0x115/0x8d0
>> [ 1860.810370] [<ffffffffa95fbe81>]
>> __asan_report_load8_noabort+0x61/0x70
>> [ 1860.818263] [<ffffffffaa49c3fe>] ?
>> __netif_receive_skb_core+0x1ebe/0x29a0
>> [ 1860.826215] [<ffffffffaa49c3fe>]
>> __netif_receive_skb_core+0x1ebe/0x29a0
>> [ 1860.833991] [<ffffffffaa49a540>] ? netdev_info+0x100/0x100
>> [ 1860.840529] [<ffffffffaa671792>] ? udp4_gro_receive+0x802/0x1090
>> [ 1860.847783] [<ffffffffa9bb9a08>] ? find_next_bit+0x18/0x20
>> [ 1860.854126] [<ffffffffaa49cf04>] __netif_receive_skb+0x24/0x150
>> [ 1860.861695] [<ffffffffaa49d0d1>]
>> netif_receive_skb_internal+0xa1/0x1d0
>> [ 1860.869366] [<ffffffffaa49d030>] ? __netif_receive_skb+0x150/0x150
>> [ 1860.876464] [<ffffffffaa49f7e9>] ? dev_gro_receive+0x969/0x1660
>> [ 1860.883924] [<ffffffffaa4a0e1f>] napi_gro_receive+0x1df/0x300
>> [ 1860.890744] [<ffffffffc02e885d>]
>> mlx5e_handle_rx_cqe_rep+0x83d/0xd30 [mlx5_core]
>>
>> checking with gdb
>>
>> (gdb) l *(__netif_receive_skb_core+0x1ebe)
>> 0xffffffff8249c3fe is in __netif_receive_skb_core (net/core/dev.c:3937).
>> 3932 *pt_prev = NULL;
>> 3933 }
>> 3934
>> 3935 qdisc_skb_cb(skb)->pkt_len = skb->len;
>> 3936 skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
>> 3937 qdisc_bstats_cpu_update(cl->q, skb);
>> 3938
>> 3939 switch (tc_classify(skb, cl, &cl_res, false)) {
>> 3940 case TC_ACT_OK:
>> 3941 case TC_ACT_RECLASSIFY:
>
> Can you elaborate some more on your test-case? Adding/dropping ingress
> qdisc with
> some classifier on it in a loop while traffic goes through?
I first delete the qdisc ingress from the relevant interface
I start traffic on it then I add the qdisc ingress to the relevant
interface and start adding tc flower rules to match the traffic.
>
> Thanks,
> Daniel
^ permalink raw reply
* Re: [patch net-next v2 09/11] ipv4: fib: Add an API to request a FIB dump
From: Hannes Frederic Sowa @ 2016-11-24 12:34 UTC (permalink / raw)
To: Ido Schimmel
Cc: Jiri Pirko, netdev, davem, idosch, eladr, yotamg, nogahf, arkadis,
ogerlitz, roopa, dsa, nikolay, andy, vivien.didelot, andrew,
f.fainelli, alexander.h.duyck, kaber
In-Reply-To: <20161124084758.q5uh7lr55pwwhxoh@splinter>
On 24.11.2016 09:47, Ido Schimmel wrote:
> On Thu, Nov 24, 2016 at 12:04:57AM +0100, Hannes Frederic Sowa wrote:
>> On 23.11.2016 20:53, Ido Schimmel wrote:
>>> On Wed, Nov 23, 2016 at 06:47:03PM +0100, Hannes Frederic Sowa wrote:
>>>> Hmm, I think you need to read the sequence counter under rtnl_lock to
>>>> have an ordering with the rest of the updates to the RCU trie. Otherwise
>>>> you don't know if the fib trie has the correct view regarding to the
>>>> incoming notifications as a whole. This is also necessary during restarts.
>>>
>>> I spent quite a lot of time thinking about this specific issue, but I
>>> couldn't convince myself that the read should be done under RTNL and I'm
>>> not sure I understand your reasoning. Can you please elaborate?
>>>
>>> If, before each notification sent, we call atomic_inc() and then call
>>> atomic_read() at the end, then how can we be tricked?
>>
>> The race I am suspecting to happen is:
>>
>> <CPU0> fib_register()
>>
>> <CPU1> delete route by notifier
>> <CPU1> enqueue delete cmd into ordered queue
>>
>> <CPU0> starts dump
>> <CPU0> sees deleted route by CPU1 because route not yet removed from RCU
>> <CPU0> enqueues route for addition
>
> Yea, I missed this trivial case... My mind was fixed on problems that
> could happen after the dump already started. :(
>
> Regarding your suggestion, I think the API will be more useful if we
> don't bundle fib_register() and fib_dump() together. We can do the
> following instead:
>
> 1) Sum 'fib_seq' (doesn't need to be atomic_t anymore) from all net
> namespaces under RTNL
You anyway only support init_net, no?
I didn't fully understood what you mean by sum? Using one for the whole
system?
We already have net->ipv4.rt_genid as a per-namespace routing change
counter, have you looked at that?
> 2) Dump FIB tables under RCU
> 3) Do 1) again
> 4) Compare results from 1) and 3) and retry (according to sysctl limit)
> if results differ. Before each retry the module's callback (if passed)
> will be invoked.
>
> Sounds OK?
Ah, you want to sum up all the fib_seq from all namespaces. Now I got it.
Not sure if that is such a good idea actually. It might make problems
later on if offloading will maybe one day become a per-netns knob for
the respective admins.
But semantically it should work.
If it turns out to be much easier than doing it per-netns, I think this
approach should work.
Bye,
Hannes
^ permalink raw reply
* Re: [PATCH net 1/2] r8152: fix the sw rx checksum is unavailable
From: Mark Lord @ 2016-11-24 12:31 UTC (permalink / raw)
To: Hayes Wang, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: nic_swsd, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <95fa9f67-3af6-6749-0e2b-c95406486f7d-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
On 16-11-23 02:29 PM, Mark Lord wrote:
> On 16-11-23 10:12 AM, Hayes Wang wrote:
>> Mark Lord [mlord-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org]
>> [...]
>>> What does this code do:
>>
>>>> static void r8153_set_rx_early_size(struct r8152 *tp)
>>>> {
>>>> u32 mtu = tp->netdev->mtu;
>>>> u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
>>>>
>>>> ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
>>>> }
>>
>> This only works for RTL8153. However, what you use is RTL8152.
>> It is like delay completion. It is used to reduce the loading of CPU
>> by letting a transfer contain more data to reduce the number of
>> transfers.
>>
>>> How is ocp_data used by the hardware?
>>> Shouldn't the calculation also include sizeof(rx_desc) in there somewhere?
>>
>> The algorithm is from our hw engineers, and it should be
>>
>> (agg_buf_sz - packet size) / 8
>>
>> You could refer to commit a59e6d815226 ("r8152: correct the rx early size").
>
> Thanks.
>
> Right now I am working quite hard trying to narrow things down exactly.
> You are correct that the driver does appear to be careful about accesses
> beyond the filled portion of a URB buffer -- for some reason I thought
> the original driver had issues there, but looking again it does not seem to.
>
> One idea that is now looking more likely:
> Things could be suffering from speculative CPU accesses to RAM
> (the system here has non-coherent d-cache/RAM).
> This could incorrectly pre-load data from adjacent URB buffers
> into the d-cache, creating coherency issues. I am testing now
> with cacheline-sized guard zones between the buffers to see if
> that is the issue or not.
Nope. Guard zones did not fix it, so it's probably not a prefetch issue.
Oddly, adding a couple of memory barriers to specific places in the driver
does help, A LOT. Still not 100%, but it did pass 1800 reboot tests over night
with only three bad rx_desc's reported.
That's a new record here for the driver using kmalloc'd buffers,
and put reliability on par with using non-cacheable buffers.
Any way we look at it though, the chip/driver are simply unreliable,
and relying upon hardware checksums (which fail due to the driver
looking at garbage rather than the checksum bits) leads to data corruption.
Cheers
--
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
* Aw: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
From: Lino Sanfilippo @ 2016-11-24 12:30 UTC (permalink / raw)
To: f.fainelli, andrew
Cc: davem, charrer, liodot, gregkh, devel, linux-kernel, netdev,
LinoSanfilippo
In-Reply-To: <86165d2b-f9d5-a380-9bb0-f77c12691eb6@gmx.de>
Hi Andrew, Hi Florian
> Gesendet: Dienstag, 15. November 2016 um 23:34 Uhr
> Von: "Lino Sanfilippo" <LinoSanfilippo@gmx.de>
> An: "Andrew Lunn" <andrew@lunn.ch>
> Cc: "Florian Fainelli" <f.fainelli@gmail.com>, davem@davemloft.net, charrer@alacritech.com, liodot@gmail.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org
> Betreff: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
>
> On 15.11.2016 22:59, Andrew Lunn wrote:
> >> The link state is retrieved by a command to the application processor that is running
> >> on the network card. Also the register to set the phy configuration is write-only, so
> >> it is not even possible to do the usual mdio bit-banging in the Phy read() and write()
> >> functions (however there seems to be another application processor command reserved
> >> for retrieving the PHY settings, but I have not tried it yet).
> >
> >>> + val = MII_BMCR << 16 | SLIC_PCR_AUTONEG |
> >>> + SLIC_PCR_AUTONEG_RST;
> >>> + slic_write(sdev, SLIC_REG_WPHY, val);
> >
> > This actually looks a lot like an MDIO write operation. The upper 16
> > bits are the register, and the lower 16 bits are the data. What you
> > don't have is the address. But maybe it is limited to one address.
> >
> > If the processor command reserved for read works in a similar way, you
> > have enough to do an MDIO bus.
> >
>
> Ok, I will give it a try. Reading values via the application processor
> is a bit awkward though, since it requires an address to a dma area as part of
> the command and then the AP informs the driver via irq that the dma memory has
> been written. So probably the irq handler will have to set some flag and
> the mdio_read() function will have to poll for that flag in place of doing
> bit-banging a register.
>
> > If you can get the read working look at registers 2 and 3. Compare
> > what you get with the values at the end of marvell.c.
> >
>
> Will do, thank you!
>
unfortunately I was not able to figure out how to read the phy. My hope was to find
a hidden register that I can use to request the phy status from the cards utility processor.
I actually found two more registers that seem to be reserved for the communication
with the UP. At least they cause the UPR irq to be fired but there is no data written to
the provided dma address. I assume that they are not meant to be used for the this purpose.
So I am afraid I am not able to use the phy API in this driver for now.
However I will send a v2 of the driver shortly that will include the other
changes suggested by Andrew along with some further small improvements.
Thanks for your help so far!
Regards,
Lino
^ permalink raw reply
* Re: net/arp: ARP cache aging failed.
From: Hannes Frederic Sowa @ 2016-11-24 12:28 UTC (permalink / raw)
To: YueHaibing, Julian Anastasov, Eric Dumazet; +Cc: davem, netdev
In-Reply-To: <c82b7b44-c0ad-9ee7-1114-3eae3b5cf75a@huawei.com>
On 24.11.2016 10:06, YueHaibing wrote:
> On 2016/11/24 15:51, Julian Anastasov wrote:
>>
>> Hello,
>>
>> On Wed, 23 Nov 2016, Eric Dumazet wrote:
>>
>>> On Wed, 2016-11-23 at 15:37 +0100, Hannes Frederic Sowa wrote:
>>>
>>>> Irregardless about the question if bonding should keep the MAC address
>>>> alive, a MAC address can certainly change below a TCP connection.
>>>
>>> Of course ;)
>>>
>
> I configured bonding fail_over_mac=1 ,so the bonding MAC always be the MAC
> address of the currently active slave.
>
>>>>
>>>> dst_entry is 1:n to neigh_entry and as such we can end up confirming an
>>>> aging neighbor while sending a reply with dst->pending_confirm set while
>>>> the confirming packet actually came from a different neighbor.
>>>>
>>>> I agree with Julian, pending_confirm became useless in this way.
>>>
>>> Let's kill it then ;)
>>
>> It works for traffic via gateway. I now see that
>> we can even avoid write in dst_confirm:
>>
>> if (!dst->pending_confirm)
>> dst->pending_confirm = 1;
>>
>> because it is called by non-dup TCP ACKs.
>>
>> But for traffic to hosts on LAN we need different solution,
>> i.e. for cached dsts with rt_gateway = 0 (last entry below).
>>
>> rt_uses_gateway rt_gateway DST_NOCACHE Description
>> ====================================================================
>> 1 nh_gw ANY Traffic via gateway
>> 0 LAN_host 1 FLOWI_FLAG_KNOWN_NH (nexthop
>> set by IPVS, hdrincl, xt_TEE)
>> 0 0 0 1 dst for many subnet hosts
>>
>> Regards
>>
>> --
>> Julian Anastasov <ja@ssi.bg>
>>
>> .
>>
>
> As above,Is there a plan to fix the problem ? Should we just not call dst_confirm
> when in the case rt->rt_uses_gateway/DST_NOCACHE?
I think some people are thinking about it already (me also ;) ).
But it is not easy to come up with a solution. First of all, we need to
look up the L2 address again in the neighbor cache and confirm the
appropriate neighbor. Secondly we should only do that for packets which
we can actually confirm (that means passing the TCP recv tests or some
other kind of confirmation besides simply spamming the box etc). Also it
needs to be fast.
Bye,
Hannes
^ permalink raw reply
* RE: [patch] fsl/fman: fix a leak in tgec_free()
From: Madalin-Cristian Bucur @ 2016-11-24 12:01 UTC (permalink / raw)
To: Dan Carpenter; +Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
In-Reply-To: <20161124111931.GK17225@mwanda>
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Thursday, November 24, 2016 1:21 PM
> To: Madalin-Cristian Bucur <madalin.bucur@nxp.com>; Igal Liberman
> <igal.liberman@freescale.com>
> Cc: netdev@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [patch] fsl/fman: fix a leak in tgec_free()
>
> We set "tgec->cfg" to NULL before passing it to kfree(). There is no
> need to set it to NULL at all. Let's just delete it.
Agree, thanks.
> Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I haven't tested this. It occurs to me that this code might be
> something to paper over a use after free bug by changing it to a leak
> instead.
>
> It applies to net-master.
>
> diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c
> b/drivers/net/ethernet/freescale/fman/fman_tgec.c
> index efabb04..4b0f3a5 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
> @@ -722,9 +722,6 @@ int tgec_free(struct fman_mac *tgec)
> {
> free_init_resources(tgec);
>
> - if (tgec->cfg)
> - tgec->cfg = NULL;
> -
> kfree(tgec->cfg);
> kfree(tgec);
>
^ permalink raw reply
* Re: [patch net-next] sfc: remove unneeded variable
From: Bert Kenward @ 2016-11-24 12:03 UTC (permalink / raw)
To: Dan Carpenter, Solarflare linux maintainers, Edward Cree
Cc: netdev, kernel-janitors
In-Reply-To: <20161124111651.GJ17225@mwanda>
On 24/11/16 11:16, Dan Carpenter wrote:
> We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software
> TSO") so let's remove the last traces.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bert Kenward <bkenward@solarflare.com>
^ permalink raw reply
* Re: [PATCH net-next v2] ethtool: Protect {get,set}_phy_tunable with PHY device mutex
From: Allan W. Nielsen @ 2016-11-24 11:48 UTC (permalink / raw)
To: Florian Fainelli
Cc: netdev, davem, bcm-kernel-feedback-list, andrew, raju.lakkaraju,
vivien.didelot
In-Reply-To: <20161122215531.18212-1-f.fainelli@gmail.com>
On 22/11/16 13:55, Florian Fainelli wrote:
> EXTERNAL EMAIL
>
>
> PHY drivers should be able to rely on the caller of {get,set}_tunable to
> have acquired the PHY device mutex, in order to both serialize against
> concurrent calls of these functions, but also against PHY state machine
> changes. All ethtool PHY-level functions do this, except
> {get,set}_tunable, so we make them consistent here as well.
>
> We need to update the Microsemi PHY driver in the same commit to avoid
> introducing either deadlocks, or lack of proper locking.
>
> Fixes: 968ad9da7e0e ("ethtool: Implements ETHTOOL_PHY_GTUNABLE/ETHTOOL_PHY_STUNABLE")
> Fixes: 310d9ad57ae0 ("net: phy: Add downshift get/set support in Microsemi PHYs driver")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microsemi.com>
^ permalink raw reply
* Re: [PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h
From: Cornelia Huck @ 2016-11-24 11:37 UTC (permalink / raw)
To: Mark Rutland
Cc: dave, kvm, dbueso, netdev, mst, linux-kernel, virtualization,
paulmck, dvyukov
In-Reply-To: <1479983114-17190-4-git-send-email-mark.rutland@arm.com>
On Thu, 24 Nov 2016 10:25:14 +0000
Mark Rutland <mark.rutland@arm.com> wrote:
> As a step towards killing off ACCESS_ONCE, use {READ,WRITE}_ONCE() for the
> virtio tools uaccess primitives, pulling these in from <linux/compiler.h>.
>
> With this done, we can kill off the now-unused ACCESS_ONCE() definition.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> ---
> tools/virtio/linux/uaccess.h | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE()
From: Cornelia Huck @ 2016-11-24 11:35 UTC (permalink / raw)
To: Mark Rutland
Cc: dave, kvm, dbueso, netdev, mst, linux-kernel, virtualization,
paulmck, dvyukov
In-Reply-To: <1479983114-17190-3-git-send-email-mark.rutland@arm.com>
On Thu, 24 Nov 2016 10:25:13 +0000
Mark Rutland <mark.rutland@arm.com> wrote:
> Despite living under drivers/ vringh.c is also used as part of the userspace
> virtio tools. Before we can kill off the ACCESS_ONCE()definition in the tools,
> we must convert vringh.c to use {READ,WRITE}_ONCE().
>
> This patch does so, along with the required include of <linux/compiler.h> for
> the relevant definitions. The userspace tools provide their own definitions in
> their own <linux/compiler.h>.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> ---
> drivers/vhost/vringh.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* Re: [PATCH 1/3] tools/virtio: fix READ_ONCE()
From: Cornelia Huck @ 2016-11-24 11:34 UTC (permalink / raw)
To: Mark Rutland
Cc: dave, kvm, dbueso, netdev, mst, linux-kernel, virtualization,
paulmck, dvyukov
In-Reply-To: <1479983114-17190-2-git-send-email-mark.rutland@arm.com>
On Thu, 24 Nov 2016 10:25:12 +0000
Mark Rutland <mark.rutland@arm.com> wrote:
> The virtio tools implementation of READ_ONCE() has a single parameter called
> 'var', but erroneously refers to 'val' for its cast, and thus won't work unless
> there's a variable of the correct type that happens to be called 'var'.
>
> Fix this with s/var/val/, making READ_ONCE() work as expected regardless.
>
> Fixes: a7c490333df3cff5 ("tools/virtio: use virt_xxx barriers")
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> ---
> tools/virtio/linux/compiler.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply
* [patch -next] cxgb4: leak on error path in setup_sge_txq_uld()
From: Dan Carpenter @ 2016-11-24 11:26 UTC (permalink / raw)
To: Hariprasad S; +Cc: netdev, kernel-janitors
Freeing "txq_info->uldtxq" is a no-op. We intended to free "txq_info".
Fixes: ab677ff4ad15 ("cxgb4: Allocate Tx queues dynamically")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index 565a6c6..8098902 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -532,7 +532,7 @@ setup_sge_txq_uld(struct adapter *adap, unsigned int uld_type,
txq_info->uldtxq = kcalloc(txq_info->ntxq, sizeof(struct sge_uld_txq),
GFP_KERNEL);
if (!txq_info->uldtxq) {
- kfree(txq_info->uldtxq);
+ kfree(txq_info);
return -ENOMEM;
}
^ permalink raw reply related
* [patch] fsl/fman: fix a leak in tgec_free()
From: Dan Carpenter @ 2016-11-24 11:20 UTC (permalink / raw)
To: Madalin Bucur, Igal Liberman; +Cc: netdev, kernel-janitors
We set "tgec->cfg" to NULL before passing it to kfree(). There is no
need to set it to NULL at all. Let's just delete it.
Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I haven't tested this. It occurs to me that this code might be
something to paper over a use after free bug by changing it to a leak
instead.
It applies to net-master.
diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c
index efabb04..4b0f3a5 100644
--- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
+++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
@@ -722,9 +722,6 @@ int tgec_free(struct fman_mac *tgec)
{
free_init_resources(tgec);
- if (tgec->cfg)
- tgec->cfg = NULL;
-
kfree(tgec->cfg);
kfree(tgec);
^ permalink raw reply related
* [patch net-next] sfc: remove unneeded variable
From: Dan Carpenter @ 2016-11-24 11:16 UTC (permalink / raw)
To: Solarflare linux maintainers, Edward Cree
Cc: Bert Kenward, netdev, kernel-janitors
We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software
TSO") so let's remove the last traces.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index f97f828..fd17bda 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -139,8 +139,6 @@ struct efx_special_buffer {
* struct efx_tx_buffer - buffer state for a TX descriptor
* @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
* freed when descriptor completes
- * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be
- * freed when descriptor completes.
* @option: When @flags & %EFX_TX_BUF_OPTION, a NIC-specific option descriptor.
* @dma_addr: DMA address of the fragment.
* @flags: Flags for allocation and DMA mapping type
@@ -151,10 +149,7 @@ struct efx_special_buffer {
* Only valid if @unmap_len != 0.
*/
struct efx_tx_buffer {
- union {
- const struct sk_buff *skb;
- void *heap_buf;
- };
+ const struct sk_buff *skb;
union {
efx_qword_t option;
dma_addr_t dma_addr;
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 1aa728c..bb07034 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -84,8 +84,6 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
"TX queue %d transmission id %x complete\n",
tx_queue->queue, tx_queue->read_count);
- } else if (buffer->flags & EFX_TX_BUF_HEAP) {
- kfree(buffer->heap_buf);
}
buffer->len = 0;
^ permalink raw reply related
* Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE()
From: Christian Borntraeger @ 2016-11-24 11:10 UTC (permalink / raw)
To: Mark Rutland, linux-kernel
Cc: dave, kvm, mst, netdev, dbueso, virtualization, paulmck, dvyukov
In-Reply-To: <1479983114-17190-3-git-send-email-mark.rutland@arm.com>
On 11/24/2016 11:25 AM, Mark Rutland wrote:
> Despite living under drivers/ vringh.c is also used as part of the userspace
> virtio tools. Before we can kill off the ACCESS_ONCE()definition in the tools,
> we must convert vringh.c to use {READ,WRITE}_ONCE().
>
> This patch does so, along with the required include of <linux/compiler.h> for
> the relevant definitions. The userspace tools provide their own definitions in
> their own <linux/compiler.h>.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> ---
> drivers/vhost/vringh.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
> index 3bb02c6..bb8971f 100644
> --- a/drivers/vhost/vringh.c
> +++ b/drivers/vhost/vringh.c
> @@ -3,6 +3,7 @@
> *
> * Since these may be in userspace, we use (inline) accessors.
> */
> +#include <linux/compiler.h>
> #include <linux/module.h>
> #include <linux/vringh.h>
> #include <linux/virtio_ring.h>
> @@ -820,13 +821,13 @@ EXPORT_SYMBOL(vringh_need_notify_user);
> static inline int getu16_kern(const struct vringh *vrh,
> u16 *val, const __virtio16 *p)
> {
> - *val = vringh16_to_cpu(vrh, ACCESS_ONCE(*p));
> + *val = vringh16_to_cpu(vrh, READ_ONCE(*p));
> return 0;
> }
>
> static inline int putu16_kern(const struct vringh *vrh, __virtio16 *p, u16 val)
> {
> - ACCESS_ONCE(*p) = cpu_to_vringh16(vrh, val);
> + WRITE_ONCE(*p, cpu_to_vringh16(vrh, val));
> return 0;
> }
>
Makes sense
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
^ permalink raw reply
* [PATCH] stmmac ethernet: remove cut & paste code
From: Pavel Machek @ 2016-11-24 11:05 UTC (permalink / raw)
To: peppe.cavallaro, netdev, kernel list, ezequiel, sonic.zhang,
fabrice.gasnier
In-Reply-To: <20161124104619.GA30723@amd>
[-- Attachment #1: Type: text/plain, Size: 3963 bytes --]
Remove duplicate code from _tx routines.
Signed-off-by: Pavel Machek <pavel@denx.de>
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1cff258..5cf9cef 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1960,6 +1960,38 @@ static void stmmac_tso_allocator(struct stmmac_priv *priv, unsigned int des,
}
}
+static void stmmac_xmit_common(struct sk_buff *skb, struct net_device *dev, int nfrags, struct dma_desc *desc)
+{
+ struct stmmac_priv *priv = netdev_priv(dev);
+
+ if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
+ if (netif_msg_hw(priv))
+ pr_debug("%s: stop transmitted packets\n", __func__);
+ netif_stop_queue(dev);
+ }
+
+ dev->stats.tx_bytes += skb->len;
+
+ /* According to the coalesce parameter the IC bit for the latest
+ * segment is reset and the timer re-started to clean the tx status.
+ * This approach takes care about the fragments: desc is the first
+ * element in case of no SG.
+ */
+ priv->tx_count_frames += nfrags + 1;
+ if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
+ mod_timer(&priv->txtimer,
+ STMMAC_COAL_TIMER(priv->tx_coal_timer));
+ } else {
+ priv->tx_count_frames = 0;
+ priv->hw->desc->set_tx_ic(desc);
+ priv->xstats.tx_set_ic_bit++;
+ }
+
+ if (!priv->hwts_tx_en)
+ skb_tx_timestamp(skb);
+}
+
+
/**
* stmmac_tso_xmit - Tx entry point of the driver for oversized frames (TSO)
* @skb : the socket buffer
@@ -2081,30 +2113,11 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
priv->cur_tx = STMMAC_GET_ENTRY(priv->cur_tx, DMA_TX_SIZE);
- if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
- if (netif_msg_hw(priv))
- pr_debug("%s: stop transmitted packets\n", __func__);
- netif_stop_queue(dev);
- }
-
- dev->stats.tx_bytes += skb->len;
+ stmmac_xmit_common(skb, dev, nfrags, desc);
+
priv->xstats.tx_tso_frames++;
priv->xstats.tx_tso_nfrags += nfrags;
- /* Manage tx mitigation */
- priv->tx_count_frames += nfrags + 1;
- if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
- mod_timer(&priv->txtimer,
- STMMAC_COAL_TIMER(priv->tx_coal_timer));
- } else {
- priv->tx_count_frames = 0;
- priv->hw->desc->set_tx_ic(desc);
- priv->xstats.tx_set_ic_bit++;
- }
-
- if (!priv->hwts_tx_en)
- skb_tx_timestamp(skb);
-
if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
priv->hwts_tx_en)) {
/* declare that device is doing timestamping */
@@ -2280,31 +2293,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
print_pkt(skb->data, skb->len);
}
- if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
- if (netif_msg_hw(priv))
- pr_debug("%s: stop transmitted packets\n", __func__);
- netif_stop_queue(dev);
- }
-
- dev->stats.tx_bytes += skb->len;
-
- /* According to the coalesce parameter the IC bit for the latest
- * segment is reset and the timer re-started to clean the tx status.
- * This approach takes care about the fragments: desc is the first
- * element in case of no SG.
- */
- priv->tx_count_frames += nfrags + 1;
- if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
- mod_timer(&priv->txtimer,
- STMMAC_COAL_TIMER(priv->tx_coal_timer));
- } else {
- priv->tx_count_frames = 0;
- priv->hw->desc->set_tx_ic(desc);
- priv->xstats.tx_set_ic_bit++;
- }
-
- if (!priv->hwts_tx_en)
- skb_tx_timestamp(skb);
+ stmmac_xmit_common(skb, dev, nfrags, desc);
/* Ready to fill the first descriptor and set the OWN bit w/o any
* problems because all the descriptors are actually ready to be
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply related
* [patch] net/mlx5: remove a duplicate condition
From: Dan Carpenter @ 2016-11-24 11:03 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Matan Barak, Leon Romanovsky, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
We verified that MLX5_FLOW_CONTEXT_ACTION_COUNT was set on the first
line of the function so we don't need to check again here.
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
Not a bugfix so it would go into -next
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 68ec4ea..a263d89 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1307,8 +1307,7 @@ static bool counter_is_valid(struct mlx5_fc *counter, u32 action)
return false;
return (action & (MLX5_FLOW_CONTEXT_ACTION_DROP |
- MLX5_FLOW_CONTEXT_ACTION_FWD_DEST)) &&
- (action & MLX5_FLOW_CONTEXT_ACTION_COUNT);
+ MLX5_FLOW_CONTEXT_ACTION_FWD_DEST));
}
static bool dest_is_valid(struct mlx5_flow_destination *dest,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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
* [PATCH] stmmac ethernet: unify locking
From: Pavel Machek @ 2016-11-24 10:46 UTC (permalink / raw)
To: peppe.cavallaro, netdev, kernel list, ezequiel, sonic.zhang,
fabrice.gasnier
In-Reply-To: <20161124103630.GB27793@amd>
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
Make locking match in both _xmit functions.
Signed-off-by: Pavel Machek <pavel@denx.de>
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0363db3..1cff258 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2185,12 +2185,12 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
spin_lock(&priv->tx_lock);
if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) {
- spin_unlock(&priv->tx_lock);
if (!netif_queue_stopped(dev)) {
netif_stop_queue(dev);
/* This is a hard error, log it. */
pr_err("%s: Tx Ring full when queue awake\n", __func__);
}
+ spin_unlock(&priv->tx_lock);
return NETDEV_TX_BUSY;
}
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply related
* [PATCH v2] ipv6:ipv6_pinfo dereferenced after NULL check
From: Manjeet Pawar @ 2016-11-24 10:41 UTC (permalink / raw)
To: davem, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
Cc: pankaj.m, ajeet.y, Rohit Thapliyal, Manjeet Pawar,
Hannes Frederic Sowa
From: Rohit Thapliyal <r.thapliyal@samsung.com>
np checked for NULL and then dereferenced. It should be modified
for NULL case.
Signed-off-by: Rohit Thapliyal <r.thapliyal@samsung.com>
Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>
---
v1->v2: Modified as per the suggestion of Hannes
np ? np->autoflowlabel : ip6_default_np_autolabel(net)
net/ipv6/ip6_output.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 59eb4ed..d734b5e 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -215,11 +215,14 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
*/
if (np)
hlimit = np->hop_limit;
+
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
- ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
- np->autoflowlabel, fl6));
+ ip6_flow_hdr(hdr, tclass,
+ ip6_make_flowlabel(net, skb, fl6->flowlabel,
+ np ? np->autoflowlabel : ip6_default_np_autolabel(net),
+ fl6));
hdr->payload_len = htons(seg_len);
hdr->nexthdr = proto;
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] igb: Explicitly select page 0 at initialization
From: Sergei Shtylyov @ 2016-11-24 10:36 UTC (permalink / raw)
To: Matwey V. Kornilov, jeffrey.t.kirsher
Cc: intel-wired-lan, netdev, linux-kernel, todd.fujinaka,
carolyn.wyborny, dchang, jcheung, matwey.kornilov, stable
In-Reply-To: <1479983568-4383-1-git-send-email-matwey@sai.msu.ru>
Hello.
On 11/24/2016 1:32 PM, Matwey V. Kornilov wrote:
> The functions igb_read_phy_reg_gs40g/igb_write_phy_reg_gs40g (which were
> removed in 2a3cdea) explicitly selected the required page at every phy_reg
This is not the way to cite a commit -- you need to specify at least 12
digits and follow them with the commit subject enclosed into ("").
> access. Currently, igb_get_phy_id_82575 relays on the fact that page 0 is
> already selected. The assumption is not fulfilled for my Lex 3I380CW
> motherboard with integrated dual i211 based gigabit ethernet. This leads to igb
> initialization failure and network interfaces are not working:
>
> igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
> igb: Copyright (c) 2007-2014 Intel Corporation.
> igb: probe of 0000:01:00.0 failed with error -2
> igb: probe of 0000:02:00.0 failed with error -2
>
> In order to fix it, we explicitly select page 0 before first access to phy
> registers.
>
> See also: https://bugzilla.suse.com/show_bug.cgi?id=1009911
> See also: http://www.lex.com.tw/products/pdf/3I380A&3I380CW.pdf
>
> Fixes: 2a3cdea ("igb: Remove GS40G specific defines/functions")
Again, at least 12 digits.
> Cc: <stable@vger.kernel.org> # 4.5+
> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
[...]
MBR, Sergei
^ permalink raw reply
* Re: stmmac ethernet in kernel 4.9-rc6: coalescing related pauses.
From: Pavel Machek @ 2016-11-24 10:36 UTC (permalink / raw)
To: peppe.cavallaro, netdev, kernel list, ezequiel, sonic.zhang,
fabrice.gasnier
In-Reply-To: <20161124102901.GA27793@amd>
[-- Attachment #1: Type: text/plain, Size: 3392 bytes --]
Hi!
> What is going on with all these likely()s? Likely new hardware owners
> will not be happy... or anyone running a lot of jumbo frames. (Perhaps
> CPU's branch prediction can do better job here, without explicit hints?)
>
> if (unlikely(is_jumbo) && likely(priv->synopsys_id <
> DWMAC_CORE_4_00)) {
Fix english, remove misleading unlikely's.
Signed-off-by: Pavel Machek <pavel@denx.de>
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e5a5a05..0363db3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2003,7 +2003,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
/* Compute header lengths */
proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
- /* Desc availability based on threshold should be enough safe */
+ /* Desc availability based on threshold should be safe enough */
if (unlikely(stmmac_tx_avail(priv) <
(((skb->len - proto_hdr_len) / TSO_MAX_BUFF_SIZE + 1)))) {
if (!netif_queue_stopped(dev)) {
@@ -2216,8 +2216,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
if (enh_desc)
is_jumbo = priv->hw->mode->is_jumbo_frm(skb->len, enh_desc);
- if (unlikely(is_jumbo) && likely(priv->synopsys_id <
- DWMAC_CORE_4_00)) {
+ if (unlikely(is_jumbo) && priv->synopsys_id < DWMAC_CORE_4_00) {
entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion);
if (unlikely(entry < 0))
goto dma_map_err;
@@ -2242,7 +2241,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
priv->tx_skbuff[entry] = NULL;
- if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00)) {
+ if (priv->synopsys_id >= DWMAC_CORE_4_00) {
desc->des0 = des;
priv->tx_skbuff_dma[entry].buf = desc->des0;
} else {
@@ -2319,7 +2318,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
if (dma_mapping_error(priv->device, des))
goto dma_map_err;
- if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00)) {
+ if (priv->synopsys_id >= DWMAC_CORE_4_00) {
first->des0 = des;
priv->tx_skbuff_dma[first_entry].buf = first->des0;
} else {
@@ -2438,7 +2437,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
break;
}
- if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00)) {
+ if (priv->synopsys_id >= DWMAC_CORE_4_00) {
p->des0 = priv->rx_skbuff_dma[entry];
p->des1 = 0;
} else {
@@ -2455,7 +2454,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
}
wmb();
- if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
+ if (priv->synopsys_id >= DWMAC_CORE_4_00)
priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0);
else
priv->hw->desc->set_rx_owner(p);
@@ -2545,7 +2544,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
int frame_len;
unsigned int des;
- if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
+ if (priv->synopsys_id >= DWMAC_CORE_4_00)
des = p->des0;
else
des = p->des2;
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply related
* [PATCH] igb: Explicitly select page 0 at initialization
From: Matwey V. Kornilov @ 2016-11-24 10:32 UTC (permalink / raw)
To: jeffrey.t.kirsher
Cc: intel-wired-lan, netdev, linux-kernel, todd.fujinaka,
carolyn.wyborny, dchang, jcheung, matwey.kornilov,
Matwey V. Kornilov, stable
The functions igb_read_phy_reg_gs40g/igb_write_phy_reg_gs40g (which were
removed in 2a3cdea) explicitly selected the required page at every phy_reg
access. Currently, igb_get_phy_id_82575 relays on the fact that page 0 is
already selected. The assumption is not fulfilled for my Lex 3I380CW
motherboard with integrated dual i211 based gigabit ethernet. This leads to igb
initialization failure and network interfaces are not working:
igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
igb: Copyright (c) 2007-2014 Intel Corporation.
igb: probe of 0000:01:00.0 failed with error -2
igb: probe of 0000:02:00.0 failed with error -2
In order to fix it, we explicitly select page 0 before first access to phy
registers.
See also: https://bugzilla.suse.com/show_bug.cgi?id=1009911
See also: http://www.lex.com.tw/products/pdf/3I380A&3I380CW.pdf
Fixes: 2a3cdea ("igb: Remove GS40G specific defines/functions")
Cc: <stable@vger.kernel.org> # 4.5+
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
---
drivers/net/ethernet/intel/igb/e1000_82575.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index a61447f..1264a36 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -246,6 +246,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
E1000_STATUS_FUNC_SHIFT;
/* Set phy->phy_addr and phy->id. */
+ igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 0);
ret_val = igb_get_phy_id_82575(hw);
if (ret_val)
return ret_val;
--
2.1.4
^ permalink raw reply related
* Re: stmmac ethernet in kernel 4.9-rc6: coalescing related pauses.
From: Pavel Machek @ 2016-11-24 10:29 UTC (permalink / raw)
To: peppe.cavallaro, netdev, kernel list, ezequiel, sonic.zhang,
fabrice.gasnier
In-Reply-To: <20161124085506.GA25007@amd>
[-- Attachment #1: Type: text/plain, Size: 3938 bytes --]
Hi!
What is going on with stmmac_tso_xmit() vs. stmmac_xmit()? One seems
to be copy of another, with subtle differences -- like calling
netif_queue_stopped() under spin_lock(&priv->tx_lock), or not.
What is going on with all these likely()s? Likely new hardware owners
will not be happy... or anyone running a lot of jumbo frames. (Perhaps
CPU's branch prediction can do better job here, without explicit hints?)
if (unlikely(is_jumbo) && likely(priv->synopsys_id <
DWMAC_CORE_4_00)) {
Are you sure this is okay?
if (unlikely(netif_queue_stopped(priv->dev) &&
stmmac_tx_avail(priv) > STMMAC_TX_THRESH)) {
netif_tx_lock(priv->dev);
if (netif_queue_stopped(priv->dev) &&
stmmac_tx_avail(priv) > STMMAC_TX_THRESH) {
---
Fix english in comments.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1f9ec02..e5a5a05 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1747,11 +1747,11 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
if (priv->hw->pcs && priv->hw->mac->pcs_ctrl_ane)
priv->hw->mac->pcs_ctrl_ane(priv->hw, 1, priv->hw->ps, 0);
- /* set TX ring length */
+ /* Set TX ring length */
if (priv->hw->dma->set_tx_ring_len)
priv->hw->dma->set_tx_ring_len(priv->ioaddr,
(DMA_TX_SIZE - 1));
- /* set RX ring length */
+ /* Set RX ring length */
if (priv->hw->dma->set_rx_ring_len)
priv->hw->dma->set_rx_ring_len(priv->ioaddr,
(DMA_RX_SIZE - 1));
@@ -2212,7 +2212,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
priv->tx_skbuff[first_entry] = skb;
enh_desc = priv->plat->enh_desc;
- /* To program the descriptors according to the size of the frame */
+ /* Program the descriptors according to the size of the frame */
if (enh_desc)
is_jumbo = priv->hw->mode->is_jumbo_frm(skb->len, enh_desc);
@@ -2665,7 +2665,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
* @budget : maximum number of packets that the current CPU can receive from
* all interfaces.
* Description :
- * To look at the incoming frames and clear the tx resources.
+ * Look at the incoming frames and clear the tx resources.
*/
static int stmmac_poll(struct napi_struct *napi, int budget)
{
@@ -2828,7 +2828,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
return IRQ_NONE;
}
- /* To handle GMAC own interrupts */
+ /* Handle GMAC own interrupts */
if ((priv->plat->has_gmac) || (priv->plat->has_gmac4)) {
int status = priv->hw->mac->host_irq_status(priv->hw,
&priv->xstats);
@@ -2853,7 +2853,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
}
}
- /* To handle DMA interrupts */
+ /* Handle DMA interrupts */
stmmac_dma_interrupt(priv);
return IRQ_HANDLED;
@@ -3145,7 +3145,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
priv->hw = mac;
- /* To use the chained or ring mode */
+ /* Use the chained or ring mode */
if (priv->synopsys_id >= DWMAC_CORE_4_00) {
priv->hw->mode = &dwmac4_ring_mode_ops;
} else {
@@ -3191,7 +3191,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
} else
pr_info(" No HW DMA feature register supported");
- /* To use alternate (extended), normal or GMAC4 descriptor structures */
+ /* Use alternate (extended), normal or GMAC4 descriptor structures */
if (priv->synopsys_id >= DWMAC_CORE_4_00)
priv->hw->desc = &dwmac4_desc_ops;
else
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply related
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