Configuring TCAM Carving

This chapter contains the following sections:

Information About TCAM Carving

The Ternary Content-Addressable Memory (TCAM) carving feature uses a template-based approach that enables you to modify the default region sizes of the TCAM. When the switch boots up, you see this default template, unless you have configured any other template. This table lists the types and sizes of various regions in a template.

Information About User-Defined Templates

In addition to the default template, you can create a maximum of 16 templates (which means that you can have 17 templates at one time). You can specify whatever sizes of ternary content addressable memory (TCAM) regions you want.

You can apply the following operations on each template:

  • Create

  • Modify

  • Delete

  • Commit

Each template can be in one of the following states:

  • Saved

  • Committed

Create

When you create a template, the size of the TCAM regions are initialized to the default values. When a template is created, the template is in the saved state by default. Once you create a template, you can modify it to change the size of any TCAM region. You should configure the size of the region in multiples of 64 because the size of each TCAM block is 64 entries. If you enter a value that is not a multiple of 64, an error message asks you to enter the value again.

Modify

You can modify any saved template to change the size of any TCAM region but you cannot modify the size of any region in the TCAM to 0. During the modification, the software checks that the size that you entered is on a 64 boundary. When you modify a template, the combined size of all the TCAM regions might have fewer than 4096 entries. During a modification, the software does not check that you have fewer than 4096 entries.

You can modify a template only when it is in the saved state. After a template is committed, you cannot modify it.

A user-defined committed template can be changed to the created state by servicing another user-defined template or default template.

To service another user-defined template, enter the following command:

hardware profile tcam resource service-template user-defined-template

To service a default template, enter the following command:

no hardware profile tcam resource service-template currently-committed- template

Delete

You can delete any saved template. After you delete a template, all information about the template is lost. A committed template cannot be deleted.

A user-defined committed template can be changed to the created state by servicing another user-defined template or default template.

To service another user-defined template, enter the following command:

hardware profile tcam resource service-template user-defined-template

To service a default template, enter the following command:

no hardware profile tcam resource service-template currently-committed- template

Commit

You can commit any of your user-defined templates or the default template that is provided by the software. To commit a template, enter the commit command and perform a reboot of the switch. When you enter the commit command, the software validates the template. If the validation is successful, the software prompts you to reboot the switch. The template (user defined or default) is applied after the reboot. If you did not choose to reboot, no changes are made to the TCAM regions and no template is committed.

From Cisco NX-OS Release 7.1(4)N1(1) onwards, after you commit a template, the system prompts you whether to proceed with copying the running configuration to the startup configuration and rebooting the switch. After you agree to continue, the following occurs:

  • The committed template is saved in the startup configuration.

  • The switch is rebooted.

  • The committed template is used by the software.

  • The template goes to the running state.


Note

Prior to Cisco NX-OS Release 7.1(4)N1(1), after you commit a template, the system does not automatically reboot but a message is displayed in the commit command output asking you to reboot the switch for the committed template to take effect.


If you perform a write erase, reload, and copy running configuration from a back-up configuration containing uncommitted TCAM profile, the following occurs:

  1. After the TCAM profile is committed, switch automatically reloads without any prompt.

  2. Any configuration after TCAM carving CLI is not applied.

  3. To restore configuration with the committed TCAM profile, you need to copy backup configuration to running configuration again. However, there is no switch reload as the TCAM carving profile is already committed.

When the switch is reloaded due to the new committed TCAM profile, the show system reset-reason command displays the reason for the reload as shown below:

switch# show system reset-reason
----- reset reason for Supervisor-module 1 (from Supervisor in slot 1) ---
1) At 302777 usecs after Sun Jan 20 22:02:37 2016
    Reason: Reload due to change in TCAM service-template  
    Service:
    Version: 7.1(4)N1(1)

2) At 314447 usecs after Sun Jan 20 21:52:58 2016
    Reason: Reset Requested by CLI command reload
    Service:
    Version: 7.1(4)N1(1)

3) At 20142 usecs after Sun Jan 20 21:27:33 2016
    Reason: Reset Requested by CLI command reload
    Service:
    Version: 7.1(4)N1(1)    

After the switch reboots, the committed template is applied to all ASICs on the Cisco Nexus device. You cannot commit different templates to different ASICs on the Cisco Nexus device. All saved templates and committed templates along with the size of each region of each template are displayed in the running configuration.

When a template is committed, the software checks the following:

  1. The combined size of all regions in the TCAM is 4096 entries.

  2. The size of each region fits within the TCAM. At any point of time, there is always a running size for the TCAM region. This running size (the current size in the hardware TCAM) is defined by either the default or a user-defined template that was committed and is currently being used as the running template. If you increase the size of a region in a template that is currently being committed, from the current running size, the software checks if there are enough free entries outside the current region (entries that are not allocated to any other region) that can be used to increase the size of the region. If you decrease the size of a region in a template that is currently being committed from the current running size, the software checks to determine if there are enough free entries within the region that can be freed up to reduce the size of the TCAM region. All changes that reduce the sizes of the regions within the template are done before the changes to increase the sizes of regions within the template.

  3. The hardware does not support more than 256 entries in the supervisor region and span regions. This check is done during validation.

If all these checks pass, you can commit he template and you are prompted to apply the template by rebooting.

If these checks fail, the commit fails and the template goes back to the saved state. If the commit fails, the commit command output displays the reasons that it failed.

You cannot modify or delete the default template. You can only move this template from saved to committed or committed to saved. If the default template is committed, it is not displayed in the running configuration. To apply the default template, enter the no commit command using the currently running template. Entering this command executes the same validation checks that were performed when you committed the template. If all validations succeed, the software prompts you to reboot the switch. If you agree to reboot, the template is saved in the startup configuration and the system is rebooted. After the reboot, the default template is applied. The startup configuration has the committed template that you committed before rebooting. After rebooting, the template in the startup configuration is used. If there is no committed template in the startup configuration, the default template is used.

You create and manage the TCAM carving templates by entering the template manager commands. The template-based TCAM carving CLI is supported in config-sync. Only template creation is supported inside config-sync. Template commit should be performed separately on each switch outside the config-sync context.

Creating a User-Defined Template

Procedure

  Command or Action Purpose
Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# hardware profile tcam resource template template-name

Creates a new template with the default region sizes. A maximum of 16 templates (plus the default) can be created. The template-name argument can be a maximum of 64 characters.

Example

This example shows how to create a user-defined template named qos-template:

switch# configure terminal
switch(config)# hardware profile tcam resource template qos-template

Modifying a User Defined Template

Procedure

  Command or Action Purpose
Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# hardware profile tcam resource template template-name

Creates a new template with the default region sizes. A maximum of 16 templates (plus the default) can be created. Use this command to enter template mode.

Example

This example shows how to modify a user-defined qos template.

switch# configure terminal
switch(config)# hardware profile tcam resource template qos-template
switch(config-tmpl) qos 64

Committing a User-Defined Template

You can commit a user-defined template.

Procedure

  Command or Action Purpose
Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# hardware profile tcam resource service-template template-name

Commits a previously defined template in the running image. After you commit a template, the system prompts you whether to proceed with copying the running configuration to the startup configuration and rebooting the switch. If you agree to continue, the specified template is applied after the reboot. Otherwise, no changes are made to the TCAM regions and no template is committed.

Step 3

(Optional) switch# show hardware profile tcam resource template

(Optional)

Displays all templates.

Note 

After the switch reloads, use this command to display the committed template.

Example

This example shows how to commit a user-defined template:

switch# configure terminal
switch(config)# hardware profile tcam resource service-template temp1

Details of the temp1 template you are trying to commit are as follows:

-------------------------------------------------------------------------------
Template name: temp1
Current state: Created

Region  Features  Size-allocated    Current-size  Current-usage  Available/free
-------------------------------------------------------------------------------
Vacl    Vacl                1024            1024             15            1009
Ifacl   Ifacl               1152            1152            209             943
Rbacl   Rbacl               1152            1152              3            1149
Qos     Qos                  448             448             30             418
Span    Span                  64              64              2              62
Sup     Sup                  256             256             58             198
-------------------------------------------------------------------------------


To finish committing the template, the system will do the following:
    1> Save running config :  "copy running-config startup-config"
    2> Reboot the switch   :  "reload"


-------------------------------------------------------------------------------
Do you really want to continue with RELOAD ? (y/n) [no] yes
System is still initializing
Configuration mode is blocked until system is ready
switch(config)# [16152.925385] Shutdown Ports..
[16152.959744]  writing reset reason 9
[snip]


/AFTER SWITCH RELOADS/

switch# show hardware profile tcam resource template
    Template   Type     State   Vacl  Ifacl   Rbacl  Qos  Span   Sup      TOTAL
------------------------------------------------------------------------------
     default system   Created   1024   1152  1152    448    64   256      4096
       temp1   user Committed   1024   1152  1152    448    64   256      4096
       temp2   user   Created   1024   1152  1152    448    64   256      4096
------------------------------------------------------------------------------

Deleting a Template

After creating a template, the template can be deleted. Deleting removes all the information about the template from the software.

Procedure

  Command or Action Purpose
Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# no hardware profile tcam resource template template-name

Deletes a user-defined template.

Only saved templates can be deleted. Templates that are committed/running cannot be deleted. A template that is in the running configuration (same as the startup configuration) cannot be deleted. Any other user-defined template that is in a saved state can be deleted. The default template cannot be deleted.

Example

This example shows how to delete a template:

switch# configure terminal
switch(config)# no hardware profile tcam resource template qos-template

Verifying the TCAM Carving Configuration

To display TCAM carving configuration information, enter one of the following commands:

Command Purpose

show hardware profile tcam resource template

Displays all templates.

show hardware profile tcam resource template name template-name

Displays a user-defined template.

show hardware profile tcam resource template default

Displays a default template.