1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
8 #include <rte_bus_pci.h>
10 #include "octeontx_pkivf.h"
13 octeontx_pki_port_open(int port)
15 struct octeontx_mbox_hdr hdr;
18 hdr.coproc = OCTEONTX_PKI_COPROC;
19 hdr.msg = MBOX_PKI_PORT_OPEN;
22 res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0);
29 octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg)
31 struct octeontx_mbox_hdr hdr;
34 mbox_pki_hash_cfg_t h_cfg = *(mbox_pki_hash_cfg_t *)hash_cfg;
35 int len = sizeof(mbox_pki_hash_cfg_t);
37 hdr.coproc = OCTEONTX_PKI_COPROC;
38 hdr.msg = MBOX_PKI_PORT_HASH_CONFIG;
41 res = octeontx_ssovf_mbox_send(&hdr, &h_cfg, len, NULL, 0);
49 octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg)
51 struct octeontx_mbox_hdr hdr;
54 mbox_pki_pktbuf_cfg_t b_cfg = *(mbox_pki_pktbuf_cfg_t *)buf_cfg;
55 int len = sizeof(mbox_pki_pktbuf_cfg_t);
57 hdr.coproc = OCTEONTX_PKI_COPROC;
58 hdr.msg = MBOX_PKI_PORT_PKTBUF_CONFIG;
61 res = octeontx_ssovf_mbox_send(&hdr, &b_cfg, len, NULL, 0);
68 octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg)
70 struct octeontx_mbox_hdr hdr;
73 mbox_pki_qos_cfg_t q_cfg = *(mbox_pki_qos_cfg_t *)qos_cfg;
74 int len = sizeof(mbox_pki_qos_cfg_t);
76 hdr.coproc = OCTEONTX_PKI_COPROC;
77 hdr.msg = MBOX_PKI_PORT_CREATE_QOS;
80 res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0);
89 octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg)
91 struct octeontx_mbox_hdr hdr;
94 mbox_pki_errcheck_cfg_t e_cfg;
95 e_cfg = *((mbox_pki_errcheck_cfg_t *)(cfg));
96 int len = sizeof(mbox_pki_errcheck_cfg_t);
98 hdr.coproc = OCTEONTX_PKI_COPROC;
99 hdr.msg = MBOX_PKI_PORT_ERRCHK_CONFIG;
102 res = octeontx_ssovf_mbox_send(&hdr, &e_cfg, len, NULL, 0);
109 #define PCI_VENDOR_ID_CAVIUM 0x177D
110 #define PCI_DEVICE_ID_OCTEONTX_PKI_VF 0xA0DD
112 /* PKIVF pcie device */
114 pkivf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
116 RTE_SET_USED(pci_drv);
117 RTE_SET_USED(pci_dev);
119 /* For secondary processes, the primary has done all the work */
120 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
126 static const struct rte_pci_id pci_pkivf_map[] = {
128 RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
129 PCI_DEVICE_ID_OCTEONTX_PKI_VF)
136 static struct rte_pci_driver pci_pkivf = {
137 .id_table = pci_pkivf_map,
138 .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
139 .probe = pkivf_probe,
142 RTE_PMD_REGISTER_PCI(octeontx_pkivf, pci_pkivf);