net/mlx5: add ConnectX6-DX device ID
[dpdk.git] / drivers / net / octeontx / base / octeontx_pkivf.h
index 7cf8332..764aff5 100644 (file)
@@ -1,33 +1,5 @@
-/*
- *   BSD LICENSE
- *
- *   Copyright (C) Cavium Inc. 2017. All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Cavium networks nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Cavium, Inc
  */
 
 #ifndef        __OCTEONTX_PKI_H__
@@ -240,10 +212,18 @@ typedef struct mbox_pki_port_modify_qos_entry {
                uint8_t f_gaura:1;
                uint8_t f_grptag_ok:1;
                uint8_t f_grptag_bad:1;
+               uint8_t f_tag_type:1;
        } mmask;
+       uint8_t tag_type;
        struct mbox_pki_qos_entry qos_entry;
 } mbox_pki_mod_qos_t;
 
+/* pki flow/style enable qos */
+typedef struct mbox_pki_port_delete_qos_entry {
+       uint8_t port_type;
+       uint16_t index;
+} mbox_pki_del_qos_t;
+
 /* PKI maximum constants */
 #define PKI_VF_MAX                     (1)
 #define PKI_MAX_PKTLEN                 (32768)
@@ -406,6 +386,12 @@ typedef struct pki_port_create_qos {
        struct pki_qos_entry qos_entry[PKO_MAX_QOS_ENTRY];
 } pki_qos_cfg_t;
 
+/* pki flow/style enable qos */
+typedef struct pki_port_delete_qos_entry {
+       uint8_t port_type;
+       uint16_t index;
+} pki_del_qos_t;
+
 /* pki flow/style enable qos */
 typedef struct pki_port_modify_qos_entry {
        uint8_t port_type;
@@ -415,17 +401,125 @@ typedef struct pki_port_modify_qos_entry {
                uint8_t f_grp_ok:1;
                uint8_t f_grp_bad:1;
                uint8_t f_gaura:1;
+               uint8_t f_grptag_ok:1;
+               uint8_t f_grptag_bad:1;
+               uint8_t f_tag_type:1;
        } mmask;
+       uint8_t tag_type;
        struct pki_qos_entry qos_entry;
 } pki_mod_qos_t;
 
+static inline int
+octeontx_pki_port_modify_qos(int port, pki_mod_qos_t *qos_cfg)
+{
+       struct octeontx_mbox_hdr hdr;
+       int res;
+
+       mbox_pki_mod_qos_t q_cfg = *(mbox_pki_mod_qos_t *)qos_cfg;
+       int len = sizeof(mbox_pki_mod_qos_t);
+
+       hdr.coproc = OCTEONTX_PKI_COPROC;
+       hdr.msg = MBOX_PKI_PORT_MODIFY_QOS;
+       hdr.vfid = port;
+
+       res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0);
+       if (res < 0)
+               return -EACCES;
+
+       return res;
+}
+
+static inline int
+octeontx_pki_port_delete_qos(int port, pki_del_qos_t *qos_cfg)
+{
+       struct octeontx_mbox_hdr hdr;
+       int res;
+
+       mbox_pki_del_qos_t q_cfg = *(mbox_pki_del_qos_t *)qos_cfg;
+       int len = sizeof(mbox_pki_del_qos_t);
+
+       hdr.coproc = OCTEONTX_PKI_COPROC;
+       hdr.msg = MBOX_PKI_PORT_DELETE_QOS;
+       hdr.vfid = port;
+
+       res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0);
+       if (res < 0)
+               return -EACCES;
+
+       return res;
+}
+
+static inline int
+octeontx_pki_port_close(int port)
+{
+       struct octeontx_mbox_hdr hdr;
+       int res;
+
+       mbox_pki_port_t ptype;
+       int len = sizeof(mbox_pki_port_t);
+       memset(&ptype, 0, len);
+       ptype.port_type = OCTTX_PORT_TYPE_NET;
+
+       hdr.coproc = OCTEONTX_PKI_COPROC;
+       hdr.msg = MBOX_PKI_PORT_CLOSE;
+       hdr.vfid = port;
+
+       res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0);
+       if (res < 0)
+               return -EACCES;
+
+       return res;
+}
+
+static inline int
+octeontx_pki_port_start(int port)
+{
+       struct octeontx_mbox_hdr hdr;
+       int res;
+
+       mbox_pki_port_t ptype;
+       int len = sizeof(mbox_pki_port_t);
+       memset(&ptype, 0, len);
+       ptype.port_type = OCTTX_PORT_TYPE_NET;
+
+       hdr.coproc = OCTEONTX_PKI_COPROC;
+       hdr.msg = MBOX_PKI_PORT_START;
+       hdr.vfid = port;
+
+       res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0);
+       if (res < 0)
+               return -EACCES;
+
+       return res;
+}
+
+static inline int
+octeontx_pki_port_stop(int port)
+{
+       struct octeontx_mbox_hdr hdr;
+       int res;
+
+       mbox_pki_port_t ptype;
+       int len = sizeof(mbox_pki_port_t);
+       memset(&ptype, 0, len);
+       ptype.port_type = OCTTX_PORT_TYPE_NET;
+
+       hdr.coproc = OCTEONTX_PKI_COPROC;
+       hdr.msg = MBOX_PKI_PORT_STOP;
+       hdr.vfid = port;
+
+       res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0);
+       if (res < 0)
+               return -EACCES;
+
+       return res;
+}
+
 int octeontx_pki_port_open(int port);
 int octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg);
 int octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg);
 int octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg);
 int octeontx_pki_port_close(int port);
-int octeontx_pki_port_start(int port);
-int octeontx_pki_port_stop(int port);
 int octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg);
 
 #endif /* __OCTEONTX_PKI_H__ */