* [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements
@ 2016-09-20 11:39 Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 1/4] net/mlx4_en: Add branch prediction hints in RX data-path Tariq Toukan
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Tariq Toukan @ 2016-09-20 11:39 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
Hi Dave,
This patchset contains some cleanups and improvements from the team
to the mlx4 Eth and core drivers.
Series generated against net-next commit:
5a7a5555a362 'net sched: stylistic cleanups'
Thanks,
Tariq.
V2:
* dropped patch 5, will be submitted separately to 'net'.
Jack Morgenstein (1):
net/mlx4_core: Fix deadlock when switching between polling and event
fw commands
Kamal Heib (1):
net/mlx4_en: Fix wrong indentation
Leon Romanovsky (1):
net/mlx4_core: Use RCU to perform radix tree lookup for SRQ
Tariq Toukan (1):
net/mlx4_en: Add branch prediction hints in RX data-path
drivers/net/ethernet/mellanox/mlx4/cmd.c | 23 +++++++++++++++++------
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 28 +++++++++++++++-------------
drivers/net/ethernet/mellanox/mlx4/mlx4.h | 2 ++
drivers/net/ethernet/mellanox/mlx4/srq.c | 14 +++++---------
4 files changed, 39 insertions(+), 28 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next V2 1/4] net/mlx4_en: Add branch prediction hints in RX data-path
2016-09-20 11:39 [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements Tariq Toukan
@ 2016-09-20 11:39 ` Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 2/4] net/mlx4_en: Fix wrong indentation Tariq Toukan
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Tariq Toukan @ 2016-09-20 11:39 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
Add likely/unlikely hints to improve branch predictions
in the RX data-path.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index c80073e4947f..e60a86a9266d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -72,7 +72,7 @@ static int mlx4_alloc_pages(struct mlx4_en_priv *priv,
}
dma = dma_map_page(priv->ddev, page, 0, PAGE_SIZE << order,
frag_info->dma_dir);
- if (dma_mapping_error(priv->ddev, dma)) {
+ if (unlikely(dma_mapping_error(priv->ddev, dma))) {
put_page(page);
return -ENOMEM;
}
@@ -108,7 +108,8 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv,
ring_alloc[i].page_size)
continue;
- if (mlx4_alloc_pages(priv, &page_alloc[i], frag_info, gfp))
+ if (unlikely(mlx4_alloc_pages(priv, &page_alloc[i],
+ frag_info, gfp)))
goto out;
}
@@ -585,7 +586,7 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
frag_info = &priv->frag_info[nr];
if (length <= frag_info->frag_prefix_size)
break;
- if (!frags[nr].page)
+ if (unlikely(!frags[nr].page))
goto fail;
dma = be64_to_cpu(rx_desc->data[nr].addr);
@@ -625,7 +626,7 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
dma_addr_t dma;
skb = netdev_alloc_skb(priv->dev, SMALL_PACKET_SIZE + NET_IP_ALIGN);
- if (!skb) {
+ if (unlikely(!skb)) {
en_dbg(RX_ERR, priv, "Failed allocating skb\n");
return NULL;
}
@@ -736,7 +737,8 @@ static int get_fixed_ipv6_csum(__wsum hw_checksum, struct sk_buff *skb,
{
__wsum csum_pseudo_hdr = 0;
- if (ipv6h->nexthdr == IPPROTO_FRAGMENT || ipv6h->nexthdr == IPPROTO_HOPOPTS)
+ if (unlikely(ipv6h->nexthdr == IPPROTO_FRAGMENT ||
+ ipv6h->nexthdr == IPPROTO_HOPOPTS))
return -1;
hw_checksum = csum_add(hw_checksum, (__force __wsum)htons(ipv6h->nexthdr));
@@ -769,7 +771,7 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
get_fixed_ipv4_csum(hw_checksum, skb, hdr);
#if IS_ENABLED(CONFIG_IPV6)
else if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV6))
- if (get_fixed_ipv6_csum(hw_checksum, skb, hdr))
+ if (unlikely(get_fixed_ipv6_csum(hw_checksum, skb, hdr)))
return -1;
#endif
return 0;
@@ -796,10 +798,10 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
u64 timestamp;
bool l2_tunnel;
- if (!priv->port_up)
+ if (unlikely(!priv->port_up))
return 0;
- if (budget <= 0)
+ if (unlikely(budget <= 0))
return polled;
/* Protect accesses to: ring->xdp_prog, priv->mac_hash list */
@@ -902,16 +904,16 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
case XDP_PASS:
break;
case XDP_TX:
- if (!mlx4_en_xmit_frame(frags, dev,
+ if (likely(!mlx4_en_xmit_frame(frags, dev,
length, tx_index,
- &doorbell_pending))
+ &doorbell_pending)))
goto consumed;
goto next; /* Drop on xmit failure */
default:
bpf_warn_invalid_xdp_action(act);
case XDP_ABORTED:
case XDP_DROP:
- if (mlx4_en_rx_recycle(ring, frags))
+ if (likely(mlx4_en_rx_recycle(ring, frags)))
goto consumed;
goto next;
}
@@ -1015,7 +1017,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
/* GRO not possible, complete processing here */
skb = mlx4_en_rx_skb(priv, rx_desc, frags, length);
- if (!skb) {
+ if (unlikely(!skb)) {
ring->dropped++;
goto next;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 2/4] net/mlx4_en: Fix wrong indentation
2016-09-20 11:39 [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 1/4] net/mlx4_en: Add branch prediction hints in RX data-path Tariq Toukan
@ 2016-09-20 11:39 ` Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ Tariq Toukan
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Tariq Toukan @ 2016-09-20 11:39 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Kamal Heib, Tariq Toukan
From: Kamal Heib <kamalh@mellanox.com>
Use tabs instead of spaces before if statement, no functional change.
Fixes: e7c1c2c46201 ("mlx4_en: Added self diagnostics test implementation")
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index e60a86a9266d..f0501ea867c7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -1022,7 +1022,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
goto next;
}
- if (unlikely(priv->validate_loopback)) {
+ if (unlikely(priv->validate_loopback)) {
validate_loopback(priv, skb);
goto next;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ
2016-09-20 11:39 [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 1/4] net/mlx4_en: Add branch prediction hints in RX data-path Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 2/4] net/mlx4_en: Fix wrong indentation Tariq Toukan
@ 2016-09-20 11:39 ` Tariq Toukan
2016-09-20 12:47 ` Sergei Shtylyov
2016-09-20 11:39 ` [PATCH net-next V2 4/4] net/mlx4_core: Fix deadlock when switching between polling and event fw commands Tariq Toukan
2016-09-22 1:53 ` [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements David Miller
4 siblings, 1 reply; 8+ messages in thread
From: Tariq Toukan @ 2016-09-20 11:39 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Leon Romanovsky, Tariq Toukan
From: Leon Romanovsky <leonro@mellanox.com>
Radix tree lookup can be performed without locking.
Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/srq.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index 67146624eb58..f44d089e2ca6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -45,15 +45,12 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
struct mlx4_srq *srq;
- spin_lock(&srq_table->lock);
-
+ rcu_read_lock();
srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
+ rcu_read_unlock();
if (srq)
atomic_inc(&srq->refcount);
-
- spin_unlock(&srq_table->lock);
-
- if (!srq) {
+ else {
mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
return;
}
@@ -301,12 +298,11 @@ struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn)
{
struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
struct mlx4_srq *srq;
- unsigned long flags;
- spin_lock_irqsave(&srq_table->lock, flags);
+ rcu_read_lock();
srq = radix_tree_lookup(&srq_table->tree,
srqn & (dev->caps.num_srqs - 1));
- spin_unlock_irqrestore(&srq_table->lock, flags);
+ rcu_read_unlock();
return srq;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 4/4] net/mlx4_core: Fix deadlock when switching between polling and event fw commands
2016-09-20 11:39 [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements Tariq Toukan
` (2 preceding siblings ...)
2016-09-20 11:39 ` [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ Tariq Toukan
@ 2016-09-20 11:39 ` Tariq Toukan
2016-09-22 1:53 ` [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements David Miller
4 siblings, 0 replies; 8+ messages in thread
From: Tariq Toukan @ 2016-09-20 11:39 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Eran Ben Elisha, Jack Morgenstein, Matan Barak,
Tariq Toukan
From: Jack Morgenstein <jackm@dev.mellanox.co.il>
When switching from polling-based fw commands to event-based fw
commands, there is a race condition which could cause a fw command
in another task to hang: that task will keep waiting for the polling
sempahore, but may never be able to acquire it. This is due to
mlx4_cmd_use_events, which "down"s the sempahore back to 0.
During driver initialization, this is not a problem, since no other
tasks which invoke FW commands are active.
However, there is a problem if the driver switches to polling mode
and then back to event mode during normal operation.
The "test_interrupts" feature does exactly that.
Running "ethtool -t <eth device> offline" causes the PF driver to
temporarily switch to polling mode, and then back to event mode.
(Note that for VF drivers, such switching is not performed).
Fix this by adding a read-write semaphore for protection when
switching between modes.
Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/cmd.c | 23 +++++++++++++++++------
drivers/net/ethernet/mellanox/mlx4/mlx4.h | 2 ++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index f04a423ff79d..a58d96cf1ed1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -785,17 +785,23 @@ int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
return mlx4_cmd_reset_flow(dev, op, op_modifier, -EIO);
if (!mlx4_is_mfunc(dev) || (native && mlx4_is_master(dev))) {
+ int ret;
+
if (dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR)
return mlx4_internal_err_ret_value(dev, op,
op_modifier);
+ down_read(&mlx4_priv(dev)->cmd.switch_sem);
if (mlx4_priv(dev)->cmd.use_events)
- return mlx4_cmd_wait(dev, in_param, out_param,
- out_is_imm, in_modifier,
- op_modifier, op, timeout);
+ ret = mlx4_cmd_wait(dev, in_param, out_param,
+ out_is_imm, in_modifier,
+ op_modifier, op, timeout);
else
- return mlx4_cmd_poll(dev, in_param, out_param,
- out_is_imm, in_modifier,
- op_modifier, op, timeout);
+ ret = mlx4_cmd_poll(dev, in_param, out_param,
+ out_is_imm, in_modifier,
+ op_modifier, op, timeout);
+
+ up_read(&mlx4_priv(dev)->cmd.switch_sem);
+ return ret;
}
return mlx4_slave_cmd(dev, in_param, out_param, out_is_imm,
in_modifier, op_modifier, op, timeout);
@@ -2454,6 +2460,7 @@ int mlx4_cmd_init(struct mlx4_dev *dev)
int flags = 0;
if (!priv->cmd.initialized) {
+ init_rwsem(&priv->cmd.switch_sem);
mutex_init(&priv->cmd.slave_cmd_mutex);
sema_init(&priv->cmd.poll_sem, 1);
priv->cmd.use_events = 0;
@@ -2583,6 +2590,7 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
if (!priv->cmd.context)
return -ENOMEM;
+ down_write(&priv->cmd.switch_sem);
for (i = 0; i < priv->cmd.max_cmds; ++i) {
priv->cmd.context[i].token = i;
priv->cmd.context[i].next = i + 1;
@@ -2606,6 +2614,7 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
down(&priv->cmd.poll_sem);
priv->cmd.use_events = 1;
+ up_write(&priv->cmd.switch_sem);
return err;
}
@@ -2618,6 +2627,7 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev)
struct mlx4_priv *priv = mlx4_priv(dev);
int i;
+ down_write(&priv->cmd.switch_sem);
priv->cmd.use_events = 0;
for (i = 0; i < priv->cmd.max_cmds; ++i)
@@ -2626,6 +2636,7 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev)
kfree(priv->cmd.context);
up(&priv->cmd.poll_sem);
+ up_write(&priv->cmd.switch_sem);
}
struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index c9d7fc5159f2..c128ba3ef014 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -46,6 +46,7 @@
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <net/devlink.h>
+#include <linux/rwsem.h>
#include <linux/mlx4/device.h>
#include <linux/mlx4/driver.h>
@@ -627,6 +628,7 @@ struct mlx4_cmd {
struct mutex slave_cmd_mutex;
struct semaphore poll_sem;
struct semaphore event_sem;
+ struct rw_semaphore switch_sem;
int max_cmds;
spinlock_t context_lock;
int free_head;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ
2016-09-20 11:39 ` [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ Tariq Toukan
@ 2016-09-20 12:47 ` Sergei Shtylyov
2016-09-20 13:05 ` Leon Romanovsky
0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2016-09-20 12:47 UTC (permalink / raw)
To: Tariq Toukan, David S. Miller; +Cc: netdev, Eran Ben Elisha, Leon Romanovsky
Hello.
On 9/20/2016 2:39 PM, Tariq Toukan wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Radix tree lookup can be performed without locking.
>
> Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Suggested-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/srq.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
> index 67146624eb58..f44d089e2ca6 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/srq.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
> @@ -45,15 +45,12 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
> struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
> struct mlx4_srq *srq;
>
> - spin_lock(&srq_table->lock);
> -
> + rcu_read_lock();
> srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
> + rcu_read_unlock();
> if (srq)
> atomic_inc(&srq->refcount);
> -
> - spin_unlock(&srq_table->lock);
> -
> - if (!srq) {
> + else {
> mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
> return;
> }
CodingStyle: all branches of the *if* statement should have {} if at least
one has.
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ
2016-09-20 12:47 ` Sergei Shtylyov
@ 2016-09-20 13:05 ` Leon Romanovsky
0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2016-09-20 13:05 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Tariq Toukan, David S. Miller, netdev, Eran Ben Elisha
[-- Attachment #1: Type: text/plain, Size: 2406 bytes --]
On Tue, Sep 20, 2016 at 03:47:49PM +0300, Sergei Shtylyov wrote:
> Hello.
>
> On 9/20/2016 2:39 PM, Tariq Toukan wrote:
>
> >From: Leon Romanovsky <leonro@mellanox.com>
> >
> >Radix tree lookup can be performed without locking.
> >
> >Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
> >Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> >Suggested-by: Sagi Grimberg <sagi@grimberg.me>
> >Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> >---
> > drivers/net/ethernet/mellanox/mlx4/srq.c | 14 +++++---------
> > 1 file changed, 5 insertions(+), 9 deletions(-)
> >
> >diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
> >index 67146624eb58..f44d089e2ca6 100644
> >--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
> >+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
> >@@ -45,15 +45,12 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
> > struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
> > struct mlx4_srq *srq;
> >
> >- spin_lock(&srq_table->lock);
> >-
> >+ rcu_read_lock();
> > srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
> >+ rcu_read_unlock();
> > if (srq)
> > atomic_inc(&srq->refcount);
> >-
> >- spin_unlock(&srq_table->lock);
> >-
> >- if (!srq) {
> >+ else {
> > mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
> > return;
> > }
>
> CodingStyle: all branches of the *if* statement should have {} if at
> least one has.
I'm not arguing, but wanted to raise attention that checkpatch.pl
doesn't warn about it.
➜ /tmp wget https://patchwork.ozlabs.org/patch/672216/mbox/
➜ linux-rdma git:(master) ./scripts/checkpatch.pl /tmp/index.html
total: 0 errors, 0 warnings, 0 checks, 32 lines checked
/tmp/index.html has no obvious style problems and is ready for
submission.
And CodingStyle presents a little bit different case
----
This does not apply if only one branch of a conditional statement is a
single statement; in the latter case use braces in both branches:
if (condition) {
do_this();
do_that();
} else {
otherwise();
}
and not
if (condition)
do_that();
else {
otherwise();
otherwise();
}
Thanks
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements
2016-09-20 11:39 [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements Tariq Toukan
` (3 preceding siblings ...)
2016-09-20 11:39 ` [PATCH net-next V2 4/4] net/mlx4_core: Fix deadlock when switching between polling and event fw commands Tariq Toukan
@ 2016-09-22 1:53 ` David Miller
4 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2016-09-22 1:53 UTC (permalink / raw)
To: tariqt; +Cc: netdev, eranbe
From: Tariq Toukan <tariqt@mellanox.com>
Date: Tue, 20 Sep 2016 14:39:38 +0300
> This patchset contains some cleanups and improvements from the team
> to the mlx4 Eth and core drivers.
>
> Series generated against net-next commit:
> 5a7a5555a362 'net sched: stylistic cleanups'
Series applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-09-22 1:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-20 11:39 [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 1/4] net/mlx4_en: Add branch prediction hints in RX data-path Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 2/4] net/mlx4_en: Fix wrong indentation Tariq Toukan
2016-09-20 11:39 ` [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix tree lookup for SRQ Tariq Toukan
2016-09-20 12:47 ` Sergei Shtylyov
2016-09-20 13:05 ` Leon Romanovsky
2016-09-20 11:39 ` [PATCH net-next V2 4/4] net/mlx4_core: Fix deadlock when switching between polling and event fw commands Tariq Toukan
2016-09-22 1:53 ` [PATCH net-next V2 0/4] mlx4 misc cleanups and improvements David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).