Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2023 Marvell. 3 : : */ 4 : : 5 : : #ifndef _ROC_MCS_PRIV_H_ 6 : : #define _ROC_MCS_PRIV_H_ 7 : : 8 : : #define MAX_PORTS_PER_MCS 4 9 : : 10 : : enum mcs_error_status { 11 : : MCS_ERR_PARAM = -900, 12 : : MCS_ERR_HW_NOTSUP = -901, 13 : : MCS_ERR_DEVICE_NOT_FOUND = -902, 14 : : }; 15 : : 16 : : #define MCS_SUPPORT_CHECK \ 17 : : do { \ 18 : : if (!(roc_feature_bphy_has_macsec() || roc_feature_nix_has_macsec())) \ 19 : : return MCS_ERR_HW_NOTSUP; \ 20 : : } while (0) 21 : : 22 : : struct mcs_sc_conf { 23 : : struct { 24 : : uint64_t sci; 25 : : uint16_t sa_idx0; 26 : : uint16_t sa_idx1; 27 : : uint8_t rekey_enb; 28 : : } tx; 29 : : struct { 30 : : uint16_t sa_idx; 31 : : uint8_t an; 32 : : } rx; 33 : : }; 34 : : 35 : : struct mcs_rsrc { 36 : : struct plt_bitmap *tcam_bmap; 37 : : void *tcam_bmap_mem; 38 : : struct plt_bitmap *secy_bmap; 39 : : void *secy_bmap_mem; 40 : : struct plt_bitmap *sc_bmap; 41 : : void *sc_bmap_mem; 42 : : struct plt_bitmap *sa_bmap; 43 : : void *sa_bmap_mem; 44 : : struct mcs_sc_conf *sc_conf; 45 : : }; 46 : : 47 : : struct mcs_priv { 48 : : struct mcs_rsrc *port_rsrc; 49 : : struct mcs_rsrc dev_rsrc; 50 : : uint64_t default_sci; 51 : : uint32_t lmac_bmap; 52 : : uint8_t num_mcs_blks; 53 : : uint8_t tcam_entries; 54 : : uint8_t secy_entries; 55 : : uint8_t sc_entries; 56 : : uint16_t sa_entries; 57 : : }; 58 : : 59 : : static inline struct mcs_priv * 60 : : roc_mcs_to_mcs_priv(struct roc_mcs *roc_mcs) 61 : : { 62 : 0 : return (struct mcs_priv *)&roc_mcs->reserved[0]; 63 : : } 64 : : 65 : : static inline void * 66 : : roc_mcs_to_mcs_cb_list(struct roc_mcs *roc_mcs) 67 : : { 68 [ # # # # ]: 0 : return (void *)((uintptr_t)roc_mcs->reserved + sizeof(struct mcs_priv)); 69 : : } 70 : : 71 : : int mcs_event_cb_process(struct roc_mcs *mcs, struct roc_mcs_event_desc *desc); 72 : : 73 : : #endif /* _ROC_MCS_PRIV_H_ */