[v2,3/3] testpmd: remove the dev event callback register

Message ID 1531119413-17298-4-git-send-email-jia.guo@intel.com (mailing list archive)
State Superseded, archived
Headers
Series Enable eal hotplug event detect for i40e/ixgbe |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Guo, Jia July 9, 2018, 6:56 a.m. UTC
  Since now we can use driver to management the eal event for hotplug,
so no need to register dev event callback in app anymore. This patch
remove the related code.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v2->v1:
no change.
---
 app/test-pmd/testpmd.c | 76 --------------------------------------------------
 1 file changed, 76 deletions(-)
  

Comments

Wenzhuo Lu July 9, 2018, 7:39 a.m. UTC | #1
Hi,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jeff Guo
> Sent: Monday, July 9, 2018 2:57 PM
> To: stephen@networkplumber.org; Richardson, Bruce
> <bruce.richardson@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>;
> gaetan.rivet@6wind.com; Wu, Jingjing <jingjing.wu@intel.com>;
> thomas@monjalon.net; motih@mellanox.com; matan@mellanox.com; Van
> Haaren, Harry <harry.van.haaren@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; He, Shaopeng <shaopeng.he@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>;
> arybchenko@solarflare.com
> Cc: jblunck@infradead.org; shreyansh.jain@nxp.com; dev@dpdk.org; Guo,
> Jia <jia.guo@intel.com>; Zhang, Helin <helin.zhang@intel.com>
> Subject: [dpdk-dev] [PATCH v2 3/3] testpmd: remove the dev event callback
> register
> 
> Since now we can use driver to management the eal event for hotplug, so no
> need to register dev event callback in app anymore. This patch remove the
> related code.
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
  
Andrew Rybchenko July 9, 2018, 8:16 a.m. UTC | #2
On 09.07.2018 09:56, Jeff Guo wrote:
> Since now we can use driver to management the eal event for hotplug,
> so no need to register dev event callback in app anymore. This patch
> remove the related code.

I don't understand why handling on device level means removal
of the application callback. May be as a cleanup.
I guess application still could be interested in device addition and
removal events. It is mainly question to testpmd maintainer.
  
Guo, Jia July 9, 2018, 8:23 a.m. UTC | #3
On 7/9/2018 4:16 PM, Andrew Rybchenko wrote:
> On 09.07.2018 09:56, Jeff Guo wrote:
>> Since now we can use driver to management the eal event for hotplug,
>> so no need to register dev event callback in app anymore. This patch
>> remove the related code.
>
> I don't understand why handling on device level means removal
> of the application callback. May be as a cleanup.
> I guess application still could be interested in device addition and
> removal events. It is mainly question to testpmd maintainer.
>

I think the callback could be used by anyone who interesting it. you are 
right, but It is optional, who use it will surely in charge of the event 
and callback management.
Here remove it, just for select an other choice and no select the 
previous way to show hotplug example.
just select 1 from 2, no need to let 2 combined.
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 24c1998..10ed660 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -400,12 +400,6 @@  static void check_all_ports_link_status(uint32_t port_mask);
 static int eth_event_callback(portid_t port_id,
 			      enum rte_eth_event_type type,
 			      void *param, void *ret_param);
-static void eth_dev_event_callback(char *device_name,
-				enum rte_dev_event_type type,
-				void *param);
-static int eth_dev_event_callback_register(void);
-static int eth_dev_event_callback_unregister(void);
-
 
 /*
  * Check if all the ports are started.
@@ -1915,39 +1909,6 @@  reset_port(portid_t pid)
 	printf("Done\n");
 }
 
-static int
-eth_dev_event_callback_register(void)
-{
-	int ret;
-
-	/* register the device event callback */
-	ret = rte_dev_event_callback_register(NULL,
-		eth_dev_event_callback, NULL);
-	if (ret) {
-		printf("Failed to register device event callback\n");
-		return -1;
-	}
-
-	return 0;
-}
-
-
-static int
-eth_dev_event_callback_unregister(void)
-{
-	int ret;
-
-	/* unregister the device event callback */
-	ret = rte_dev_event_callback_unregister(NULL,
-		eth_dev_event_callback, NULL);
-	if (ret < 0) {
-		printf("Failed to unregister device event callback\n");
-		return -1;
-	}
-
-	return 0;
-}
-
 void
 attach_port(char *identifier)
 {
@@ -2049,10 +2010,6 @@  pmd_test_exit(void)
 			RTE_LOG(ERR, EAL,
 				"fail to stop device event monitor.");
 
-		ret = eth_dev_event_callback_unregister();
-		if (ret)
-			RTE_LOG(ERR, EAL,
-				"fail to unregister all event callbacks.");
 	}
 
 	printf("\nBye...\n");
@@ -2191,37 +2148,6 @@  eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 	return 0;
 }
 
-/* This function is used by the interrupt thread */
-static void
-eth_dev_event_callback(char *device_name, enum rte_dev_event_type type,
-			     __rte_unused void *arg)
-{
-	if (type >= RTE_DEV_EVENT_MAX) {
-		fprintf(stderr, "%s called upon invalid event %d\n",
-			__func__, type);
-		fflush(stderr);
-	}
-
-	switch (type) {
-	case RTE_DEV_EVENT_REMOVE:
-		RTE_LOG(ERR, EAL, "The device: %s has been removed!\n",
-			device_name);
-		/* TODO: After finish failure handle, begin to stop
-		 * packet forward, stop port, close port, detach port.
-		 */
-		break;
-	case RTE_DEV_EVENT_ADD:
-		RTE_LOG(ERR, EAL, "The device: %s has been added!\n",
-			device_name);
-		/* TODO: After finish kernel driver binding,
-		 * begin to attach port.
-		 */
-		break;
-	default:
-		break;
-	}
-}
-
 static int
 set_tx_queue_stats_mapping_registers(portid_t port_id, struct rte_port *port)
 {
@@ -2735,8 +2661,6 @@  main(int argc, char** argv)
 			rte_errno = EINVAL;
 			return -1;
 		}
-		eth_dev_event_callback_register();
-
 	}
 
 	if (start_port(RTE_PORT_ALL) != 0)