All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Gal Pressman <galp@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 14/15] net/mlx5e: Add a helper macro in set features ndo
Date: Fri, 23 Mar 2018 15:39:24 -0700	[thread overview]
Message-ID: <20180323223925.21678-15-saeedm@mellanox.com> (raw)
In-Reply-To: <20180323223925.21678-1-saeedm@mellanox.com>

From: Gal Pressman <galp@mellanox.com>

Add a new macro to prevent copy-pasting the same code for each new
feature.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 26 ++++++++++-------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index eb38a35564c7..fb936a978f20 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3242,24 +3242,20 @@ static int mlx5e_set_features(struct net_device *netdev,
 			      netdev_features_t features)
 {
 	netdev_features_t oper_features = netdev->features;
-	int err;
+	int err = 0;
+
+#define MLX5E_HANDLE_FEATURE(feature, handler) \
+	mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
 
-	err  = mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_LRO, set_feature_lro);
-	err |= mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_HW_VLAN_CTAG_FILTER,
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
 				    set_feature_cvlan_filter);
-	err |= mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_HW_TC, set_feature_tc_num_filters);
-	err |= mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_RXALL, set_feature_rx_all);
-	err |= mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_RXFCS, set_feature_rx_fcs);
-	err |= mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan);
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_tc_num_filters);
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL, set_feature_rx_all);
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXFCS, set_feature_rx_fcs);
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan);
 #ifdef CONFIG_RFS_ACCEL
-	err |= mlx5e_handle_feature(netdev, &oper_features, features,
-				    NETIF_F_NTUPLE, set_feature_arfs);
+	err |= MLX5E_HANDLE_FEATURE(NETIF_F_NTUPLE, set_feature_arfs);
 #endif
 
 	if (err) {
-- 
2.14.3

  parent reply	other threads:[~2018-03-23 22:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 22:39 [pull request][net-next 00/15] Mellanox, mlx5 misc updates 2018-03-22 Saeed Mahameed
2018-03-23 22:39 ` [net-next 01/15] net/mlx5e: Expose PFC stall prevention counters Saeed Mahameed
2018-03-23 22:39 ` [net-next 02/15] ethtool: Add support for configuring PFC stall prevention in ethtool Saeed Mahameed
2018-03-24 14:57   ` Andrew Lunn
2018-03-25 10:30     ` Gal Pressman
2018-03-23 22:39 ` [net-next 03/15] net/mlx5e: PFC stall prevention support Saeed Mahameed
2018-03-24 15:07   ` Andrew Lunn
2018-03-25 10:28     ` Gal Pressman
2018-03-25 16:18       ` Andrew Lunn
2018-03-27  8:38         ` Gal Pressman
2018-03-23 22:39 ` [net-next 04/15] net/mlx5: Add support for QUERY_VNIC_ENV command Saeed Mahameed
2018-03-23 22:39 ` [net-next 05/15] net/mlx5e: Add vnic steering drop statistics Saeed Mahameed
2018-03-23 22:39 ` [net-next 06/15] net/mlx5: Add packet dropped while vport down statistics Saeed Mahameed
2018-03-23 22:39 ` [net-next 07/15] net/mlx5e: Add interface down dropped packets statistics Saeed Mahameed
2018-03-23 22:39 ` [net-next 08/15] net/mlx5: E-Switch, Use same source for offloaded actions check Saeed Mahameed
2018-03-23 22:39 ` [net-next 09/15] net/mlx5: Add core support for vlan push/pop steering action Saeed Mahameed
2018-03-23 22:39 ` [net-next 10/15] net/mlx5e: Offload tc vlan push/pop using HW action Saeed Mahameed
2018-03-23 22:39 ` [net-next 11/15] net/mlx5: Protect from command bit overflow Saeed Mahameed
2018-03-23 22:39 ` [net-next 12/15] net/mlx5e: Remove redundant check in get ethtool stats Saeed Mahameed
2018-03-23 22:39 ` [net-next 13/15] net/mlx5e: Make choose LRO timeout function static Saeed Mahameed
2018-03-23 22:39 ` Saeed Mahameed [this message]
2018-03-23 22:39 ` [net-next 15/15] net/mlx5e: Add VLAN offload features to hw_enc_features Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180323223925.21678-15-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=galp@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.