Line data Source code
1 : /* SPDX-License-Identifier: BSD-2-Clause 2 : * Copyright(c) HCL TECHNOLOGIES LTD 3 : * Submitted on behalf of a third-party: Intel Corporation, a 4 : * Delaware corporation, having its principal place of business 5 : * at 2200 Mission College Boulevard, 6 : * Santa Clara, California 95052, USA 7 : */ 8 : 9 : #include <vr_interface.h> 10 : #include "vr_dpdk_representor.h" 11 : 12 : static struct vr_dpdk_representor_ops *representor_ops; 13 : 14 : void 15 0 : vr_dpdk_representor_ops_register(struct vr_dpdk_representor_ops *ops) 16 : { 17 0 : representor_ops = ops; 18 0 : } 19 : 20 : void 21 0 : vr_dpdk_representor_ops_deregister(void) 22 : { 23 0 : representor_ops = NULL; 24 0 : } 25 : 26 : enum vr_dpdk_representor_op_res 27 332 : vr_dpdk_representor_add(struct vr_interface *vif) 28 : { 29 332 : struct vr_dpdk_representor_ops *ops = representor_ops; 30 : 31 332 : if (!ops || !ops->vif_add) { 32 332 : return VR_DPDK_REPRESENTOR_OP_RES_NOT_HANDLED; 33 : } 34 : 35 0 : return ops->vif_add(vif); 36 : } 37 : 38 : enum vr_dpdk_representor_op_res 39 329 : vr_dpdk_representor_del(struct vr_interface *vif) 40 : { 41 329 : struct vr_dpdk_representor_ops *ops = representor_ops; 42 : 43 329 : if (!ops || !ops->vif_del) { 44 329 : return VR_DPDK_REPRESENTOR_OP_RES_NOT_HANDLED; 45 : } 46 : 47 0 : return ops->vif_del(vif); 48 : } 49 : 50 : enum vr_dpdk_representor_op_res 51 1896 : vr_dpdk_representor_stats_update(struct vr_interface *vif) 52 : { 53 1896 : struct vr_dpdk_representor_ops *ops = representor_ops; 54 : 55 1896 : if (!ops || !ops->stats_update) { 56 1896 : return VR_DPDK_REPRESENTOR_OP_RES_NOT_HANDLED; 57 : } 58 : 59 0 : return ops->stats_update(vif); 60 : }