return rc;
}
+int tf_get_shared_tbl_increment(struct tf *tfp,
+ struct tf_get_shared_tbl_increment_parms *parms)
+{
+ int rc = 0;
+ struct tf_session *tfs;
+ struct tf_dev_info *dev;
+
+ TF_CHECK_PARMS2(tfp, parms);
+
+ /* Retrieve the session information */
+ rc = tf_session_get_session(tfp, &tfs);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Failed to lookup session, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
+
+ /* Retrieve the device information */
+ rc = tf_session_get_device(tfs, &dev);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Failed to lookup device, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
+
+ /* Internal table type processing */
+
+ if (dev->ops->tf_dev_get_shared_tbl_increment == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_get_shared_tbl_increment(tfp, parms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Get table increment not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
+
+ return rc;
+}
+
int
tf_alloc_tbl_scope(struct tf *tfp,
struct tf_alloc_tbl_scope_parms *parms)
*/
int tf_get_session_info(struct tf *tfp,
struct tf_get_session_info_parms *parms);
-
/**
* Experimental
*
* @ref tf_get_tbl_entry
*
* @ref tf_bulk_get_tbl_entry
+ *
+ * @ref tf_get_shared_tbl_increment
*/
/**
int tf_set_tbl_entry(struct tf *tfp,
struct tf_set_tbl_entry_parms *parms);
+/**
+ * tf_get_shared_tbl_increment parameter definition
+ */
+struct tf_get_shared_tbl_increment_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of object to set
+ */
+ enum tf_tbl_type type;
+ /**
+ * [out] Value to increment by for resource type
+ */
+ uint32_t increment_cnt;
+};
+
+/**
+ * tf_get_shared_tbl_increment
+ *
+ * This API is currently only required for use in the shared
+ * session for Thor (p58) actions. An increment count is returned per
+ * type to indicate how much to increment the start by for each
+ * entry (see tf_resource_info)
+ *
+ * Returns success or failure code.
+ */
+int tf_get_shared_tbl_increment(struct tf *tfp,
+ struct tf_get_shared_tbl_increment_parms *parms);
+
/**
* tf_get_tbl_entry parameter definition
*/
int (*tf_dev_get_bulk_tbl)(struct tf *tfp,
struct tf_tbl_get_bulk_parms *parms);
+ /**
+ * Gets the increment value to add to the shared session resource
+ * start offset by for each count in the "stride"
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to get shared tbl increment parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+ int (*tf_dev_get_shared_tbl_increment)(struct tf *tfp,
+ struct tf_get_shared_tbl_increment_parms *parms);
+
/**
* Retrieves the table resource info.
*
return 0;
}
+/**
+ * Device specific function that retrieves the increment
+ * required for certain table types in a shared session
+ *
+ * [in] tfp
+ * tf handle
+ *
+ * [in/out] parms
+ * pointer to parms structure
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+static int tf_dev_p4_get_shared_tbl_increment(struct tf *tfp __rte_unused,
+ struct tf_get_shared_tbl_increment_parms *parms)
+{
+ parms->increment_cnt = 1;
+ return 0;
+}
static int tf_dev_p4_get_mailbox(void)
{
return TF_KONG_MB;
.tf_dev_set_ext_tbl = NULL,
.tf_dev_get_tbl = NULL,
.tf_dev_get_bulk_tbl = NULL,
+ .tf_dev_get_shared_tbl_increment = tf_dev_p4_get_shared_tbl_increment,
.tf_dev_get_tbl_resc_info = NULL,
.tf_dev_alloc_tcam = NULL,
.tf_dev_free_tcam = NULL,
.tf_dev_alloc_search_tcam = NULL,
.tf_dev_set_tcam = NULL,
.tf_dev_get_tcam = NULL,
+#ifdef TF_TCAM_SHARED
+ .tf_dev_move_tcam = NULL,
+#endif /* TF_TCAM_SHARED */
.tf_dev_get_tcam_resc_info = NULL,
.tf_dev_insert_int_em_entry = NULL,
.tf_dev_delete_int_em_entry = NULL,
.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
.tf_dev_get_tbl = tf_tbl_get,
.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
+ .tf_dev_get_shared_tbl_increment = tf_dev_p4_get_shared_tbl_increment,
.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
#ifdef TF_TCAM_SHARED
.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
return ((((size) + 63) >> 6) * 8);
}
+/**
+ * Device specific function that retrieves the increment
+ * required for certain table types in a shared session
+ *
+ * [in] tfp
+ * tf handle
+ *
+ * [in/out] parms
+ * pointer to parms structure
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+static int tf_dev_p58_get_shared_tbl_increment(struct tf *tfp __rte_unused,
+ struct tf_get_shared_tbl_increment_parms *parms)
+{
+ switch (parms->type) {
+ case TF_TBL_TYPE_FULL_ACT_RECORD:
+ case TF_TBL_TYPE_COMPACT_ACT_RECORD:
+ case TF_TBL_TYPE_ACT_ENCAP_8B:
+ case TF_TBL_TYPE_ACT_ENCAP_16B:
+ case TF_TBL_TYPE_ACT_ENCAP_32B:
+ case TF_TBL_TYPE_ACT_ENCAP_64B:
+ case TF_TBL_TYPE_ACT_SP_SMAC:
+ case TF_TBL_TYPE_ACT_SP_SMAC_IPV4:
+ case TF_TBL_TYPE_ACT_SP_SMAC_IPV6:
+ case TF_TBL_TYPE_ACT_STATS_64:
+ case TF_TBL_TYPE_ACT_MODIFY_IPV4:
+ case TF_TBL_TYPE_ACT_MODIFY_8B:
+ case TF_TBL_TYPE_ACT_MODIFY_16B:
+ case TF_TBL_TYPE_ACT_MODIFY_32B:
+ case TF_TBL_TYPE_ACT_MODIFY_64B:
+ parms->increment_cnt = 8;
+ break;
+ default:
+ parms->increment_cnt = 1;
+ break;
+ }
+ return 0;
+}
+
#define TF_DEV_P58_BANK_SZ_64B 2048
/**
* Get SRAM table information.
.tf_dev_set_ext_tbl = NULL,
.tf_dev_get_tbl = NULL,
.tf_dev_get_bulk_tbl = NULL,
+ .tf_dev_get_shared_tbl_increment = tf_dev_p58_get_shared_tbl_increment,
.tf_dev_get_tbl_resc_info = NULL,
.tf_dev_alloc_tcam = NULL,
.tf_dev_free_tcam = NULL,
.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
.tf_dev_get_tbl = tf_tbl_get,
.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
+ .tf_dev_get_shared_tbl_increment = tf_dev_p58_get_shared_tbl_increment,
.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
#ifdef TF_TCAM_SHARED
.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
uint8_t bytes[(TF_TMP_MAX_KEY_BITLEN + 7) / 8];
};
+/** p58 has an enable bit, p4 does not
+ */
+#define TF_TCAM_SHARED_ENTRY_ENABLE 0x8
+
/** Move a WC TCAM entry from the high offset to the same low offset
*/
static int
int dphy_idx,
int key_sz_bytes,
int remap_sz_bytes,
- uint16_t num_slices)
+ uint16_t num_slices,
+ bool set_enable_bit)
{
int rc = 0;
struct tf_tcam_get_parms gparms;
return rc;
}
+ if (set_enable_bit)
+ tcam_key_obj.bytes[0] |= TF_TCAM_SHARED_ENTRY_ENABLE;
+
/* Override HI/LO type with parent WC TCAM type */
sparms.hcapi_type = hcapi_type;
sparms.dir = dir;
int tf_tcam_shared_move(struct tf *tfp,
struct tf_move_tcam_shared_entries_parms *parms,
int key_sz_bytes,
- int remap_sz_bytes)
+ int remap_sz_bytes,
+ bool set_enable_bit)
{
int rc;
struct tf_session *tfs;
lo_start + log_idx,
key_sz_bytes,
remap_sz_bytes,
- num_slices);
+ num_slices,
+ set_enable_bit);
if (rc) {
TFP_DRV_LOG(ERR,
"Cannot allocate %s index %d\n",
rc = tf_tcam_shared_move(tfp,
parms,
TF_TCAM_SHARED_KEY_SLICE_SZ_BYTES_P4,
- TF_TCAM_SHARED_REMAP_SZ_BYTES_P4);
+ TF_TCAM_SHARED_REMAP_SZ_BYTES_P4,
+ false); /* no enable bit */
return rc;
}
rc = tf_tcam_shared_move(tfp,
parms,
TF_TCAM_SHARED_KEY_SLICE_SZ_BYTES_P58,
- TF_TCAM_SHARED_REMAP_SZ_BYTES_P58);
+ TF_TCAM_SHARED_REMAP_SZ_BYTES_P58,
+ true); /* set enable bit */
return rc;
}