1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Intel Corporation 3 */ 4 5 #ifndef _HOTPLUG_MP_H_ 6 #define _HOTPLUG_MP_H_ 7 8 #include "rte_dev.h" 9 #include "rte_bus.h" 10 11 #define EAL_DEV_MP_ACTION_REQUEST "eal_dev_mp_request" 12 #define EAL_DEV_MP_ACTION_RESPONSE "eal_dev_mp_response" 13 14 #define EAL_DEV_MP_DEV_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN 15 #define EAL_DEV_MP_BUS_NAME_MAX_LEN 32 16 #define EAL_DEV_MP_DEV_ARGS_MAX_LEN 128 17 18 enum eal_dev_req_type { 19 EAL_DEV_REQ_TYPE_ATTACH, 20 EAL_DEV_REQ_TYPE_DETACH, 21 EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK, 22 EAL_DEV_REQ_TYPE_DETACH_ROLLBACK, 23 }; 24 25 struct eal_dev_mp_req { 26 enum eal_dev_req_type t; 27 char devargs[EAL_DEV_MP_DEV_ARGS_MAX_LEN]; 28 int result; 29 }; 30 31 /** 32 * Register all mp action callbacks for hotplug. 33 * 34 * @return 35 * 0 on success, negative on error. 36 */ 37 int 38 eal_mp_dev_hotplug_init(void); 39 40 /** 41 * Unregister all mp action callbacks for hotplug. 42 */ 43 void 44 eal_mp_dev_hotplug_cleanup(void); 45 46 /** 47 * This is a synchronous wrapper for secondary process send 48 * request to primary process, this is invoked when an attach 49 * or detach request is issued from primary process. 50 */ 51 int eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req); 52 53 /** 54 * this is a synchronous wrapper for primary process send 55 * request to secondary process, this is invoked when an attach 56 * or detach request issued from secondary process. 57 */ 58 int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req); 59 60 61 #endif /* _HOTPLUG_MP_H_ */ 62