[1/2] net/tap: remove useless offload capa functions

Message ID 20210616041528.4229-2-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series net/tap: remove useless offload setup |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger June 16, 2021, 4:15 a.m. UTC
  Since these always return 0, they were doing nothing useful.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)
  

Comments

Andrew Rybchenko July 1, 2021, 2:16 p.m. UTC | #1
On 6/16/21 7:15 AM, Stephen Hemminger wrote:
> Since these always return 0, they were doing nothing useful.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

I have no strong opinion on the patch, but sometimes even
empty functions with comments add value. So, I see no point
to touch it. So, I'll wait for maintainer reply.
  
Stephen Hemminger July 1, 2021, 5:18 p.m. UTC | #2
On Thu, 1 Jul 2021 17:16:21 +0300
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:

> On 6/16/21 7:15 AM, Stephen Hemminger wrote:
> > Since these always return 0, they were doing nothing useful.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>  
> 
> I have no strong opinion on the patch, but sometimes even
> empty functions with comments add value. So, I see no point
> to touch it. So, I'll wait for maintainer reply.

There are always many ways to write more obscure and technically correct
code. It is best if the code is the smallest correct way.

“I apologize for such a long letter - I didn't have time to write a short one.”
― Mark Twain
  
Wiles, Keith July 1, 2021, 7:19 p.m. UTC | #3
> On Jul 1, 2021, at 12:18 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
> On Thu, 1 Jul 2021 17:16:21 +0300
> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:
> 
>> On 6/16/21 7:15 AM, Stephen Hemminger wrote:
>>> Since these always return 0, they were doing nothing useful.
>>> 
>>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>  
>> 
>> I have no strong opinion on the patch, but sometimes even
>> empty functions with comments add value. So, I see no point
>> to touch it. So, I'll wait for maintainer reply.
> 
> There are always many ways to write more obscure and technically correct
> code. It is best if the code is the smallest correct way.
> 
> “I apologize for such a long letter - I didn't have time to write a short one.”
> ― Mark Twain

I agree with Stephen, the extra functions provide no useful feature or even the comments are not very useful IMO.
  
Andrew Rybchenko July 2, 2021, 7:56 a.m. UTC | #4
On 7/1/21 10:19 PM, Wiles, Keith wrote:
> 
> 
>> On Jul 1, 2021, at 12:18 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
>>
>> On Thu, 1 Jul 2021 17:16:21 +0300
>> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:
>>
>>> On 6/16/21 7:15 AM, Stephen Hemminger wrote:
>>>> Since these always return 0, they were doing nothing useful.
>>>>
>>>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>  
>>>
>>> I have no strong opinion on the patch, but sometimes even
>>> empty functions with comments add value. So, I see no point
>>> to touch it. So, I'll wait for maintainer reply.
>>
>> There are always many ways to write more obscure and technically correct
>> code. It is best if the code is the smallest correct way.
>>
>> “I apologize for such a long letter - I didn't have time to write a short one.”
>> ― Mark Twain
> 
> I agree with Stephen, the extra functions provide no useful feature or even the comments are not very useful IMO.
> 

It is a bit different here. You're changing the code in an
absolutely equivalent way. IMHO complexity of the code
before and after the patch is absolutely the same.
Anyway, it does not matter a lot. If it think it would be
better in a new way - no problem.

@Keith, could you ack the patch series and I'll happily
apply it.
  

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 5735988e7c82..aeae6e8f5e93 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -373,15 +373,6 @@  tap_verify_csum(struct rte_mbuf *mbuf)
 	}
 }
 
-static uint64_t
-tap_rx_offload_get_port_capa(void)
-{
-	/*
-	 * No specific port Rx offload capabilities.
-	 */
-	return 0;
-}
-
 static uint64_t
 tap_rx_offload_get_queue_capa(void)
 {
@@ -506,15 +497,6 @@  pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	return num_rx;
 }
 
-static uint64_t
-tap_tx_offload_get_port_capa(void)
-{
-	/*
-	 * No specific port Tx offload capabilities.
-	 */
-	return 0;
-}
-
 static uint64_t
 tap_tx_offload_get_queue_capa(void)
 {
@@ -1016,11 +998,9 @@  tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->min_rx_bufsize = 0;
 	dev_info->speed_capa = tap_dev_speed_capa();
 	dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
-	dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
-				    dev_info->rx_queue_offload_capa;
+	dev_info->rx_offload_capa = dev_info->rx_queue_offload_capa;
 	dev_info->tx_queue_offload_capa = tap_tx_offload_get_queue_capa();
-	dev_info->tx_offload_capa = tap_tx_offload_get_port_capa() |
-				    dev_info->tx_queue_offload_capa;
+	dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa;
 	dev_info->hash_key_size = TAP_RSS_HASH_KEY_SIZE;
 	/*
 	 * limitation: TAP supports all of IP, UDP and TCP hash