net/mlx5e: Optimize the common case condition in mlx5e_select_queue
authorMaxim Mikityanskiy <maximmi@nvidia.com>
Tue, 25 Jan 2022 10:53:00 +0000 (12:53 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 15 Feb 2022 06:30:52 +0000 (22:30 -0800)
Check all booleans for special queues at once, when deciding whether to
go to the fast path in mlx5e_select_queue. Pack them into bitfields to
have some room for extensibility.

Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/selq.c

index 667bc95..d98a277 100644 (file)
@@ -12,8 +12,13 @@ struct mlx5e_selq_params {
        unsigned int num_regular_queues;
        unsigned int num_channels;
        unsigned int num_tcs;
-       bool is_htb;
-       bool is_ptp;
+       union {
+               u8 is_special_queues;
+               struct {
+                       bool is_htb : 1;
+                       bool is_ptp : 1;
+               };
+       };
 };
 
 int mlx5e_selq_init(struct mlx5e_selq *selq, struct mutex *state_lock)
@@ -164,7 +169,7 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
        if (unlikely(!selq))
                return 0;
 
-       if (likely(!selq->is_ptp && !selq->is_htb)) {
+       if (likely(!selq->is_special_queues)) {
                /* No special queues, netdev_pick_tx returns one of the regular ones. */
 
                txq_ix = netdev_pick_tx(dev, skb, NULL);