• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » DaVinci™ Video Processors » DM814x and AM387x Processors Forum » TMS320DM814x CPSW TX_PRI[N]_RATE register field information
Share
DaVinci™ Video Processors
  • Forums
  • Announcements
Options
  • Subscribe via RSS

TMS320DM814x CPSW TX_PRI[N]_RATE register field information

TMS320DM814x CPSW TX_PRI[N]_RATE register field information

This question is not answered
Delio Brignoli
Posted by Delio Brignoli
on Aug 10 2012 10:06 AM
Intellectual400 points

Hello,

I am trying to use the rate limiting mode of CPSW as described in section 9.2.1.1.4 of the TRM but I have had little success in understanding the exact meaning of the PRI(0..7)_IDLE_CNT and PRI(0..7)_SEND_CNT fields in the CPDMA's TX_PRI[N]_RATE register (section 9.4.1.51 of the TRM). There is no documentation I can find (and I did look thoroughly) other than the one referenced above.

  1. What are exactly *_SEND_CNT and *_IDLE_CNT counting? (assuming CNT stands for count)
  2. TRM says: Priority Transfer rate in Mbit/s = ((PRI_IDLE_CNT/(PRI_IDLE_CNT + PRI_SEND_CNT)) × frequency × 32, where the frequency is the CLK frequency. Which clock is CLK? Is the formula valid for any link speed?

Having a description of how the CPSW uses the values of the *_SEND_CNT and *_IDLE_CNT fields would probably allow me to figure out all of the above. Can anyone point me to some existing documentation of provide a description of the CPDMA rate limiting function in CPSW? Thank you.

Kind Regards
--
Delio Brignoli
AudioScience Inc

cpsw CPDMA rate limiting
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Delio Brignoli
    Posted by Delio Brignoli
    on Aug 13 2012 11:29 AM
    Intellectual400 points

    In addition to the above, I am seeing something strange when enabling rate limiting mode and setting TX_PRI[N]_RATE. For instance, setting the register to 0x00011000 (or 0x00010100, but these are not the only values for which it happens) I see frames being sent on the wire but the OWNER bit in the TX buffer descriptor is never cleared by the EMAC, the EMAC does not signal any error condition; the software will eventually run out of buffer descriptors because it does not have a way of knowing they have been processed by the EMAC.

    Has anyone seen this?

    Thanks
    --
    Delio Brignoli
    AudioScience Inc

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Keegan@TI
    Posted by Keegan@TI
    on Aug 20 2012 10:18 AM
    Intellectual1365 points

    Hi Delio,

    I'm currently escalating your question. I believe the 'clock' you mention for the equation is the G/MII ref clock (for 1000 Mbps is 125 MHz), but I will verify that. Could you give a little more information on what you're writing to the TX_PRI[N]_RATE register? Are you describing the value you set to the register in hex or binary? Keep in mind the TX_PRI[N]_RATE registers are 32 bits in length and have 4 reserved bits per the TRM (Section 9.4.1.51).

    Best,

    Keegan

     

     

    If a post provides a solution to your question, please 'verify answer'!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pavel Botev
    Posted by Pavel Botev
    on Aug 22 2012 06:18 AM
    Genius16030 points

    Hi Delio,

    There is info about the CPSW rate limiting mode here :

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_Ethernet_Switch_User_Guide#CONFIG_SWITCH_RATELIMIT

    The transmit rate limit source code is in the Ethernet Switch Driver :

    ti-ezsdk_dm814x-evm_5_04_00_11/board-support/linux-2.6.37-psp04.04.00.01/drivers/net/cpsw.c

    Here is an extract of some code:

    static int cpsw_switch_config_ioctl(struct net_device *ndev,
            struct ifreq *ifrq, int cmd)
    {

    ..........

    case CONFIG_SWITCH_RATELIMIT:
            if ((portcmd(switch_config).port <= 2) &&
                    (portcmd(switch_config).enable == 0))
                ret = cpsw_ale_control_set(priv->ale,
                    portcmd(switch_config).port,
                    ALE_RATE_LIMIT, 0);
            else if ((portcmd(switch_config).port <= 2) &&
                    ((portcmd(switch_config).addr_type
                        == ADDR_TYPE_BROADCAST) ||
                    (portcmd(switch_config).addr_type
                        == ADDR_TYPE_MULTICAST)) &&
                    (portcmd(switch_config).limit <= 255)) {
                ret = cpsw_rate_limit(priv->ale,
                    portcmd(switch_config).enable,
                    portcmd(switch_config).direction,
                    portcmd(switch_config).port,
                    portcmd(switch_config).addr_type,
                    portcmd(switch_config).limit);
            } else {
                printk(KERN_ERR "Invalid Arguments\n");
                ret = -EFAULT;
            }
            break;

    ..........

    }

    /**
     *    cpsw_rate_limit_tx
     *    Limits the number of Tx packets on a port for a 100ms time period.
     *    Rate limit can be done either on Tx or Rx for all the ports due to
     *    hardware limitation
     */
    static int cpsw_rate_limit_tx(struct cpsw_ale *ale, u32 enable, u32 port,
                    u32 addr_type, u32 limit)
    {
        if (!enable) {
            cpsw_ale_control_set(ale, port, ALE_RATE_LIMIT, 0);
            return 0;
        }

        /* ALE prescale is set for 100 ms time */
        if (addr_type == ADDR_TYPE_BROADCAST)
            cpsw_ale_control_set(ale, port, ALE_PORT_BCAST_LIMIT, limit);
        else if (addr_type == ADDR_TYPE_MULTICAST)
            cpsw_ale_control_set(ale, port, ALE_PORT_MCAST_LIMIT, limit);
        else
            return -EFAULT;

        /* Enable the bit for rate limiting transmission */
        cpsw_ale_control_set(ale, port, ALE_RATE_LIMIT_TX, 1);
        cpsw_ale_control_set(ale, port, ALE_RATE_LIMIT, 1);

        return 0;
    }

    int cpsw_rate_limit(struct cpsw_ale *ale, u32 enable, u32 direction, u32 port,
                u32 packet_type, u32 limit)
    {

        if (port == 0) {
            /* For host port transmit/receive terminlogy is inverse
                of cpgmac port */
            if (direction)
                cpsw_rate_limit_rx(ale, enable, port,
                        packet_type, limit);
            else
                cpsw_rate_limit_tx(ale, enable, port,
                        packet_type, limit);
        } else {
            if (direction)
                cpsw_rate_limit_tx(ale, enable, port,
                        packet_type, limit);
            else
                cpsw_rate_limit_rx(ale, enable, port,
                        packet_type, limit);
        }
        return 0;
    }

    The TX_PRI[N]_RATE registers looks to me that are not implemented in the CPSW driver. 

    I am still searching answers about the TX_PRI[N]_RATE and CLK description/details.

    Best Regards,

    Pavel

    Please Note:  If this answer solves your question please mark post as "Answered" - Thanks Pavel!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pavel Botev
    Posted by Pavel Botev
    on Aug 23 2012 01:52 AM
    Genius16030 points

    Hi Delio,

    I received a feedback that rate limiting is supported on DM814X devices. The CPDMA rate limiting registers are in the CPDMA register address space.

    The equation below defines the megabits per second transferred on each rate limited transmit DMA channel. The frequency is the OCP (interconnect) clock frequency which is an input to the module.  IDLE counts idle clocks for the priority.  SEND counts send clocks for the priority. However, those statements don't really matter.  The transfer rate holds by the formula. I will add that in general it's better to have lower IDLE register values than higher IDLE register values.  If you want 100 Mbps on a transmit channel total then IDLE_CNT = 1 and SEND_CNT = 111 (at 350Mhz).

    Mbit/s = ((PRI_IDLE_CNT/(PRI_IDLE_CNT + PRI_SEND_CNT)) × frequency × 32

    BR,

    Pavel

    Please Note:  If this answer solves your question please mark post as "Answered" - Thanks Pavel!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Delio Brignoli
    Posted by Delio Brignoli
    on Aug 31 2012 09:30 AM
    Intellectual400 points

    Hi Pavel and Keegan,

    Sorry for not replying earlier but I was out of the office. I will reply to all your messages below.

    Keegan: I am describing the values in hex as indicated by the 0x prefix in the values, I am aware of the reserved bits and not touching them.

    Pavel: Your first reply referencing code from cpsw.c delas with a different level of rate limiting that happens elsewhere in CPSW. Your second reply seems to refer to the CPDMA rate limiting I was looking for. However, you say:


    IDLE counts idle clocks for the priority.  SEND counts send clocks for the priority. However, those statements don't really matter.  The transfer rate holds by the formula. I will add that in general it's better to have lower IDLE register values than higher IDLE register values.  If you want 100 Mbps on a transmit channel total then IDLE_CNT = 1 and SEND_CNT = 111 (at 350Mhz).

    Mbit/s = ((PRI_IDLE_CNT/(PRI_IDLE_CNT + PRI_SEND_CNT)) × frequency × 32


    I think knowing what IDLE and SEND count is important and may affect cases in which rate limiting is enabled on more than one channel at a time. I imagine the amount of data transmitted for each SEND clock is 32 bits, can you confirm? Must there be a certain relationship between IDLE count of (say) the channel with top priority and the SEND counts of channels with lower priority?

    To find out the OCP clock frequency I need to figure out where it is derived from, I looked in the TRM and grep'ed linux's sysfs clock tree but didn't find any mention of the OCP clock. Linux's sysfs clock tree shows:

    /sys/kernel/debug/clock/osc0_clkin_ck/l3_dpll_clkin_ck/l3_dpll_ck/sysclk4_ck/sysclk5_ck/cpsw_ick/rate ==> 200000000

    Is this the clock you mentioned?


    Thanks
    --
    Delio Brignoli
    AudioScience Inc

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pavel Botev
    Posted by Pavel Botev
    on Sep 04 2012 07:06 AM
    Genius16030 points

    Delio,

    The above is correct.  Each send count has 32-bits of data because the CPDMA has a 32-bit bus.

    Yes, OCP clock is cpsw_ick (200MHz).

    BR,

    Pavel

    Please Note:  If this answer solves your question please mark post as "Answered" - Thanks Pavel!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Delio Brignoli
    Posted by Delio Brignoli
    on Sep 05 2012 13:13 PM
    Intellectual400 points

    Thank you Pavel. I was also asking:

    Must there be a certain relationship between (say) IDLE count of the channel with top priority and the SEND counts of channels with lower priority?
    In other words, are IDLE and SEND values of a channel dependent on the values of other channels or not?

    I realize you said to just use the equation to figure the rate but, as I stated in a previous post, after a while CPDMA gets into a state where one or more channels stall (no data transmitted, no error indication), so I think there maybe more to it; without some documentation on CPDMA (a block diagram for instance) it's difficult to work out a mental model of how this works and ask the right questions, let alone understand/fix the issue. Thank you for all your help so far.

    Kind Regards
    --
    Delio Brignoli
    AudioScience Inc

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pavel Botev
    Posted by Pavel Botev
    on Sep 11 2012 08:53 AM
    Genius16030 points

    Hello,

    Rate-limiting (or shaping) has some basic assumptions.  The first is that the port receiving the traffic is not over-subscribed.  That is, everything sending to a particular port is rate limited. There is no policing on ingress from an Ethernet port.  It must be shaped from the sending port on any rate-limited priority.  For the CPDMA, each rate limited channel is independent from the others, but the rates must be such that all the rules are obeyed and the bus bandwidth can be
    supplied.

    Best Regards,

    Pavel

    Please Note:  If this answer solves your question please mark post as "Answered" - Thanks Pavel!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Andrew Elder
    Posted by Andrew Elder
    on Feb 27 2013 10:49 AM
    Intellectual710 points

    Pavel,

    I switched threads!

    Seems to me the above equation is incorrect (or the text is). If PRI_SEND_CNT is the send (pkt) clock counts, the equation should read

    Mbits/s = PRI_SEND_CNT/(PRI_SEND_CNT + PRI_IDLE_CNT) x OCPfreq x 32

    What am I missing?

    - Andrew

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Andrew Elder
    Posted by Andrew Elder
    on Mar 01 2013 09:09 AM
    Intellectual710 points

    Further to what I wrote above, suppose we want put an AVTP packet of 94 bytes (752 bits) on the wire every 125usec (8 kHz rate), how does one derive the SEND and IDLE counts?

    Is the observation interval in sec = (PRI_SEND_CNT + PRI_IDLE_CNT)/OCP freq      ?

    OCP freq = 200 000 000, internal = 0.000125, then

    PRI_SEND+CTL + PRI_IDLE_CNT = 25000

    Is the above thinking correct, or totally off base? Is there a state machine drawing or anything that would clarify the meaning of PRI_SEND_CTL and PRI_IDLE_CNT?

    Thanks,

    Andrew

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use