AnsweredAssumed Answered

soft parser of FMAN cannot identity multiple custom protocols

Question asked by shan feifei on Dec 20, 2015

The SDK 1.6 says that

"Note: If your application does not use a custom protocol, you do not have to create a Custom Protocol file. Further, if your application uses multiple custom protocols, you can (and must) define them in a single Custom Protocol file; you can pass just one Custom Protocol file to the FMC Tool."

I wrote 2 custom protocols in one Custom Protocol file(the two custom protocols are RTP and RTCP),but problem happened,in one Custom Protocol file,if I wrote the RTP  custom protocol in front of RTCP custom protocol,the FMC Tool only can identity RTP,cannot identity RTCP,vice versa.The FMC Tool only can identity the custom protocol which are written in the front of the Custom Protocol file,I dont know how to solve the problem.

=====================================

Following is the custom protocol:

 

<?xml version="1.0" encoding="utf-8"?>

<netpdl name="RTP" description="Recognize and mark RTP frames">

    <protocol name="rtp" longname="RTP Protocol" prevproto="udp">

        <format>

            <fields>

                <field type="fixed" name="constant" longname="Constant value" size="1"/>

                <field type="bit" name="m" mask="0x80" size="1" />

                <field type="bit" name="pt" mask="0x7F" size="1" />

                <field type="fixed" name="sn" longname="Sequence number" size="2"/>

                <field type="fixed" name="ts" longname="Timestamp" size="4"/>

                <field type="fixed" name="ssrc" longname="Synchronization source identifier" size="4"/>

            </fields>

        </format>

        <execute-code>

            <before>

                <if expr="udp.sport != 0x138E">

                    <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                    </if-true>

                </if>

                <if expr="udp.len lt 0x14">

                    <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                    </if-true>

                </if>

            </before>

            <after>

                        <if expr="constant!= 0x40">

                        <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                        </if-true>

                        </if>           

                <assign-variable name="$shimoffset_1" value="$nxtHdrOffset"/>

                <assign-variable name="$nxtHdrOffset" value="$nxtHdrOffset + $headerSize"/>

                <action type="exit" confirmcustom="shim1" nextproto="end_parse"/>

            </after>

        </execute-code>

    </protocol> 

   

    <protocol name="rtcp" longname="RTCP Protocol" prevproto="udp">

        <format>

            <fields>

                <field type="bit" name="constant1" mask="0xE0" size="1" />

                <field type="bit" name="rc" mask="0x1F" size="1" />

                  <field type="fixed" name="pt" longname="Packet type" size="1"/>

                <field type="fixed" name="length" longname="RTCP length" size="2"/>

                <field type="fixed" name="ssrc" longname="SSRC"  size="4"/>

            </fields>

        </format>

        <execute-code>

            <before>

                <if expr="udp.sport != 0x138F">

                    <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                    </if-true>

                </if>

                <if expr="udp.len lt 0x10">

                    <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                    </if-true>

                </if>                  

            </before>

            <after>

                        <if expr="constant1!= 4">

                        <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                        </if-true>

                        </if>

                        <if expr="pt lt 200 or pt gt 204">

                        <if-true>

                        <action type="exit" confirm="yes" nextproto="return"/>

                        </if-true>

                        </if>

                <assign-variable name="$shimoffset_2" value="$nxtHdrOffset"/>

                <assign-variable name="$nxtHdrOffset" value="$nxtHdrOffset + $headerSize"/>

                <action type="exit" confirmcustom="shim2" nextproto="end_parse"/>

            </after>

        </execute-code>

    </protocol> 

</netpdl>

 

======================================

The following is the policy file :

 

<?xml version="1.0" encoding="utf-8"?>

 

<netpcd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:noNamespaceSchemaLocation="xmlProject/pcd.xsd" name="example"

        description="Bridging configuration">

<!--    xxxxxxxxxxxxxxxxxxxxxxxx Distributions xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->

        <distribution name="rtp_dist0">

        <queue base="0x900" count="1"/>

        <protocols>

        <protocolref name="rtp" />

        </protocols>

        </distribution>

       

        <distribution name="rtp_dist1">

        <queue base="0xf00" count="1"/>

        <protocols>

        <protocolref name="rtp" />

        </protocols>

        </distribution>

       

        <distribution name="rtcp_dist0">

        <queue base="0x910" count="1"/>

        <protocols>

        <protocolref name="rtcp" />

        </protocols>

        </distribution>

       

        <distribution name="rtcp_dist1">

        <queue base="0xf10" count="1"/>

        <protocols>

        <protocolref name="rtcp" />

        </protocols>

        </distribution>

        <distribution name="default_dist0">

                <queue count="1" base="0x55"/>

        </distribution>

       

        <distribution name="default_dist1">

                <queue count="1" base="0x63"/>

        </distribution>

 

 

<!--    xxxxxxxxxxxxxxxxxxxxxxxxxx Policies xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->

        <policy name="hash_ipsec_src_dst_spi_policy0">

                <dist_order>

                        <distributionref name="rtp_dist0"/>

                        <distributionref name="rtcp_dist0"/>

                        <distributionref name="default_dist0"/>

                </dist_order>

        </policy>

        <policy name="hash_ipsec_src_dst_spi_policy1">

                <dist_order>

                        <distributionref name="rtp_dist1"/>

                        <distributionref name="rtcp_dist1"/>

                        <distributionref name="default_dist1"/>

                </dist_order>

        </policy>

</netpcd>

Original Attachment has been moved to: usdpaa_policy_hash_ipv4_arp_coarse_classify.xml.zip

Original Attachment has been moved to: usdpaa_custom_coarse_classify_netpdl.xml.zip

Outcomes