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