mlx4_en: Fix error handling while activating RX rings
Subsystems (2)
PATCH 1/5 mlx4_en: Fix error handling while activating RX rings
In case of failure of either srq creation or page allocation, the cleanup code handled the failed ring as well, and tried to destroy resources that where not allocated.
--- drivers/net/mlx4/en_rx.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/mlx4/en_rx.c +4 -2
@@ -436,8 +436,9 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)/* Initialize page allocators */ err =mlx4_en_init_allocator (priv, ring);if (err) { -mlx4_err (mdev,"Failed initializing ring allocator\n" ); - goto err_allocator; +mlx4_err (mdev,"Failed initializing ring allocator\n" ); + ring_ind--; + goto err_allocator; }/* Fill Rx buffers */
@@ -467,6 +468,7 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) ring->wqres.db.dma, &ring->srq);if (err){mlx4_err (mdev,"Failed to allocate srq\n" ); + ring_ind--; goto err_srq; } ring->srq.event = mlx4_en_srq_event;
Signature · 1 line
1.5.4
Re: [PATCH 2/5]mlx4_en: Fix a race at restart task
The query whether the port is up or not should be done at the execution of the restart task and not when it is queued.
--- drivers/net/mlx4/en_netdev.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/net/mlx4/en_netdev.c +11 -8
@@ -348,11 +348,9 @@ static void mlx4_en_tx_timeout(struct net_device *dev)if (netif_msg_timer (priv))mlx4_warn (mdev,"Tx timeout called on port:%d\n" , priv->port); -if (netif_carrier_ok (dev)) { - priv->port_stats.tx_timeout++; -mlx4_dbg (DRV , priv,"Scheduling watchdog\n" ); -queue_work (mdev->workqueue, &priv->watchdog_task); - } + priv->port_stats.tx_timeout++; +mlx4_dbg (DRV , priv,"Scheduling watchdog\n" ); +queue_work (mdev->workqueue, &priv->watchdog_task); }
@@ -761,9 +759,14 @@ static void mlx4_en_restart(struct work_struct *work)struct net_device *dev = priv->dev;mlx4_dbg (DRV , priv,"Watchdog task called for port %d\n" , priv->port); -mlx4_en_stop_port (dev); -if (mlx4_en_start_port (dev)) -mlx4_err (mdev,"Failed restarting port %d\n" , priv->port); + +mutex_lock (&mdev->state_lock); +if (priv->port_up) { +mlx4_en_stop_port (dev); +if (mlx4_en_start_port (dev)) +mlx4_err (mdev,"Failed restarting port %d\n" , priv->port); + } +mutex_unlock (&mdev->state_lock); }
Signature · 1 line
1.5.4
PATCH 3/5 mlx4_en: Assign dummy event handler for TX queue
In reply to Yevgeny PetrilinThe low level driver always assumes this handler exists. The lack of it could cause kernel panic
--- drivers/net/mlx4/en_resources.c | 6 ++++++ drivers/net/mlx4/en_rx.c | 6 ------ drivers/net/mlx4/en_tx.c | 1 + drivers/net/mlx4/mlx4_en.h | 1 + 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/mlx4/en_resources.c +6 -0
@@ -94,3 +94,9 @@ void mlx4_en_unmap_buffer(struct mlx4_buf *buf)vunmap (buf->direct.buf); } + +void mlx4_en_sqp_event (struct mlx4_qp *qp,enum mlx4_event event) +{ +return ; +} +
drivers/net/mlx4/en_rx.c +0 -6
@@ -928,12 +928,6 @@ void mlx4_en_set_default_rss_map(struct mlx4_en_priv *priv, } } -static void mlx4_en_sqp_event (struct mlx4_qp *qp,enum mlx4_event event) -{ -return ; -} - - static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn, int srqn, int cqn, enum mlx4_qp_state *state,
drivers/net/mlx4/en_tx.c +1 -0
@@ -112,6 +112,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,mlx4_err (mdev,"Failed allocating qp %d\n" , ring->qpn); goto err_reserve; } + ring->qp.event = mlx4_en_sqp_event;return 0 ;
drivers/net/mlx4/mlx4_en.h +1 -0
@@ -538,6 +538,7 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget);void mlx4_en_fill_qp_context (struct mlx4_en_priv *priv,int size,int stride,int is_tx,int rss,int qpn,int cqn,int srqn,struct mlx4_qp_context *context); +void mlx4_en_sqp_event (struct mlx4_qp *qp,enum mlx4_event event);int mlx4_en_map_buffer (struct mlx4_buf *buf);void mlx4_en_unmap_buffer (struct mlx4_buf *buf);
Signature · 1 line
1.5.4
PATCH 4/5 mlx4_en: use NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM for tx csum at initialization
In reply to Yevgeny PetrilinThe former usage was to set the NETIF_F_HW_CSUM flag which is not used in get_tx_csum. It caused Ethtool to show tx checksum as "on" even though it was turned off in previous operation.
--- drivers/net/mlx4/en_netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/mlx4/en_netdev.c +1 -1
@@ -1057,7 +1057,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,* Set driver features */ dev->features |=NETIF_F_SG ; - dev->features |=NETIF_F_HW_CSUM ; + dev->features |=NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM ; dev->features |=NETIF_F_HIGHDMA ; dev->features |=NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
Signature · 1 line
1.5.4
PATCH 5/5 mlx4_en: Move to SW counters for total bytes and packets
The per ring counters are implemented in SW. Now moving to have the total counters as the sum of all rings. This way the numbers will always be consistent and we no longer depend on HW buffer size limitations for those counters that can be insufficient in some cases.
--- drivers/net/mlx4/en_port.c | 45 ++++++++++++------------------------------- 1 files changed, 13 insertions(+), 32 deletions(-)
drivers/net/mlx4/en_port.c +13 -32
@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)struct mlx4_cmd_mailbox *mailbox;u64 in_mod = reset <<8 | port;int err; +int i; mailbox =mlx4_alloc_cmd_mailbox (mdev->dev);if (IS_ERR (mailbox))
@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)spin_lock_bh (&priv->stats_lock); - stats->rx_packets =be32_to_cpu (mlx4_en_stats->RTOTFRMS) - -be32_to_cpu (mlx4_en_stats->RDROP); - stats->tx_packets =be64_to_cpu (mlx4_en_stats->TTOT_prio_0) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_1) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_2) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_3) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_4) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_5) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_6) + -be64_to_cpu (mlx4_en_stats->TTOT_prio_7) + -be64_to_cpu (mlx4_en_stats->TTOT_novlan) + -be64_to_cpu (mlx4_en_stats->TTOT_loopbk); - stats->rx_bytes =be64_to_cpu (mlx4_en_stats->ROCT_prio_0) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_1) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_2) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_3) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_4) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_5) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_6) + -be64_to_cpu (mlx4_en_stats->ROCT_prio_7) + -be64_to_cpu (mlx4_en_stats->ROCT_novlan); - - stats->tx_bytes =be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_0) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_1) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_2) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_3) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_4) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_5) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_6) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_prio_7) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_novlan) + -be64_to_cpu (mlx4_en_stats->TTTLOCT_loopbk); + stats->rx_packets =0 ; + stats->rx_bytes =0 ; +for (i =0 ; i < priv->rx_ring_num; i++) { + stats->rx_packets += priv->rx_ring[i].packets; + stats->rx_bytes += priv->rx_ring[i].bytes; + } + stats->tx_packets =0 ; + stats->tx_bytes =0 ; +for (i =0 ; i <= priv->tx_ring_num; i++) { + stats->tx_packets += priv->tx_ring[i].packets; + stats->tx_bytes += priv->tx_ring[i].bytes; + } stats->rx_errors =be64_to_cpu (mlx4_en_stats->PCS) + be32_to_cpu(mlx4_en_stats->RdropLength) +
Signature · 1 line
1.5.4
PATCH 1/1 mlx4_en: Fix cleanup if workqueue create in mlx4_en_add() fails
In reply to Yevgeny PetrilinIf creating a workqueue fails, don't jump to the error path where that same workqueue is destroyed, since destroy_workqueue() can't handle a NULL pointer.
This was spotted by the Coverity checker (CID 2617).
--- drivers/net/mlx4/en_main.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/mlx4/en_main.c +2 -3
@@ -181,7 +181,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev) mdev->workqueue =create_singlethread_workqueue ("mlx4_en" );if (!mdev->workqueue) { err = -ENOMEM ; - goto err_close_nic; + goto err_mr; }/* At this stage all non-port specific tasks are complete:
@@ -214,9 +214,8 @@ err_free_netdev:flush_workqueue (mdev->workqueue);/* Stop event queue before we drop down to release shared SW state */ - -err_close_nic:destroy_workqueue (mdev->workqueue); + err_mr:mlx4_mr_free (dev, &mdev->mr); err_uar:
From: Yevgeny Petrilin <[email protected]>
Date: Mon, 20 Apr 2009 17:24:28 +0300
Quoted 5 lines
In case of failure of either srq creation or page allocation, the cleanup code handled the failed ring as well, and tried to destroy resources that where not allocated.
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
Re: [PATCH 2/5]mlx4_en: Fix a race at restart task
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Mon, 20 Apr 2009 17:26:05 +0300
Quoted 4 lines
The query whether the port is up or not should be done at the execution of the restart task and not when it is queued.
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
Re: [PATCH 3/5] mlx4_en: Assign dummy event handler for TX queue
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Mon, 20 Apr 2009 17:30:03 +0300
Quoted 4 lines
The low level driver always assumes this handler exists. The lack of it could cause kernel panic
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
Re: [PATCH 4/5] mlx4_en: use NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM for tx csum at initialization
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Mon, 20 Apr 2009 17:33:15 +0300
Quoted 5 lines
The former usage was to set the
NETIF_F_HW_CSUMflag which is not used inget_tx_csum. It caused Ethtool to show tx checksum as "on" even though it was turned off in previous operation.Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
Re: [PATCH 5/5] mlx4_en: Move to SW counters for total bytes and packets
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Mon, 20 Apr 2009 17:34:38 +0300
Quoted 6 lines
The per ring counters are implemented in SW. Now moving to have the total counters as the sum of all rings. This way the numbers will always be consistent and we no longer depend on HW buffer size limitations for those counters that can be insufficient in some cases.
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
Re: [PATCH] mlx4_en: Fix cleanup if workqueue create in mlx4_en_add() fails
In reply to Roland DreierFrom: Roland Dreier <[email protected]>
Date: Mon, 20 Apr 2009 21:32:08 -0700
Quoted 7 lines
If creating a workqueue fails, don't jump to the error path where that same workqueue is destroyed, since
destroy_workqueue()can't handle a NULL pointer.This was spotted by the Coverity checker (CID 2617).
Signed-off-by Roland Dreier <[email protected]>
Applied.
PATCH 1/2 mlx4_en: Fix cleanup flow on cq activation
In reply to Yevgeny PetrilinIn case of mlx4_en_activate_cq() failure, the cleanup code would go to rx_err and try to disable unactivated rings.
--- drivers/net/mlx4/en_netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/mlx4/en_netdev.c +1 -1
@@ -583,7 +583,7 @@ int mlx4_en_start_port(struct net_device *dev) err =mlx4_en_activate_cq (priv, cq);if (err) {mlx4_err (mdev,"Failed activating Rx CQ\n" ); - goto rx_err; + goto cq_err; }for (j =0 ; j < cq->size; j++) cq->buf[j].owner_sr_opcode =MLX4_CQE_OWNER_MASK ;
--
PATCH 2/2 mlx4_en: Handle page allocation failure during receive
In reply to Yevgeny PetrilinIf we failed to allocate new fragments for receive buffer, the packet should be dropped and packets should be reused.
--- drivers/net/mlx4/en_rx.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/mlx4/en_rx.c +4 -0
@@ -610,6 +610,10 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv, used_frags =mlx4_en_complete_rx_desc (priv, rx_desc, skb_frags,skb_shinfo (skb)->frags, page_alloc, length); +if (unlikely (!used_frags)) { +kfree_skb (skb); +return NULL ; + }skb_shinfo (skb)->nr_frags = used_frags;/* Copy headers into the skb linear buffer */
Re: [PATCH 1/2] mlx4_en: Fix cleanup flow on cq activation
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Mon, 27 Apr 2009 09:41:34 +0300
Quoted 4 lines
In case of
mlx4_en_activate_cq()failure, the cleanup code would go torx_errand try to disable unactivated rings.Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
Re: [PATCH 2/2] mlx4_en: Handle page allocation failure during receive
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Mon, 27 Apr 2009 09:42:57 +0300
Quoted 4 lines
If we failed to allocate new fragments for receive buffer, the packet should be dropped and packets should be reused.
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.
PATCH 1/1 mlx4_en: Fix not deleted napi structures
In reply to Yevgeny PetrilinNapi structures are being created each time we open a port, but when the port is closed the napi structure is only disabled but not removed. This bug caused hang while removing the driver.
--- drivers/net/mlx4/en_cq.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/mlx4/en_cq.c +3 -1
@@ -125,8 +125,10 @@ void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)if (cq->is_tx)del_timer (&cq->timer); -else +else {napi_disable (&cq->napi); +netif_napi_del (&cq->napi); + }mlx4_cq_free (mdev->dev, &cq->mcq); }
Signature · 1 line
1.6.0
Re: [PATCH] mlx4_en: Fix not deleted napi structures
From: Yevgeny Petrilin <[email protected]>
Date: Wed, 13 May 2009 14:47:22 +0300
Quoted 5 lines
Napi structures are being created each time we open a port, but when the port is closed the napi structure is only disabled but not removed. This bug caused hang while removing the driver.
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied, thanks!
PATCH 1/2 mlx4_en: Removed redundant stride variable
In reply to Yevgeny Petrilin--- drivers/net/mlx4/en_netdev.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/net/mlx4/en_netdev.c +0 -3
@@ -559,7 +559,6 @@ int mlx4_en_start_port(struct net_device *dev)struct mlx4_en_rx_ring *rx_ring;int rx_index =0 ;int tx_index =0 ; -u16 stride;int err =0 ;int i;int j;
@@ -573,8 +572,6 @@ int mlx4_en_start_port(struct net_device *dev) dev->mtu =min (dev->mtu, priv->max_mtu);mlx4_en_calc_rx_buf (dev);mlx4_dbg (DRV , priv,"Rx buf size:%d\n" , priv->rx_skb_size); - stride =roundup_pow_of_two (sizeof (struct mlx4_en_rx_desc ) + -DS_SIZE * priv->num_frags);/* Configure rx cq's and rings */ for (i =0 ; i < priv->rx_ring_num; i++) { cq = &priv->rx_cq[i];
Signature · 1 line
1.6.0
PATCH 2/2 mlx4_en: Fix partial rings feature
In reply to Yevgeny PetrilinIn case of allocation failure, the actual ring size is rounded down to nearest power of 2. The remaining descriptors are freed.
The CQ and SRQ are allocated with the actual size and the mask is updated.
--- drivers/net/mlx4/en_cq.c | 3 ++ drivers/net/mlx4/en_netdev.c | 23 ++++++-------- drivers/net/mlx4/en_rx.c | 71 ++++++++++++++++++++++++++--------------- 3 files changed, 58 insertions(+), 39 deletions(-)
drivers/net/mlx4/en_cq.c +3 -0
@@ -89,6 +89,9 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) *cq->mcq.arm_db =0 ;memset (cq->buf,0 , cq->buf_size); +if (!cq->is_tx) + cq->size = priv->rx_ring[cq->ring].actual_size; + err =mlx4_cq_alloc (mdev->dev, cq->size, &cq->wqres.mtt, &mdev->priv_uar, cq->wqres.db.dma, &cq->mcq, cq->vector, cq->is_tx);if (err)
drivers/net/mlx4/en_netdev.c +10 -13
@@ -556,7 +556,6 @@ int mlx4_en_start_port(struct net_device *dev)struct mlx4_en_dev *mdev = priv->mdev;struct mlx4_en_cq *cq;struct mlx4_en_tx_ring *tx_ring; -struct mlx4_en_rx_ring *rx_ring;int rx_index =0 ;int tx_index =0 ;int err =0 ;
@@ -572,10 +571,15 @@ int mlx4_en_start_port(struct net_device *dev) dev->mtu =min (dev->mtu, priv->max_mtu);mlx4_en_calc_rx_buf (dev);mlx4_dbg (DRV , priv,"Rx buf size:%d\n" , priv->rx_skb_size); +/* Configure rx cq's and rings */ + err =mlx4_en_activate_rx_rings (priv); +if (err) { +mlx4_err (mdev,"Failed to activate RX rings\n" ); +return err; + }for (i =0 ; i < priv->rx_ring_num; i++) { cq = &priv->rx_cq[i]; - rx_ring = &priv->rx_ring[i]; err =mlx4_en_activate_cq (priv, cq);if (err) {
@@ -591,20 +595,14 @@ int mlx4_en_start_port(struct net_device *dev) goto cq_err; }mlx4_en_arm_cq (priv, cq); - + priv->rx_ring[i].cqn = cq->mcq.cqn; ++rx_index; } - err =mlx4_en_activate_rx_rings (priv); -if (err) { -mlx4_err (mdev,"Failed to activate RX rings\n" ); - goto cq_err; - } - err =mlx4_en_config_rss_steer (priv);if (err) {mlx4_err (mdev,"Failed configuring rss steering\n" ); - goto rx_err; + goto cq_err; }/* Configure tx cq's and rings */
@@ -691,12 +689,11 @@ tx_err: }mlx4_en_release_rss_steer (priv); -rx_err: -for (i =0 ; i < priv->rx_ring_num; i++) -mlx4_en_deactivate_rx_ring (priv, &priv->rx_ring[i]); cq_err:while (rx_index--)mlx4_en_deactivate_cq (priv, &priv->rx_cq[rx_index]); +for (i =0 ; i < priv->rx_ring_num; i++) +mlx4_en_deactivate_rx_ring (priv, &priv->rx_ring[i]);return err;/* need to close devices */ }
drivers/net/mlx4/en_rx.c +45 -26
122 lines not on this page · raw message
Signature · 1 line
1.6.0
Re: [PATCH 1/2] mlx4_en: Removed redundant stride variable
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Sun, 24 May 2009 16:16:51 +0300
Quoted 1 line
Signed-off-by Yevgeny Petrilin <[email protected]>
Applied to net-next-2.6
Re: [PATCH 2/2] mlx4_en: Fix partial rings feature
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Sun, 24 May 2009 16:17:11 +0300
Quoted 5 lines
In case of allocation failure, the actual ring size is rounded down to nearest power of 2. The remaining descriptors are freed.
The CQ and SRQ are allocated with the actual size and the mask is updated.Signed-off-by Yevgeny Petrilin <[email protected]>
Applied to net-next-2.6
PATCH 1/1 mlx4_en: Fix a kernel panic when waking tx queue
In reply to Yevgeny PetrilinThis patch fixes a kernel panic when waking the TX queue from irq context.
--- drivers/net/mlx4/en_tx.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/mlx4/en_tx.c +6 -5
@@ -326,7 +326,8 @@ void mlx4_en_set_prio_map(struct mlx4_en_priv *priv, u16 *prio_map, u32 ring_num } } -static void mlx4_en_process_tx_cq (struct net_device *dev,struct mlx4_en_cq *cq) +static void mlx4_en_process_tx_cq (struct net_device *dev, +struct mlx4_en_cq *cq,int poll) {struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_cq *mcq = &cq->mcq;
@@ -383,7 +384,7 @@ static void mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq) ring->cons += txbbs_skipped;/* Wakeup Tx queue if this ring stopped it */ -if (unlikely (ring->blocked)) { +if (unlikely (ring->blocked) && poll) {if ((u32) (ring->prod - ring->cons) <= ring->size -HEADROOM -MAX_DESC_TXBBS ) {
@@ -411,7 +412,7 @@ void mlx4_en_tx_irq(struct mlx4_cq *mcq)if (!spin_trylock (&ring->comp_lock))return ; -mlx4_en_process_tx_cq (cq->dev, cq); +mlx4_en_process_tx_cq (cq->dev, cq,0 );mod_timer (&cq->timer, jiffies +1 );spin_unlock (&ring->comp_lock); }
@@ -430,7 +431,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)mod_timer (&cq->timer, jiffies +MLX4_EN_TX_POLL_TIMEOUT );return ; } -mlx4_en_process_tx_cq (cq->dev, cq); +mlx4_en_process_tx_cq (cq->dev, cq,1 ); inflight = (u32) (ring->prod - ring->cons - ring->last_nr_txbb);/* If there are still packets in flight and the timer has not already
@@ -483,7 +484,7 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)/* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER -1 )) ==0 )if (spin_trylock (&ring->comp_lock)) { -mlx4_en_process_tx_cq (priv->dev, cq); +mlx4_en_process_tx_cq (priv->dev, cq,1 );spin_unlock (&ring->comp_lock); } }
Signature · 1 line
1.6.0
David Miller
maintainerRe: [net-2.6 PATCH] mlx4_en: Fix a kernel panic when waking tx queue
From: Yevgeny Petrilin <[email protected]>
Date: Mon, 25 May 2009 11:32:42 +0300
Quoted 4 lines
This patch fixes a kernel panic when waking the TX queue from irq context.
Signed-off-by Yevgeny Petrilin <[email protected]>
Why does it fix a panic? What does the panic look like? What causes it?
Commit message is way too terse, please fix this and resubmit.
Re: [net-2.6 PATCH] mlx4_en: Fix a kernel panic when waking tx queue
Quoted 6 lines · David Miller
From: Yevgeny Petrilin <[email protected]>
Date: Mon, 25 May 2009 11:32:42 +0300Quoted 3 lines
This patch fixes a kernel panic when waking the TX queue from irq context.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yevgeny Petrilin <[email protected]>Why does it fix a panic? What does the panic look like? What causes it?
Commit message is way too terse, please fix this and resubmit.
Hello Dave,
I did some further investigation on this case.
The patch that I sent was only handling the symptoms instead of fixing the problem. The panic was caused due to a race when handling TX completions and waking the queue if it was stopped. When the transmit queue gets full, the driver enables interrupts for TX completions in order to handle them as fast as possible.
The result was that the driver approached the transmit queue from several different contexts and this was the bug.
I prepared a new patch fixing the race, it was running for several hours now, the bug didn't happen.
Thanks,
Yevgeny
PATCH v2 1/1 mlx4_en: Fix a kernel panic when waking tx queue
In reply to Yevgeny PetrilinWhen the transmit queue gets full we enable interrupts for TX completions There was a race that we handled the TX queue both from the interrupt context and from the transmit function. Using "spin_trylock_irq()" ensures this doesn't happen.
--- drivers/net/mlx4/en_tx.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/mlx4/en_tx.c +4 -4
@@ -426,7 +426,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)INC_PERF_COUNTER (priv->pstats.tx_poll); -if (!spin_trylock (&ring->comp_lock)) { +if (!spin_trylock_irq (&ring->comp_lock)) {mod_timer (&cq->timer, jiffies +MLX4_EN_TX_POLL_TIMEOUT );return ; }
@@ -439,7 +439,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)if (inflight && priv->port_up)mod_timer (&cq->timer, jiffies +MLX4_EN_TX_POLL_TIMEOUT ); -spin_unlock (&ring->comp_lock); +spin_unlock_irq (&ring->comp_lock); } static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv,
@@ -482,9 +482,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)/* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER -1 )) ==0 ) -if (spin_trylock (&ring->comp_lock)) { +if (spin_trylock_irq (&ring->comp_lock)) {mlx4_en_process_tx_cq (priv->dev, cq); -spin_unlock (&ring->comp_lock); +spin_unlock_irq (&ring->comp_lock); } }
Signature · 1 line
1.6.0
Re: [net-2.6 PATCH V2] mlx4_en: Fix a kernel panic when waking tx queue
Quoted 34 lines · Yevgeny Petrilin
When the transmit queue gets full we enable interrupts for TX completions There was a race that we handled the TX queue both from the interrupt context and from the transmit function. Using "
spin_trylock_irq()" ensures this doesn't happen.Signed-off-by Yevgeny Petrilin <[email protected]>--- drivers/net/mlx4/en_tx.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)drivers/net/mlx4/en_tx.c +2
-2@@ -426,7 +426,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)INC_PERF_COUNTER (priv->pstats.tx_poll); -if (!spin_trylock (&ring->comp_lock)) { +if (!spin_trylock_irq (&ring->comp_lock)) {mod_timer (&cq->timer, jiffies +MLX4_EN_TX_POLL_TIMEOUT );return ; }@@ -439,7 +439,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)if (inflight && priv->port_up)mod_timer (&cq->timer, jiffies +MLX4_EN_TX_POLL_TIMEOUT ); -spin_unlock (&ring->comp_lock); +spin_unlock_irq (&ring->comp_lock); } static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv,@@ -482,9 +482,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
drivers/net/mlx4/en_tx.c static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind) · line 490
Quoted 10 lines
drivers/net/mlx4/en_tx.c +2
-2/* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER -1 )) ==0 ) -if (spin_trylock (&ring->comp_lock)) { +if (spin_trylock_irq (&ring->comp_lock)) {mlx4_en_process_tx_cq (priv->dev, cq); -spin_unlock (&ring->comp_lock); +spin_unlock_irq (&ring->comp_lock); } }
Just curious.
Blocking hard IRQ while doing TX completion is quite nasty, as freeing one hundred of skb take long.
Could you try something in process context instead ?
Is this timer driven tx completion thing really good for performance ?
static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
{
struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind];
struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind];
/* If we don't have a pending timer, set one up to catch our recent
post in case the interface becomes idle */
if (!timer_pending(&cq->timer))
mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT);
/* Poll the CQ every mlx4_en_TX_MODER_POLL packets */
if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0)
if (spin_trylock(&ring->comp_lock)) {
mlx4_en_process_tx_cq(priv->dev, cq);
spin_unlock(&ring->comp_lock);
}
}One interesting thing is calling mlx4_en_process_tx_cq() once every 16 packets, this means the producer cpu is also the cpu doing the TX completion, I like this.
Re: [net-2.6 PATCH V2] mlx4_en: Fix a kernel panic when waking tx queue
Hi Eric,
Quoted 7 lines · Eric Dumazet
Just curious.
Blocking hard IRQ while doing TX completion is quite nasty, as freeing one hundred of skb take long.
Could you try something in process context instead ?
I am planning some changes for handling TX completions, but I think it is too late to
add them to 2.6.30.
In the code that will be submitted to 2.6.31 we will not block irqs.
Quoted 3 lines
Is this timer driven tx completion thing really good for performance ?
When we are CPU bounded on the transmit side, the driver shown better performance with
the timer driven completions rather then with interrupts.
David Miller
maintainerRe: [net-2.6 PATCH V2] mlx4_en: Fix a kernel panic when waking tx queue
In reply to Yevgeny PetrilinFrom: Yevgeny Petrilin <[email protected]>
Date: Tue, 26 May 2009 09:57:21 +0300
Quoted 6 lines
When the transmit queue gets full we enable interrupts for TX completions There was a race that we handled the TX queue both from the interrupt context and from the transmit function. Using "
spin_trylock_irq()" ensures this doesn't happen.Signed-off-by Yevgeny Petrilin <[email protected]>
I'll apply this, thanks.
PATCH 1/8 mlx4_en: Giving interface name in debug messages
In reply to Yevgeny PetrilinFor each debug message, the message will show interface name in case that the net device was registered, and PCI bus ID with port number if we were not registered yet. Messages that are not port/netdev specific stayed in the old format
--- drivers/net/mlx4/en_netdev.c | 162 ++++++++++++++++++++---------------------- drivers/net/mlx4/en_params.c | 6 +- drivers/net/mlx4/en_rx.c | 78 ++++++++++----------- drivers/net/mlx4/en_tx.c | 39 +++++----- drivers/net/mlx4/mlx4_en.h | 30 ++++++-- 5 files changed, 159 insertions(+), 156 deletions(-)
drivers/net/mlx4/en_netdev.c +77 -85
@@ -51,14 +51,14 @@ static void mlx4_en_vlan_rx_register(struct net_device *dev, struct vlan_group *struct mlx4_en_dev *mdev = priv->mdev;int err; -mlx4_dbg (HW , priv,"Registering VLAN group:%p\n" , grp); +en_dbg (HW , priv,"Registering VLAN group:%p\n" , grp); priv->vlgrp = grp;mutex_lock (&mdev->state_lock);if (mdev->device_up && priv->port_up) { err =mlx4_SET_VLAN_FLTR (mdev->dev, priv->port, grp);if (err) -mlx4_err (mdev,"Failed configuring VLAN filter\n" ); +en_err (priv,"Failed configuring VLAN filter\n" ); }mutex_unlock (&mdev->state_lock); }
@@ -72,15 +72,15 @@ static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)if (!priv->vlgrp)return ; -mlx4_dbg (HW , priv,"adding VLAN:%d (vlgrp entry:%p)\n" , - vid,vlan_group_get_device (priv->vlgrp, vid)); +en_dbg (HW , priv,"adding VLAN:%d (vlgrp entry:%p)\n" , + vid,vlan_group_get_device (priv->vlgrp, vid));/* Add VID to port VLAN filter */ mutex_lock (&mdev->state_lock);if (mdev->device_up && priv->port_up) { err =mlx4_SET_VLAN_FLTR (mdev->dev, priv->port, priv->vlgrp);if (err) -mlx4_err (mdev,"Failed configuring VLAN filter\n" ); +en_err (priv,"Failed configuring VLAN filter\n" ); }mutex_unlock (&mdev->state_lock); }
@@ -94,9 +94,8 @@ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)if (!priv->vlgrp)return ; -mlx4_dbg (HW , priv,"Killing VID:%d (vlgrp:%p vlgrp " -"entry:%p)\n" , vid, priv->vlgrp, -vlan_group_get_device (priv->vlgrp, vid)); +en_dbg (HW , priv,"Killing VID:%d (vlgrp:%p vlgrp entry:%p)\n" , + vid, priv->vlgrp,vlan_group_get_device (priv->vlgrp, vid));vlan_group_set_device (priv->vlgrp, vid,NULL );/* Remove VID from port VLAN filter */
@@ -104,7 +103,7 @@ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)if (mdev->device_up && priv->port_up) { err =mlx4_SET_VLAN_FLTR (mdev->dev, priv->port, priv->vlgrp);if (err) -mlx4_err (mdev,"Failed configuring VLAN filter\n" ); +en_err (priv,"Failed configuring VLAN filter\n" ); }mutex_unlock (&mdev->state_lock); }
@@ -150,9 +149,10 @@ static void mlx4_en_do_set_mac(struct work_struct *work) err =mlx4_register_mac (mdev->dev, priv->port, priv->mac, &priv->mac_index);if (err) -mlx4_err (mdev,"Failed changing HW MAC address\n" ); +en_err (priv,"Failed changing HW MAC address\n" ); }else -mlx4_dbg (HW , priv,"Port is down, exiting...\n" ); +en_dbg (HW , priv,"Port is down while " +"registering mac, exiting...\n" );mutex_unlock (&mdev->state_lock); }
@@ -174,7 +174,6 @@ static void mlx4_en_clear_list(struct net_device *dev)static void mlx4_en_cache_mclist (struct net_device *dev) {struct mlx4_en_priv *priv =netdev_priv (dev); -struct mlx4_en_dev *mdev = priv->mdev;struct dev_mc_list *mclist;struct dev_mc_list *tmp;struct dev_mc_list *plist =NULL ;
@@ -182,7 +181,7 @@ static void mlx4_en_cache_mclist(struct net_device *dev)for (mclist = dev->mc_list; mclist; mclist = mclist->next) { tmp =kmalloc (sizeof (struct dev_mc_list ),GFP_ATOMIC );if (!tmp) { -mlx4_err (mdev,"failed to allocate multicast list\n" ); +en_err (priv,"failed to allocate multicast list\n" );mlx4_en_clear_list (dev);return ; }
@@ -219,13 +218,13 @@ static void mlx4_en_do_set_multicast(struct work_struct *work)mutex_lock (&mdev->state_lock);if (!mdev->device_up) { -mlx4_dbg (HW , priv,"Card is not up, ignoring " -"multicast change.\n" ); +en_dbg (HW , priv,"Card is not up, " +"ignoring multicast change.\n" ); goto out; }if (!priv->port_up) { -mlx4_dbg (HW , priv,"Port is down, ignoring " -"multicast change.\n" ); +en_dbg (HW , priv,"Port is down, " +"ignoring multicast change.\n" ); goto out; }
@@ -236,29 +235,27 @@ static void mlx4_en_do_set_multicast(struct work_struct *work)if (dev->flags &IFF_PROMISC ) {if (!(priv->flags &MLX4_EN_FLAG_PROMISC )) {if (netif_msg_rx_status (priv)) -mlx4_warn (mdev,"Port:%d entering promiscuous mode\n" , - priv->port); +en_warn (priv,"Entering promiscuous mode\n" ); priv->flags |=MLX4_EN_FLAG_PROMISC ;/* Enable promiscouos mode */ err =mlx4_SET_PORT_qpn_calc (mdev->dev, priv->port, priv->base_qpn,1 );if (err) -mlx4_err (mdev,"Failed enabling " -"promiscous mode\n" ); +en_err (priv,"Failed enabling " +"promiscous mode\n" );/* Disable port multicast filter (unconditionally) */ err =mlx4_SET_MCAST_FLTR (mdev->dev, priv->port,0 ,0 ,MLX4_MCAST_DISABLE );if (err) -mlx4_err (mdev,"Failed disabling " -"multicast filter\n" ); +en_err (priv,"Failed disabling " +"multicast filter\n" );/* Disable port VLAN filter */ err =mlx4_SET_VLAN_FLTR (mdev->dev, priv->port,NULL );if (err) -mlx4_err (mdev,"Failed disabling " -"VLAN filter\n" ); +en_err (priv,"Failed disabling VLAN filter\n" ); } goto out; }
@@ -269,20 +266,19 @@ static void mlx4_en_do_set_multicast(struct work_struct *work)if (priv->flags &MLX4_EN_FLAG_PROMISC ) {if (netif_msg_rx_status (priv)) -mlx4_warn (mdev,"Port:%d leaving promiscuous mode\n" , - priv->port); +en_warn (priv,"Leaving promiscuous mode\n" ); priv->flags &= ~MLX4_EN_FLAG_PROMISC ;/* Disable promiscouos mode */ err =mlx4_SET_PORT_qpn_calc (mdev->dev, priv->port, priv->base_qpn,0 );if (err) -mlx4_err (mdev,"Failed disabling promiscous mode\n" ); +en_err (priv,"Failed disabling promiscous mode\n" );/* Enable port VLAN filter */ err =mlx4_SET_VLAN_FLTR (mdev->dev, priv->port, priv->vlgrp);if (err) -mlx4_err (mdev,"Failed enabling VLAN filter\n" ); +en_err (priv,"Failed enabling VLAN filter\n" ); }/* Enable/disable the multicast filter according to IFF_ALLMULTI */
@@ -290,12 +286,12 @@ static void mlx4_en_do_set_multicast(struct work_struct *work) err =mlx4_SET_MCAST_FLTR (mdev->dev, priv->port,0 ,0 ,MLX4_MCAST_DISABLE );if (err) -mlx4_err (mdev,"Failed disabling multicast filter\n" ); +en_err (priv,"Failed disabling multicast filter\n" ); }else { err =mlx4_SET_MCAST_FLTR (mdev->dev, priv->port,0 ,0 ,MLX4_MCAST_DISABLE );if (err) -mlx4_err (mdev,"Failed disabling multicast filter\n" ); +en_err (priv,"Failed disabling multicast filter\n" );/* Flush mcast filter and init it with broadcast address */ mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, ETH_BCAST,
@@ -314,7 +310,7 @@ static void mlx4_en_do_set_multicast(struct work_struct *work) err =mlx4_SET_MCAST_FLTR (mdev->dev, priv->port,0 ,0 ,MLX4_MCAST_ENABLE );if (err) -mlx4_err (mdev,"Failed enabling multicast filter\n" ); +en_err (priv,"Failed enabling multicast filter\n" );mlx4_en_clear_list (dev); }
@@ -346,10 +342,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev)struct mlx4_en_dev *mdev = priv->mdev;if (netif_msg_timer (priv)) -mlx4_warn (mdev,"Tx timeout called on port:%d\n" , priv->port); +en_warn (priv,"Tx timeout called on port:%d\n" , priv->port); priv->port_stats.tx_timeout++; -mlx4_dbg (DRV , priv,"Scheduling watchdog\n" ); +en_dbg (DRV , priv,"Scheduling watchdog\n" );queue_work (mdev->workqueue, &priv->watchdog_task); }
@@ -378,8 +374,8 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)*/ priv->rx_frames =MLX4_EN_RX_COAL_TARGET / priv->dev->mtu +1 ; priv->rx_usecs =MLX4_EN_RX_COAL_TIME ; -mlx4_dbg (INTR , priv,"Default coalesing params for mtu:%d - " -"rx_frames:%d rx_usecs:%d\n" , +en_dbg (INTR , priv,"Default coalesing params for mtu:%d - " +"rx_frames:%d rx_usecs:%d\n" , priv->dev->mtu, priv->rx_frames, priv->rx_usecs);/* Setup cq moderation params */
@@ -412,7 +408,6 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)static void mlx4_en_auto_moderation (struct mlx4_en_priv *priv) {unsigned long period = (unsigned long ) (jiffies - priv->last_moder_jiffies); -struct mlx4_en_dev *mdev = priv->mdev;struct mlx4_en_cq *cq;unsigned long packets;unsigned long rate;
@@ -472,11 +467,11 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) moder_time = priv->rx_usecs; } -mlx4_dbg (INTR , priv,"tx rate:%lu rx_rate:%lu\n" , - tx_pkt_diff *HZ / period, rx_pkt_diff *HZ / period); +en_dbg (INTR , priv,"tx rate:%lu rx_rate:%lu\n" , + tx_pkt_diff *HZ / period, rx_pkt_diff *HZ / period); -mlx4_dbg (INTR , priv,"Rx moder_time changed from:%d to %d period:%lu " -"[jiff] packets:%lu avg_pkt_size:%lu rate:%lu [p/s])\n" , +en_dbg (INTR , priv,"Rx moder_time changed from:%d to %d period:%lu " +"[jiff] packets:%lu avg_pkt_size:%lu rate:%lu [p/s])\n" , priv->last_moder_time, moder_time, period, packets, avg_pkt_size, rate);
@@ -487,8 +482,7 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) cq->moder_time = moder_time; err =mlx4_en_set_cq_moder (priv, cq);if (err) { -mlx4_err (mdev,"Failed modifying moderation for cq:%d " -"on port:%d\n" , i, priv->port); +en_err (priv,"Failed modifying moderation for cq:%d\n" , i);break ; } }
@@ -511,8 +505,7 @@ static void mlx4_en_do_get_stats(struct work_struct *work) err =mlx4_en_DUMP_ETH_STATS (mdev, priv->port,0 );if (err) -mlx4_dbg (HW , priv,"Could not update stats for " -"port:%d\n" , priv->port); +en_dbg (HW , priv,"Could not update stats \n" );mutex_lock (&mdev->state_lock);if (mdev->device_up) {
@@ -536,12 +529,10 @@ static void mlx4_en_linkstate(struct work_struct *work)* report to system log */ if (priv->last_link_state != linkstate) {if (linkstate ==MLX4_DEV_EVENT_PORT_DOWN ) { -if (netif_msg_link (priv)) -mlx4_info (mdev,"Port %d - link down\n" , priv->port); +en_dbg (LINK , priv,"Link Down\n" );netif_carrier_off (priv->dev); }else { -if (netif_msg_link (priv)) -mlx4_info (mdev,"Port %d - link up\n" , priv->port); +en_dbg (LINK , priv,"Link Up\n" );netif_carrier_on (priv->dev); } }
@@ -563,19 +554,19 @@ int mlx4_en_start_port(struct net_device *dev)int j;if (priv->port_up) { -mlx4_dbg (DRV , priv,"start port called while port already up\n" ); +en_dbg (DRV , priv,"start port called while port already up\n" );return 0 ; }/* Calculate Rx buf size */ dev->mtu =min (dev->mtu, priv->max_mtu);mlx4_en_calc_rx_buf (dev); -mlx4_dbg (DRV , priv,"Rx buf size:%d\n" , priv->rx_skb_size); +en_dbg (DRV , priv,"Rx buf size:%d\n" , priv->rx_skb_size);/* Configure rx cq's and rings */ err =mlx4_en_activate_rx_rings (priv);if (err) { -mlx4_err (mdev,"Failed to activate RX rings\n" ); +en_err (priv,"Failed to activate RX rings\n" );return err; }for (i =0 ; i < priv->rx_ring_num; i++) {
@@ -583,14 +574,14 @@ int mlx4_en_start_port(struct net_device *dev) err =mlx4_en_activate_cq (priv, cq);if (err) { -mlx4_err (mdev,"Failed activating Rx CQ\n" ); +en_err (priv,"Failed activating Rx CQ\n" ); goto cq_err; }for (j =0 ; j < cq->size; j++) cq->buf[j].owner_sr_opcode =MLX4_CQE_OWNER_MASK ; err =mlx4_en_set_cq_moder (priv, cq);if (err) { -mlx4_err (mdev,"Failed setting cq moderation parameters" ); +en_err (priv,"Failed setting cq moderation parameters" );mlx4_en_deactivate_cq (priv, cq); goto cq_err; }
@@ -601,7 +592,7 @@ int mlx4_en_start_port(struct net_device *dev) err =mlx4_en_config_rss_steer (priv);if (err) { -mlx4_err (mdev,"Failed configuring rss steering\n" ); +en_err (priv,"Failed configuring rss steering\n" ); goto cq_err; }
@@ -611,16 +602,16 @@ int mlx4_en_start_port(struct net_device *dev) cq = &priv->tx_cq[i]; err =mlx4_en_activate_cq (priv, cq);if (err) { -mlx4_err (mdev,"Failed allocating Tx CQ\n" ); +en_err (priv,"Failed allocating Tx CQ\n" ); goto tx_err; } err =mlx4_en_set_cq_moder (priv, cq);if (err) { -mlx4_err (mdev,"Failed setting cq moderation parameters" ); +en_err (priv,"Failed setting cq moderation parameters" );mlx4_en_deactivate_cq (priv, cq); goto tx_err; } -mlx4_dbg (DRV , priv,"Resetting index of collapsed CQ:%d to -1\n" , i); +en_dbg (DRV , priv,"Resetting index of collapsed CQ:%d to -1\n" , i); cq->buf->wqe_index =cpu_to_be16 (0xffff );/* Configure ring */
@@ -628,7 +619,7 @@ int mlx4_en_start_port(struct net_device *dev) err =mlx4_en_activate_tx_ring (priv, tx_ring, cq->mcq.cqn, priv->rx_ring[0 ].srq.srqn);if (err) { -mlx4_err (mdev,"Failed allocating Tx ring\n" ); +en_err (priv,"Failed allocating Tx ring\n" );mlx4_en_deactivate_cq (priv, cq); goto tx_err; }
@@ -646,30 +637,30 @@ int mlx4_en_start_port(struct net_device *dev) priv->prof->rx_pause, priv->prof->rx_ppp);if (err) { -mlx4_err (mdev,"Failed setting port general configurations" -" for port %d, with error %d\n" , priv->port, err); +en_err (priv,"Failed setting port general configurations " +"for port %d, with error %d\n" , priv->port, err); goto tx_err; }/* Set default qp number */ err =mlx4_SET_PORT_qpn_calc (mdev->dev, priv->port, priv->base_qpn,0 );if (err) { -mlx4_err (mdev,"Failed setting default qp numbers\n" ); +en_err (priv,"Failed setting default qp numbers\n" ); goto tx_err; }/* Set port mac number */ -mlx4_dbg (DRV , priv,"Setting mac for port %d\n" , priv->port); +en_dbg (DRV , priv,"Setting mac for port %d\n" , priv->port); err =mlx4_register_mac (mdev->dev, priv->port, priv->mac, &priv->mac_index);if (err) { -mlx4_err (mdev,"Failed setting port mac\n" ); +en_err (priv,"Failed setting port mac\n" ); goto tx_err; }/* Init port */ -mlx4_dbg (HW , priv,"Initializing port\n" ); +en_dbg (HW , priv,"Initializing port\n" ); err =mlx4_INIT_PORT (mdev->dev, priv->port);if (err) { -mlx4_err (mdev,"Failed Initializing port\n" ); +en_err (priv,"Failed Initializing port\n" ); goto mac_err; }
@@ -706,8 +697,7 @@ void mlx4_en_stop_port(struct net_device *dev)int i;if (!priv->port_up) { -mlx4_dbg (DRV , priv,"stop port (%d) called while port already down\n" , - priv->port); +en_dbg (DRV , priv,"stop port called while port already down\n" );return ; }netif_stop_queue (dev);
@@ -752,13 +742,13 @@ static void mlx4_en_restart(struct work_struct *work)struct mlx4_en_dev *mdev = priv->mdev;struct net_device *dev = priv->dev; -mlx4_dbg (DRV , priv,"Watchdog task called for port %d\n" , priv->port); +en_dbg (DRV , priv,"Watchdog task called for port %d\n" , priv->port);mutex_lock (&mdev->state_lock);if (priv->port_up) {mlx4_en_stop_port (dev);if (mlx4_en_start_port (dev)) -mlx4_err (mdev,"Failed restarting port %d\n" , priv->port); +en_err (priv,"Failed restarting port %d\n" , priv->port); }mutex_unlock (&mdev->state_lock); }
@@ -774,14 +764,14 @@ static int mlx4_en_open(struct net_device *dev)mutex_lock (&mdev->state_lock);if (!mdev->device_up) { -mlx4_err (mdev,"Cannot open - device down/disabled\n" ); +en_err (priv,"Cannot open - device down/disabled\n" ); err = -EBUSY ; goto out; }/* Reset HW statistics and performance counters */ if (mlx4_en_DUMP_ETH_STATS (mdev, priv->port,1 )) -mlx4_dbg (HW , priv,"Failed dumping statistics\n" ); +en_dbg (HW , priv,"Failed dumping statistics\n" );memset (&priv->stats,0 ,sizeof (priv->stats));memset (&priv->pstats,0 ,sizeof (priv->pstats));
@@ -798,7 +788,7 @@ static int mlx4_en_open(struct net_device *dev)mlx4_en_set_default_moderation (priv); err =mlx4_en_start_port (dev);if (err) -mlx4_err (mdev,"Failed starting port:%d\n" , priv->port); +en_err (priv,"Failed starting port:%d\n" , priv->port); out:mutex_unlock (&mdev->state_lock);
@@ -811,8 +801,7 @@ static int mlx4_en_close(struct net_device *dev)struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_en_dev *mdev = priv->mdev; -if (netif_msg_ifdown (priv)) -mlx4_info (mdev,"Close called for port:%d\n" , priv->port); +en_dbg (IFDOWN , priv,"Close port called\n" );mutex_lock (&mdev->state_lock);
@@ -844,7 +833,6 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv)int mlx4_en_alloc_resources (struct mlx4_en_priv *priv) { -struct mlx4_en_dev *mdev = priv->mdev;struct mlx4_en_port_profile *prof = priv->prof;int i;
@@ -873,7 +861,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)return 0 ; err: -mlx4_err (mdev,"Failed to allocate NIC resources\n" ); +en_err (priv,"Failed to allocate NIC resources\n" );return -ENOMEM ; }
@@ -883,7 +871,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev)struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_en_dev *mdev = priv->mdev; -mlx4_dbg (DRV , priv,"Destroying netdev on port:%d\n" , priv->port); +en_dbg (DRV , priv,"Destroying netdev on port:%d\n" , priv->port);/* Unregister device - this will close the port if it was up */ if (priv->registered)
@@ -912,11 +900,11 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)struct mlx4_en_dev *mdev = priv->mdev;int err =0 ; -mlx4_dbg (DRV , priv,"Change MTU called - current:%d new:%d\n" , +en_dbg (DRV , priv,"Change MTU called - current:%d new:%d\n" , dev->mtu, new_mtu);if ((new_mtu <MLX4_EN_MIN_MTU ) || (new_mtu > priv->max_mtu)) { -mlx4_err (mdev,"Bad MTU size:%d.\n" , new_mtu); +en_err (priv,"Bad MTU size:%d.\n" , new_mtu);return -EPERM ; } dev->mtu = new_mtu;
@@ -926,13 +914,13 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)if (!mdev->device_up) {/* NIC is probably restarting - let watchdog task reset * the port */ -mlx4_dbg (DRV , priv,"Change MTU called with card down!?\n" ); +en_dbg (DRV , priv,"Change MTU called with card down!?\n" ); }else {mlx4_en_stop_port (dev);mlx4_en_set_default_moderation (priv); err =mlx4_en_start_port (dev);if (err) { -mlx4_err (mdev,"Failed restarting port:%d\n" , +en_err (priv,"Failed restarting port:%d\n" , priv->port);queue_work (mdev->workqueue, &priv->watchdog_task); }
@@ -1006,7 +994,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, priv->max_mtu = mdev->dev->caps.eth_mtu_cap[priv->port]; priv->mac = mdev->dev->caps.def_mac[priv->port];if (ILLEGAL_MAC (priv->mac)) { -mlx4_err (mdev,"Port: %d, invalid mac burned: 0x%llx, quiting\n" , +en_err (priv,"Port: %d, invalid mac burned: 0x%llx, quiting\n" , priv->port, priv->mac); err = -EINVAL ; goto out;
@@ -1025,7 +1013,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, err =mlx4_alloc_hwq_res (mdev->dev, &priv->res,MLX4_EN_PAGE_SIZE ,MLX4_EN_PAGE_SIZE );if (err) { -mlx4_err (mdev,"Failed to allocate page for rx qps\n" ); +en_err (priv,"Failed to allocate page for rx qps\n" ); goto out; } priv->allocated =1 ;
@@ -1068,9 +1056,13 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,netif_carrier_off (dev); err =register_netdev (dev);if (err) { -mlx4_err (mdev,"Netdev registration failed\n" ); +en_err (priv,"Netdev registration failed for port %d\n" , port); goto out; } + +en_warn (priv,"Using %d TX rings\n" , prof->tx_ring_num); +en_warn (priv,"Using %d RX rings\n" , prof->rx_ring_num); + priv->registered =1 ;queue_delayed_work (mdev->workqueue, &priv->stats_task,STATS_DELAY );return 0 ;
drivers/net/mlx4/en_params.c +3 -3
@@ -371,7 +371,7 @@ static int mlx4_en_set_pauseparam(struct net_device *dev, priv->prof->rx_pause, priv->prof->rx_ppp);if (err) -mlx4_err (mdev,"Failed setting pause params to\n" ); +en_err (priv,"Failed setting pause params\n" );return err; }
@@ -421,13 +421,13 @@ static int mlx4_en_set_ringparam(struct net_device *dev, err =mlx4_en_alloc_resources (priv);if (err) { -mlx4_err (mdev,"Failed reallocating port resources\n" ); +en_err (priv,"Failed reallocating port resources\n" ); goto out; }if (port_up) { err =mlx4_en_start_port (dev);if (err) -mlx4_err (mdev,"Failed starting port\n" ); +en_err (priv,"Failed starting port\n" ); } out:
drivers/net/mlx4/en_rx.c +37 -41
239 lines not on this page · raw message
drivers/net/mlx4/en_tx.c +19 -20
@@ -68,15 +68,15 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, tmp = size *sizeof (struct mlx4_en_tx_info ); ring->tx_info =vmalloc (tmp);if (!ring->tx_info) { -mlx4_err (mdev,"Failed allocating tx_info ring\n" ); +en_err (priv,"Failed allocating tx_info ring\n" );return -ENOMEM ; } -mlx4_dbg (DRV , priv,"Allocated tx_info ring at addr:%p size:%d\n" , +en_dbg (DRV , priv,"Allocated tx_info ring at addr:%p size:%d\n" , ring->tx_info, tmp); ring->bounce_buf =kmalloc (MAX_DESC_SIZE ,GFP_KERNEL );if (!ring->bounce_buf) { -mlx4_err (mdev,"Failed allocating bounce buffer\n" ); +en_err (priv,"Failed allocating bounce buffer\n" ); err = -ENOMEM ; goto err_tx; }
@@ -85,31 +85,31 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, err =mlx4_alloc_hwq_res (mdev->dev, &ring->wqres, ring->buf_size,2 *PAGE_SIZE );if (err) { -mlx4_err (mdev,"Failed allocating hwq resources\n" ); +en_err (priv,"Failed allocating hwq resources\n" ); goto err_bounce; } err =mlx4_en_map_buffer (&ring->wqres.buf);if (err) { -mlx4_err (mdev,"Failed to map TX buffer\n" ); +en_err (priv,"Failed to map TX buffer\n" ); goto err_hwq_res; } ring->buf = ring->wqres.buf.direct.buf; -mlx4_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); +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); err =mlx4_qp_reserve_range (mdev->dev,1 ,1 , &ring->qpn);if (err) { -mlx4_err (mdev,"Failed reserving qp for tx ring.\n" ); +en_err (priv,"Failed reserving qp for tx ring.\n" ); goto err_map; } err =mlx4_qp_alloc (mdev->dev, ring->qpn, &ring->qp);if (err) { -mlx4_err (mdev,"Failed allocating qp %d\n" , ring->qpn); +en_err (priv,"Failed allocating qp %d\n" , ring->qpn); goto err_reserve; } ring->qp.event = mlx4_en_sqp_event;
@@ -135,7 +135,7 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring) {struct mlx4_en_dev *mdev = priv->mdev; -mlx4_dbg (DRV , priv,"Destroying tx ring, qpn: %d\n" , ring->qpn); +en_dbg (DRV , priv,"Destroying tx ring, qpn: %d\n" , ring->qpn);mlx4_qp_remove (mdev->dev, &ring->qp);mlx4_qp_free (mdev->dev, &ring->qp);
@@ -274,12 +274,12 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)/* Skip last polled descriptor */ ring->cons += ring->last_nr_txbb; -mlx4_dbg (DRV , priv,"Freeing Tx buf - cons:0x%x prod:0x%x\n" , +en_dbg (DRV , priv,"Freeing Tx buf - cons:0x%x prod:0x%x\n" , ring->cons, ring->prod);if ((u32) (ring->prod - ring->cons) > ring->size) {if (netif_msg_tx_err (priv)) -mlx4_warn (priv->mdev,"Tx consumer passed producer!\n" ); +en_warn (priv,"Tx consumer passed producer!\n" );return 0 ; }
@@ -292,7 +292,7 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring) }if (cnt) -mlx4_dbg (DRV , priv,"Freed %d uncompleted tx descriptors\n" , cnt); +en_dbg (DRV , priv,"Freed %d uncompleted tx descriptors\n" , cnt);return cnt; }
@@ -321,7 +321,7 @@ void mlx4_en_set_prio_map(struct mlx4_en_priv *priv, u16 *prio_map, u32 ring_num num =0 ; } prio_map[prio] = ring; -mlx4_dbg (DRV , priv," prio:%d --> ring:%d\n" , prio, ring); +en_dbg (DRV , priv," prio:%d --> ring:%d\n" , prio, ring); num++; } }
@@ -539,7 +539,6 @@ static int get_real_size(struct sk_buff *skb, struct net_device *dev, int *lso_header_size) {struct mlx4_en_priv *priv =netdev_priv (dev); -struct mlx4_en_dev *mdev = priv->mdev;int real_size;if (skb_is_gso (skb)) {
@@ -553,14 +552,14 @@ static int get_real_size(struct sk_buff *skb, struct net_device *dev, real_size +=DS_SIZE ; else {if (netif_msg_tx_err (priv)) -mlx4_warn (mdev,"Non-linear headers\n" ); +en_warn (priv,"Non-linear headers\n" );dev_kfree_skb_any (skb);return 0 ; } }if (unlikely (*lso_header_size >MAX_LSO_HDR_SIZE )) {if (netif_msg_tx_err (priv)) -mlx4_warn (mdev,"LSO header size too big\n" ); +en_warn (priv,"LSO header size too big\n" );dev_kfree_skb_any (skb);return 0 ; }
@@ -669,7 +668,7 @@ int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) nr_txbb = desc_size /TXBB_SIZE ;if (unlikely (nr_txbb >MAX_DESC_TXBBS )) {if (netif_msg_tx_err (priv)) -mlx4_warn (mdev,"Oversized header or SG list\n" ); +en_warn (priv,"Oversized header or SG list\n" );dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
@@ -695,7 +694,7 @@ int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)/* Now that we know what Tx ring to use */ if (unlikely (!priv->port_up)) {if (netif_msg_tx_err (priv)) -mlx4_warn (mdev,"xmit: port down!\n" ); +en_warn (priv,"xmit: port down!\n" );dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
drivers/net/mlx4/mlx4_en.h +23 -7
@@ -55,20 +55,36 @@#define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN) -#define mlx4_dbg(mlevel, priv, format, arg...) \ - if (NETIF_MSG_##mlevel & priv->msg_enable) \ - printk(KERN_DEBUG "%s %s: " format , DRV_NAME ,\ - (dev_name(&priv->mdev->pdev->dev)) , ## arg) +#define en_print(level, priv, format, arg...) \ + { \ + if ((priv)->registered) \ + printk(level "%s: %s: " format, DRV_NAME, \ + (priv->dev)->name, ## arg); \ + else \ + printk(level "%s: %s: Port %d: " format, \ + DRV_NAME, dev_name(&priv->mdev->pdev->dev), \ + (priv)->port, ## arg); \ + } + +#define en_dbg(mlevel, priv, format, arg...) \ + { \ + if (NETIF_MSG_##mlevel & priv->msg_enable) \ + en_print(KERN_DEBUG, priv, format, ## arg) \ + } +#define en_warn(priv, format, arg...) \ + en_print(KERN_WARNING, priv, format, ## arg) +#define en_err(priv, format, arg...) \ + en_print(KERN_ERR, priv, format, ## arg) #define mlx4_err(mdev, format, arg...) \ printk(KERN_ERR "%s %s: " format , DRV_NAME ,\ - (dev_name(&mdev->pdev->dev)) , ## arg) + dev_name(&mdev->pdev->dev) , ## arg) #define mlx4_info(mdev, format, arg...) \ printk(KERN_INFO "%s %s: " format , DRV_NAME ,\ - (dev_name(&mdev->pdev->dev)) , ## arg) + dev_name(&mdev->pdev->dev) , ## arg) #define mlx4_warn(mdev, format, arg...) \ printk(KERN_WARNING "%s %s: " format , DRV_NAME ,\ - (dev_name(&mdev->pdev->dev)) , ## arg) + dev_name(&mdev->pdev->dev) , ## arg)/* * Device constants
Signature · 1 line
1.6.0
David Miller
maintainerRe: [PATCH 1/8] mlx4_en: Giving interface name in debug messages
From: Yevgeny Petrilin <[email protected]>
Date: Tue, 02 Jun 2009 09:27:13 +0300
Quoted 6 lines
For each debug message, the message will show interface name in case that the net device was registered, and PCI bus ID with port number if we were not registered yet. Messages that are not port/netdev specific stayed in the old format
Signed-off-by Yevgeny Petrilin <[email protected]>
So where are the 7 other patches of this 8 patch set?
PATCH 2/8 mlx4_en: Moved all module parameters handling to en_main.c
In reply to David Milleren_params.c file now only handles Ethtool functionality
--- drivers/net/mlx4/en_main.c | 54 +++++++++++++++++++++++++++++++++++++++ drivers/net/mlx4/en_params.c | 58 ------------------------------------------ drivers/net/mlx4/mlx4_en.h | 2 - 3 files changed, 54 insertions(+), 60 deletions(-)
drivers/net/mlx4/en_main.c +54 -0
@@ -51,6 +51,60 @@ static const char mlx4_en_version[] =DRV_NAME ": Mellanox ConnectX HCA Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n" ; +#define MLX4_EN_PARM_INT (X , def_val, desc) \ + static unsigned int X = def_val;\ + module_param(X , uint, 0444); \ + MODULE_PARM_DESC(X, desc); + + +/* +* Device scope module parameters +*/ + + +/* Use a XOR rathern than Toeplitz hash function for RSS */ +MLX4_EN_PARM_INT (rss_xor,0 ,"Use XOR hash function for RSS" ); + +/* RSS hash type mask - default to <saddr, daddr, sport, dport> */ +MLX4_EN_PARM_INT (rss_mask,0xf ,"RSS hash type bitmask" ); + +/* Number of LRO sessions per Rx ring (rounded up to a power of two) */ +MLX4_EN_PARM_INT (num_lro,MLX4_EN_MAX_LRO_DESCRIPTORS , +"Number of LRO sessions per ring or disabled (0)" ); + +/* Priority pausing */ +MLX4_EN_PARM_INT (pfctx,0 ,"Priority based Flow Control policy on TX[7:0]." +" Per priority bit mask" ); +MLX4_EN_PARM_INT (pfcrx,0 ,"Priority based Flow Control policy on RX[7:0]." +" Per priority bit mask" ); + +static int mlx4_en_get_profile (struct mlx4_en_dev *mdev) +{ +struct mlx4_en_profile *params = &mdev->profile; +int i; + + params->rss_xor = (rss_xor !=0 ); + params->rss_mask = rss_mask &0x1f ; + params->num_lro =min_t (int, num_lro ,MLX4_EN_MAX_LRO_DESCRIPTORS ); +for (i =1 ; i <=MLX4_MAX_PORTS ; i++) { + params->prof[i].rx_pause =1 ; + params->prof[i].rx_ppp = pfcrx; + params->prof[i].tx_pause =1 ; + params->prof[i].tx_ppp = pfctx; + params->prof[i].tx_ring_size =MLX4_EN_DEF_TX_RING_SIZE ; + params->prof[i].rx_ring_size =MLX4_EN_DEF_RX_RING_SIZE ; + } +if (pfcrx || pfctx) { + params->prof[1 ].tx_ring_num =MLX4_EN_TX_RING_NUM ; + params->prof[2 ].tx_ring_num =MLX4_EN_TX_RING_NUM ; + }else { + params->prof[1 ].tx_ring_num =1 ; + params->prof[2 ].tx_ring_num =1 ; + } + +return 0 ; +} +static void mlx4_en_event (struct mlx4_dev *dev,void *endev_ptr,enum mlx4_dev_event event,int port) {
drivers/net/mlx4/en_params.c +0 -58
64 lines not on this page · raw message
drivers/net/mlx4/mlx4_en.h +0 -2
@@ -516,8 +516,6 @@ void mlx4_en_stop_port(struct net_device *dev);void mlx4_en_free_resources (struct mlx4_en_priv *priv);int mlx4_en_alloc_resources (struct mlx4_en_priv *priv); -int mlx4_en_get_profile (struct mlx4_en_dev *mdev); -int mlx4_en_create_cq (struct mlx4_en_priv *priv,struct mlx4_en_cq *cq,int entries,int ring,enum cq_type mode);void mlx4_en_destroy_cq (struct mlx4_en_priv *priv,struct mlx4_en_cq *cq);
Signature · 1 line
1.6.0
PATCH 3/8 mlx4_en renamed en_params.c to en_ethtool.c
In reply to David Miller--- drivers/net/mlx4/Makefile | 2 +- drivers/net/mlx4/en_ethtool.c | 427 +++++++++++++++++++++++++++++++++++++++++ drivers/net/mlx4/en_params.c | 427 ----------------------------------------- 3 files changed, 428 insertions(+), 428 deletions(-) create mode 100644 drivers/net/mlx4/en_ethtool.c delete mode 100644 drivers/net/mlx4/en_params.c
drivers/net/mlx4/Makefile +1 -1
@@ -5,5 +5,5 @@ mlx4_core-y := alloc.o catas.o cmd.o cq.o eq.o fw.o icm.o intf.o main.o mcg.o \ obj-$(CONFIG_MLX4_EN) += mlx4_en.o -mlx4_en-y := en_main.o en_tx.o en_rx.o en_params.o en_port.o en_cq.o \ +mlx4_en-y := en_main.o en_tx.o en_rx.o en_ethtool.o en_port.o en_cq.o \ en_resources.o en_netdev.o
drivers/net/mlx4/en_ethtool.c new file +427 -0
427 lines not on this page · raw message
drivers/net/mlx4/en_params.c deleted +0 -427
427 lines not on this page · raw message
Signature · 1 line
1.6.0
PATCH 4/8 mlx4_en: Work with part of the ports.
In reply to David MillerIf the initialization of one of the ports failed,
there is no need to fail the other one as well.
--- drivers/net/mlx4/en_main.c | 19 +------------------ 1 files changed, 1 insertions(+), 18 deletions(-)
drivers/net/mlx4/en_main.c +1 -18
@@ -248,28 +248,11 @@ static void *mlx4_en_add(struct mlx4_dev *dev)/* Create a netdev for each port */ mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) {mlx4_info (mdev,"Activating port:%d\n" , i); -if (mlx4_en_init_netdev (mdev, i, &mdev->profile.prof[i])) { +if (mlx4_en_init_netdev (mdev, i, &mdev->profile.prof[i])) mdev->pndev[i] =NULL ; - goto err_free_netdev; - } }return mdev; - -err_free_netdev: - mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) { -if (mdev->pndev[i]) -mlx4_en_destroy_netdev (mdev->pndev[i]); - } - -mutex_lock (&mdev->state_lock); - mdev->device_up = false; -mutex_unlock (&mdev->state_lock); -flush_workqueue (mdev->workqueue); - -/* Stop event queue before we drop down to release shared SW state */ -destroy_workqueue (mdev->workqueue); - err_mr:mlx4_mr_free (dev, &mdev->mr); err_uar:
Signature · 1 line
1.6.0
PATCH 5/8 mlx4_en: Coalescing target is equal for all mtu's
In reply to David MillerThe interrupt moderation should not depend on number of incoming bytes, but on number of incoming packets.
The previous scheme caused very high interrupts rate for small messages when big MTU was configured.
--- drivers/net/mlx4/en_ethtool.c | 3 +-- drivers/net/mlx4/en_netdev.c | 2 +- drivers/net/mlx4/mlx4_en.h | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/mlx4/en_ethtool.c +1 -2
@@ -268,8 +268,7 @@ static int mlx4_en_set_coalesce(struct net_device *dev, priv->rx_frames = (coal->rx_max_coalesced_frames ==MLX4_EN_AUTO_CONF ) ? -MLX4_EN_RX_COAL_TARGET / - priv->dev->mtu +1 : +MLX4_EN_RX_COAL_TARGET : coal->rx_max_coalesced_frames; priv->rx_usecs = (coal->rx_coalesce_usecs == MLX4_EN_AUTO_CONF) ?
drivers/net/mlx4/en_netdev.c +1 -1
@@ -372,7 +372,7 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)* satisfy our coelsing target. * - moder_time is set to a fixed value. */ - priv->rx_frames =MLX4_EN_RX_COAL_TARGET / priv->dev->mtu +1 ; + priv->rx_frames =MLX4_EN_RX_COAL_TARGET ; priv->rx_usecs =MLX4_EN_RX_COAL_TIME ; en_dbg(INTR, priv, "Default coalesing params for mtu:%d - " "rx_frames:%d rx_usecs:%d\n",
drivers/net/mlx4/mlx4_en.h +2 -2
@@ -143,8 +143,8 @@ enum {#define MLX4_EN_DEF_TX_RING_SIZE 1024#define MLX4_EN_DEF_RX_RING_SIZE 1024 -/* Target number of bytes to coalesce with interrupt moderation */ -#define MLX4_EN_RX_COAL_TARGET 0x20000 +/* Target number of packets to coalesce with interrupt moderation */ +#define MLX4_EN_RX_COAL_TARGET 44#define MLX4_EN_RX_COAL_TIME 0x10#define MLX4_EN_TX_COAL_PKTS 5
Signature · 1 line
1.6.0
PATCH 6/8 mlx4_en: multiqueue support
In reply to David MillerBy default the driver opens 8 TX queues (defined by MLX4_EN_NUM_TX_RINGS). If the driver is configured to support Per Priority Flow Control, we open 8 additional TX rings.dev->real_num_tx_queues is always set to be MLX4_EN_NUM_TX_RINGS. The mlx4_en_select_queue() function uses standard hashing (skb_tx_hash) in case that PPFC is not supported or the skb contain a vlan tag, otherwise the queue is selected according to vlan priority.
--- drivers/net/mlx4/en_main.c | 9 +---- drivers/net/mlx4/en_netdev.c | 7 ++-- drivers/net/mlx4/en_tx.c | 74 ++++++++++------------------------------- drivers/net/mlx4/mlx4_en.h | 9 +++-- 4 files changed, 28 insertions(+), 71 deletions(-)
drivers/net/mlx4/en_main.c +2 -7
@@ -93,13 +93,8 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev) params->prof[i].tx_ppp = pfctx; params->prof[i].tx_ring_size =MLX4_EN_DEF_TX_RING_SIZE ; params->prof[i].rx_ring_size =MLX4_EN_DEF_RX_RING_SIZE ; - } -if (pfcrx || pfctx) { - params->prof[1 ].tx_ring_num =MLX4_EN_TX_RING_NUM ; - params->prof[2 ].tx_ring_num =MLX4_EN_TX_RING_NUM ; - }else { - params->prof[1 ].tx_ring_num =1 ; - params->prof[2 ].tx_ring_num =1 ; + params->prof[i].tx_ring_num =MLX4_EN_NUM_TX_RINGS + + (!!pfcrx) *MLX4_EN_NUM_PPP_RINGS ; }return 0 ;
drivers/net/mlx4/en_netdev.c +3 -4
@@ -934,6 +934,7 @@ static const struct net_device_ops mlx4_netdev_ops = { .ndo_open = mlx4_en_open, .ndo_stop = mlx4_en_close, .ndo_start_xmit = mlx4_en_xmit, + .ndo_select_queue = mlx4_en_select_queue, .ndo_get_stats = mlx4_en_get_stats, .ndo_set_multicast_list = mlx4_en_set_multicast, .ndo_set_mac_address = mlx4_en_set_mac,
@@ -956,7 +957,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,int i;int err; - dev =alloc_etherdev (sizeof (struct mlx4_en_priv )); + dev =alloc_etherdev_mq (sizeof (struct mlx4_en_priv ), prof->tx_ring_num);if (dev ==NULL ) {mlx4_err (mdev,"Net device allocation failed\n" );return -ENOMEM ;
@@ -1018,14 +1019,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, } priv->allocated =1 ; -/* Populate Tx priority mappings */ -mlx4_en_set_prio_map (priv, priv->tx_prio_map, prof->tx_ring_num); -/* * Initialize netdev entry points */ dev->netdev_ops = &mlx4_netdev_ops; dev->watchdog_timeo =MLX4_EN_WATCHDOG_TIMEOUT ; + dev->real_num_tx_queues =MLX4_EN_NUM_TX_RINGS ;SET_ETHTOOL_OPS (dev, &mlx4_en_ethtool_ops);
drivers/net/mlx4/en_tx.c +18 -56
113 lines not on this page · raw message
drivers/net/mlx4/mlx4_en.h +5 -4
@@ -139,8 +139,10 @@ enum {#define MLX4_EN_MIN_RX_SIZE (MLX4_EN_ALLOC_SIZE / SMP_CACHE_BYTES)#define MLX4_EN_MIN_TX_SIZE (4096 / TXBB_SIZE) -#define MLX4_EN_TX_RING_NUM 9 -#define MLX4_EN_DEF_TX_RING_SIZE 1024 +#define MLX4_EN_SMALL_PKT_SIZE 64 +#define MLX4_EN_NUM_TX_RINGS 8 +#define MLX4_EN_NUM_PPP_RINGS 8 +#define MLX4_EN_DEF_TX_RING_SIZE 512#define MLX4_EN_DEF_RX_RING_SIZE 1024/* Target number of packets to coalesce with interrupt moderation */
@@ -478,7 +480,6 @@ struct mlx4_en_priv {int base_qpn;struct mlx4_en_rss_map rss_map; -u16 tx_prio_map[8 ];u32 flags;#define MLX4_EN_FLAG_PROMISC 0x1u32 tx_ring_num;
@@ -526,6 +527,7 @@ int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);void mlx4_en_poll_tx_cq (unsigned long data);void mlx4_en_tx_irq (struct mlx4_cq *mcq); +u16 mlx4_en_select_queue (struct net_device *dev,struct sk_buff *skb);int mlx4_en_xmit (struct sk_buff *skb,struct net_device *dev); int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring,
@@ -560,7 +562,6 @@ void mlx4_en_calc_rx_buf(struct net_device *dev);void mlx4_en_set_default_rss_map (struct mlx4_en_priv *priv,struct mlx4_en_rss_map *rss_map,int num_entries,int num_rings); -void mlx4_en_set_prio_map (struct mlx4_en_priv *priv,u16 *prio_map,u32 ring_num);int mlx4_en_config_rss_steer (struct mlx4_en_priv *priv);void mlx4_en_release_rss_steer (struct mlx4_en_priv *priv);int mlx4_en_free_tx_buf (struct net_device *dev,struct mlx4_en_tx_ring *ring);
Signature · 1 line
1.6.0
PATCH 7/8 mlx4_en: Added vlan_features support
In reply to David Miller--- drivers/net/mlx4/en_netdev.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/mlx4/en_netdev.c +4 -0
@@ -1038,7 +1038,9 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,* Set driver features */ dev->features |=NETIF_F_SG ; + dev->vlan_features |=NETIF_F_SG ; dev->features |=NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM ; + dev->vlan_features |=NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM ; dev->features |=NETIF_F_HIGHDMA ; dev->features |=NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
@@ -1048,6 +1050,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,if (mdev->LSO_support) { dev->features |=NETIF_F_TSO ; dev->features |=NETIF_F_TSO6 ; + dev->vlan_features |=NETIF_F_TSO ; + dev->vlan_features |=NETIF_F_TSO6 ; } mdev->pndev[port] = dev;
Signature · 1 line
1.6.0
PATCH 8/8 mlx4_en: Updated driver version
In reply to David Miller--- drivers/net/mlx4/mlx4_en.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx4/mlx4_en.h +2 -2
@@ -49,8 +49,8 @@#include "en_port.h" #define DRV_NAME "mlx4_en" -#define DRV_VERSION "1.4.0" -#define DRV_RELDATE "Sep 2008" +#define DRV_VERSION "1.4.1.1 +#define DRV_RELDATE "June 2009"#define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN)
Signature · 1 line
1.6.0
David Miller
maintainerRe: [PATCH 8/8] mlx4_en: Updated driver version
From: Yevgeny Petrilin <[email protected]>
Date: Tue, 02 Jun 2009 12:29:42 +0300
Quoted 1 line
+#define
DRV_VERSION"1.4.1.1
You checked in this commit to your tree WITHOUT EVEN BUILD TESTING IT!
drivers/net/mlx4/en_main.c:48: error: missing terminating " character drivers/net/mlx4/en_main.c:48: error: expected ‘,’ or ‘;’ before string constant drivers/net/mlx4/en_main.c:52: error: missing terminating " character drivers/net/mlx4/en_main.c:52: error: expected ‘,’ or ‘;’ before string constant
I fixed this up in my tree but I'm really pissed that you submitted patches to me that YOU DID NOT EVEN BUILD TEST.