199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2018 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _HOTPLUG_MP_H_ 699a2dd95SBruce Richardson #define _HOTPLUG_MP_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson #include "rte_dev.h" 999a2dd95SBruce Richardson 1099a2dd95SBruce Richardson #define EAL_DEV_MP_ACTION_REQUEST "eal_dev_mp_request" 1199a2dd95SBruce Richardson #define EAL_DEV_MP_ACTION_RESPONSE "eal_dev_mp_response" 1299a2dd95SBruce Richardson 1399a2dd95SBruce Richardson #define EAL_DEV_MP_DEV_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN 1499a2dd95SBruce Richardson #define EAL_DEV_MP_BUS_NAME_MAX_LEN 32 1599a2dd95SBruce Richardson #define EAL_DEV_MP_DEV_ARGS_MAX_LEN 128 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson enum eal_dev_req_type { 1899a2dd95SBruce Richardson EAL_DEV_REQ_TYPE_ATTACH, 1999a2dd95SBruce Richardson EAL_DEV_REQ_TYPE_DETACH, 2099a2dd95SBruce Richardson EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK, 2199a2dd95SBruce Richardson EAL_DEV_REQ_TYPE_DETACH_ROLLBACK, 2299a2dd95SBruce Richardson }; 2399a2dd95SBruce Richardson 2499a2dd95SBruce Richardson struct eal_dev_mp_req { 2599a2dd95SBruce Richardson enum eal_dev_req_type t; 2699a2dd95SBruce Richardson char devargs[EAL_DEV_MP_DEV_ARGS_MAX_LEN]; 2799a2dd95SBruce Richardson int result; 2899a2dd95SBruce Richardson }; 2999a2dd95SBruce Richardson 3099a2dd95SBruce Richardson /** 3199a2dd95SBruce Richardson * Register all mp action callbacks for hotplug. 3299a2dd95SBruce Richardson * 3399a2dd95SBruce Richardson * @return 3499a2dd95SBruce Richardson * 0 on success, negative on error. 3599a2dd95SBruce Richardson */ 3699a2dd95SBruce Richardson int 3799a2dd95SBruce Richardson eal_mp_dev_hotplug_init(void); 3899a2dd95SBruce Richardson 3999a2dd95SBruce Richardson /** 40*e8dc971bSStephen Hemminger * Unregister all mp action callbacks for hotplug. 41*e8dc971bSStephen Hemminger */ 42*e8dc971bSStephen Hemminger void 43*e8dc971bSStephen Hemminger eal_mp_dev_hotplug_cleanup(void); 44*e8dc971bSStephen Hemminger 45*e8dc971bSStephen Hemminger /** 4699a2dd95SBruce Richardson * This is a synchronous wrapper for secondary process send 4799a2dd95SBruce Richardson * request to primary process, this is invoked when an attach 4899a2dd95SBruce Richardson * or detach request is issued from primary process. 4999a2dd95SBruce Richardson */ 5099a2dd95SBruce Richardson int eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req); 5199a2dd95SBruce Richardson 5299a2dd95SBruce Richardson /** 5399a2dd95SBruce Richardson * this is a synchronous wrapper for primary process send 5499a2dd95SBruce Richardson * request to secondary process, this is invoked when an attach 5599a2dd95SBruce Richardson * or detach request issued from secondary process. 5699a2dd95SBruce Richardson */ 5799a2dd95SBruce Richardson int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req); 5899a2dd95SBruce Richardson 5999a2dd95SBruce Richardson 6099a2dd95SBruce Richardson #endif /* _HOTPLUG_MP_H_ */ 61