diff mbox

[net-next,12/13] net: ena: change validate_tx_req_id() to be inline function

Message ID 1497785298-13468-13-git-send-email-netanel@amazon.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Belgazal, Netanel June 18, 2017, 11:28 a.m. UTC
From: Netanel Belgazal <netanel@amazon.com>

for optimization purpose, change validate_tx_req_id() to be
inline function.

Signed-off-by: Netanel Belgazal <netanel@amazon.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky June 19, 2017, 4:56 a.m. UTC | #1
On Sun, Jun 18, 2017 at 02:28:17PM +0300, netanel@amazon.com wrote:
> From: Netanel Belgazal <netanel@amazon.com>
>
> for optimization purpose, change validate_tx_req_id() to be
> inline function.
>
> Signed-off-by: Netanel Belgazal <netanel@amazon.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index 4540cd3d9f5f..da14b78cc87c 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -698,7 +698,7 @@ static void ena_destroy_all_io_queues(struct ena_adapter *adapter)
>  	ena_destroy_all_rx_queues(adapter);
>  }
>
> -static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
> +static inline int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)

inline in C-file?

Please read Documentation/process/coding-style.rst,
15) The inline disease" section why it is wrong and if you anyway
insists on doing it, please provide support of your claim "optimization
purposes" and show what and how exactly your optimization happened.

Thanks


>  {
>  	struct ena_tx_buffer *tx_info = NULL;
>
> --
> 2.7.4
>
Belgazal, Netanel June 19, 2017, 1:23 p.m. UTC | #2
The optimization purpose I mention was to inform the compiler to inline this function as there is only one caller to this function.
After reading the coding style you refer to I'll discard this patch.

As a side note, I checked the disassembly code and I can see that gcc inline the function even without the explicit hint.

Regards,
Netanel
diff mbox

Patch

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 4540cd3d9f5f..da14b78cc87c 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -698,7 +698,7 @@  static void ena_destroy_all_io_queues(struct ena_adapter *adapter)
 	ena_destroy_all_rx_queues(adapter);
 }
 
-static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
+static inline int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
 {
 	struct ena_tx_buffer *tx_info = NULL;