- CN96xx
- CN93xx
+- CNF95xx
OCTEON TX2 Resource Virtualization Unit architecture
----------------------------------------------------
#define PCI_DEVID_OCTEONTX2_RVU_AF_VF 0xA0f8
#define PCI_DEVID_OCTEONTX2_DPI_VF 0xA081
+/* Subsystem Device ID */
+#define PCI_SUBSYS_DEVID_96XX_95XX 0xB200
+
+/*
+ * REVID for RVU PCIe devices.
+ * Bits 0..1: minor pass
+ * Bits 3..2: major pass
+ * Bits 7..4: midr id, 0:96, 1:95, 2:loki, f:unknown
+ */
+
+#define RVU_PCI_REV_MIDR_ID(rev_id) (rev_id >> 4)
+#define RVU_PCI_REV_MAJOR(rev_id) ((rev_id >> 2) & 0x3)
+#define RVU_PCI_REV_MINOR(rev_id) (rev_id & 0x3)
+
+#define RVU_PCI_CN96XX_MIDR_ID 0x0
+#define RVU_PCI_CNF95XX_MIDR_ID 0x1
+
+/* PCI Config offsets */
+#define RVU_PCI_REVISION_ID 0x08
+
/* IO Access */
#define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
#define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
return count;
}
-static void
-otx2_update_pass_hwcap(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
-{
- RTE_SET_USED(pci_dev);
-
- /* Update this logic when we have A1 */
- dev->hwcap |= OTX2_HWCAP_F_A0;
-}
-
static void
otx2_update_vf_hwcap(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
{
- dev->hwcap = 0;
-
switch (pci_dev->id.device_id) {
case PCI_DEVID_OCTEONTX2_RVU_PF:
break;
* Initialize the otx2 device
*/
int
-otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
+otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev)
{
int up_direction = MBOX_DIR_PFAF_UP;
int rc, direction = MBOX_DIR_PFAF;
dev->bar4 = bar4;
otx2_update_vf_hwcap(pci_dev, dev);
- otx2_update_pass_hwcap(pci_dev, dev);
if (otx2_dev_is_vf(dev)) {
direction = MBOX_DIR_VFPF;
#include "otx2_mempool.h"
/* Common HWCAP flags. Use from LSB bits */
-#define OTX2_HWCAP_F_VF BIT_ULL(0) /* VF device */
+#define OTX2_HWCAP_F_VF BIT_ULL(8) /* VF device */
#define otx2_dev_is_vf(dev) (dev->hwcap & OTX2_HWCAP_F_VF)
#define otx2_dev_is_pf(dev) (!(dev->hwcap & OTX2_HWCAP_F_VF))
#define otx2_dev_is_lbk(dev) ((dev->hwcap & OTX2_HWCAP_F_VF) && \
(dev->tx_chan_base < 0x700))
+#define otx2_dev_revid(dev) (dev->hwcap & 0xFF)
-#define OTX2_HWCAP_F_A0 BIT_ULL(1) /* A0 device */
-#define otx2_dev_is_A0(dev) (dev->hwcap & OTX2_HWCAP_F_A0)
+#define otx2_dev_is_A0(dev) \
+ ((RVU_PCI_REV_MAJOR(otx2_dev_revid(dev)) == 0x0) && \
+ (RVU_PCI_REV_MINOR(otx2_dev_revid(dev)) == 0x0))
+#define otx2_dev_is_Ax(dev) \
+ ((RVU_PCI_REV_MAJOR(otx2_dev_revid(dev)) == 0x0))
struct otx2_dev;
OTX2_DEV;
};
-int otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev);
+int otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev);
+
+/* Common dev init and fini routines */
+
+static __rte_always_inline int
+otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
+{
+ struct otx2_dev *dev = otx2_dev;
+ uint8_t rev_id;
+ int rc;
+
+ rc = rte_pci_read_config(pci_dev, &rev_id,
+ 1, RVU_PCI_REVISION_ID);
+ if (rc != 1) {
+ otx2_err("Failed to read pci revision id, rc=%d", rc);
+ return rc;
+ }
+
+ if (pci_dev->id.subsystem_device_id == PCI_SUBSYS_DEVID_96XX_95XX)
+ dev->hwcap = rev_id;
+ else
+ dev->hwcap = 0;
+
+ return otx2_dev_priv_init(pci_dev, otx2_dev);
+}
+
void otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev);
int otx2_dev_active_vfs(void *otx2_dev);
otx2_dev_active_vfs;
otx2_dev_fini;
- otx2_dev_init;
+ otx2_dev_priv_init;
otx2_logtype_base;
otx2_logtype_dpi;
nix_lf_free(dev);
}
- if (otx2_dev_is_A0(dev) &&
+ if (otx2_dev_is_Ax(dev) &&
(txmode->offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
((txmode->offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
(txmode->offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM))) {
dev->tx_offload_capa = nix_get_tx_offload_capa(dev);
dev->rx_offload_capa = nix_get_rx_offload_capa(dev);
- if (otx2_dev_is_A0(dev)) {
+ if (otx2_dev_is_Ax(dev)) {
dev->hwcap |= OTX2_FIXUP_F_MIN_4K_Q;
dev->hwcap |= OTX2_FIXUP_F_LIMIT_CQ_FULL;
}
/* Check if TX pause frame is already enabled or not */
if (fc->tx_pause ^ tx_pause) {
- if (otx2_dev_is_A0(dev) && eth_dev->data->dev_started) {
- /* on A0, CQ should be in disabled state
+ if (otx2_dev_is_Ax(dev) && eth_dev->data->dev_started) {
+ /* on Ax, CQ should be in disabled state
* while setting flow control configuration.
*/
otx2_info("Stop the port=%d for setting flow control\n",
*/
otx2_nix_flow_ctrl_get(eth_dev, &fc_conf);
- /* To avoid Link credit deadlock on A0, disable Tx FC if it's enabled */
- if (otx2_dev_is_A0(dev) &&
+ /* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */
+ if (otx2_dev_is_Ax(dev) &&
(fc_conf.mode == RTE_FC_FULL || fc_conf.mode == RTE_FC_RX_PAUSE)) {
fc_conf.mode =
(fc_conf.mode == RTE_FC_FULL ||
nix_tm_have_tl1_access(struct otx2_eth_dev *dev)
{
bool is_lbk = otx2_dev_is_lbk(dev);
- return otx2_dev_is_pf(dev) && !otx2_dev_is_A0(dev) &&
+ return otx2_dev_is_pf(dev) && !otx2_dev_is_Ax(dev) &&
!is_lbk && !dev->maxvf;
}