update Cavium Inc copyright headers
[dpdk.git] / drivers / net / thunderx / base / nicvf_hw.c
index 2b12d9c..c9f0d26 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *   BSD LICENSE
  *
- *   Copyright (C) Cavium networks Ltd. 2016.
+ *   Copyright (C) Cavium, Inc. 2016.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
  *       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
+ *     * Neither the name of Cavium, Inc nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
  *
@@ -141,7 +141,14 @@ nicvf_base_init(struct nicvf *nic)
                return NICVF_ERR_BASE_INIT;
 
        if (nicvf_hw_version(nic) == PCI_SUB_DEVICE_ID_CN88XX_PASS2_NICVF)
-               nic->hwcap |= NICVF_CAP_TUNNEL_PARSING;
+               nic->hwcap |= NICVF_CAP_TUNNEL_PARSING | NICVF_CAP_CQE_RX2;
+
+       if (nicvf_hw_version(nic) == PCI_SUB_DEVICE_ID_CN81XX_NICVF)
+               nic->hwcap |= NICVF_CAP_TUNNEL_PARSING | NICVF_CAP_CQE_RX2;
+
+       if (nicvf_hw_version(nic) == PCI_SUB_DEVICE_ID_CN83XX_NICVF)
+               nic->hwcap |= NICVF_CAP_TUNNEL_PARSING | NICVF_CAP_CQE_RX2 |
+                               NICVF_CAP_DISABLE_APAD;
 
        return NICVF_OK;
 }
@@ -494,9 +501,9 @@ nicvf_qsize_rbdr_roundup(uint32_t val)
 }
 
 int
-nicvf_qset_rbdr_precharge(struct nicvf *nic, uint16_t ridx,
-                         rbdr_pool_get_handler handler,
-                         void *opaque, uint32_t max_buffs)
+nicvf_qset_rbdr_precharge(void *dev, struct nicvf *nic,
+                         uint16_t ridx, rbdr_pool_get_handler handler,
+                         uint32_t max_buffs)
 {
        struct rbdr_entry_t *desc, *desc0;
        struct nicvf_rbdr *rbdr = nic->rbdr;
@@ -511,7 +518,7 @@ nicvf_qset_rbdr_precharge(struct nicvf *nic, uint16_t ridx,
                if (count >= max_buffs)
                        break;
                desc0 = desc + count;
-               phy = handler(opaque);
+               phy = handler(dev, nic);
                if (phy) {
                        desc0->full_addr = phy;
                        count++;
@@ -721,6 +728,24 @@ nicvf_vlan_hw_strip(struct nicvf *nic, bool enable)
        nicvf_reg_write(nic, NIC_VNIC_RQ_GEN_CFG, val);
 }
 
+void
+nicvf_apad_config(struct nicvf *nic, bool enable)
+{
+       uint64_t val;
+
+       /* APAD always enabled in this device */
+       if (!(nic->hwcap & NICVF_CAP_DISABLE_APAD))
+               return;
+
+       val = nicvf_reg_read(nic, NIC_VNIC_RQ_GEN_CFG);
+       if (enable)
+               val &= ~(1ULL << NICVF_QS_RQ_DIS_APAD_SHIFT);
+       else
+               val |= (1ULL << NICVF_QS_RQ_DIS_APAD_SHIFT);
+
+       nicvf_reg_write(nic, NIC_VNIC_RQ_GEN_CFG, val);
+}
+
 void
 nicvf_rss_set_key(struct nicvf *nic, uint8_t *key)
 {