[ovs-dev] [PATCH v2 1/6] userspace: Add support for NSH MD1 match fields

Ben Pfaff blp at ovn.org
Wed Aug 2 22:34:52 UTC 2017


On Thu, Aug 03, 2017 at 04:56:52AM +0800, Yi Yang wrote:
> From: Jan Scheurich <jan.scheurich at ericsson.com>
> 
> This patch adds support for NSH packet header fields to the OVS
> control plane and the userspace datapath. Initially we support the
> fields of the NSH base header as defined in
> https://www.ietf.org/id/draft-ietf-sfc-nsh-13.txt
> and the fixed context headers specified for metadata format MD1.
> The variable length MD2 format is parsed but the TLV context headers
> are not yet available for matching.
> 
> The NSH fields are modelled as OXM fields with the dedicated OXM
> class 0x8004 proposed for NSH in ONF. The following fields are defined:
> 
> OXM code            ofctl name    Size      Comment
> ----------------------------------------------------------------------
> OXM_NSH_FLAGS       nsh_flags       8       Bits 2-9 of 1st NSH word
> (0x8004,1)
> OXM_NSH_MDTYPE      nsh_mdtype      8       Bits 16-23
> (0x8004,2)
> OXM_NSH_NEXTPROTO   nsh_np          8       Bits 24-31
> (0x8004,3)
> OXM_NSH_SPI         nsh_spi         24      Bits 0-23 of 2nd NSH word
> (0x8004,4)
> OXM_NSH_SI          nsh_si          8       Bits 24-31
> (0x8004,5)
> OXM_NSH_C1          nsh_c1          32      Maskable, nsh_mdtype==1
> (0x8004,6)
> OXM_NSH_C2          nsh_c2          32      Maskable, nsh_mdtype==1
> (0x8004,7)
> OXM_NSH_C3          nsh_c3          32      Maskable, nsh_mdtype==1
> (0x8004,8)
> OXM_NSH_C4          nsh_c4          32      Maskable, nsh_mdtype==1
> (0x8004,9)
> 
> Signed-off-by: Mengke Liu <mengke.liu at intel.com>
> Signed-off-by: Ricky Li <ricky.li at intel.com>
> Signed-off-by: Johnson Li <johnson.li at intel.com>
> Signed-off-by: Yi Yang <yi.y.yang at intel.com>
> Signed-off-by: Jan Scheurich <jan.scheurich at ericsson.com>

Hi, I'm willing to try to iterate through this series for 2.8, if we can
do it quickly.

As a first pass, can you address the checkpatch warnings?

    ERROR: Inappropriate bracing around statement
    #726 FILE: lib/match.c:1256:
        if (m->nsh.flags)

    ERROR: Inappropriate bracing around statement
    #728 FILE: lib/match.c:1258:
        if (m->nsh.mdtype)

    ERROR: Inappropriate bracing around statement
    #730 FILE: lib/match.c:1260:
        if (m->nsh.np)

    ERROR: Inappropriate bracing around statement
    #732 FILE: lib/match.c:1262:
        if (m->nsh.spi)

    ERROR: Inappropriate bracing around statement
    #734 FILE: lib/match.c:1264:
        if (m->nsh.si)

    ERROR: Inappropriate bracing around statement
    #737 FILE: lib/match.c:1267:
        if (m->nsh.c1)

    ERROR: Inappropriate bracing around statement
    #739 FILE: lib/match.c:1269:
        if (m->nsh.c2)

    ERROR: Inappropriate bracing around statement
    #741 FILE: lib/match.c:1271:
        if (m->nsh.c3)

    ERROR: Inappropriate bracing around statement
    #743 FILE: lib/match.c:1273:
        if (m->nsh.c4)

    WARNING: Line length is >79-characters long
    #1138 FILE: lib/odp-util.c:257:
        ds_put_format(ds, ",spi=%d", (ntohl(key->path_hdr) & NSH_SPI_MASK) >> NSH_SPI_SHIFT);

    WARNING: Line length is >79-characters long
    #1139 FILE: lib/odp-util.c:258:
        ds_put_format(ds, ",si=%d", (ntohl(key->path_hdr) & NSH_SI_MASK) >> NSH_SI_SHIFT);

    WARNING: Line length is >79-characters long
    #1202 FILE: lib/odp-util.c:321:
            uint32_t spi_mask = (ntohl(mask->path_hdr) & NSH_SPI_MASK) >> NSH_SPI_SHIFT;

    WARNING: Line length is >79-characters long
    #1207 FILE: lib/odp-util.c:326:
            uint8_t si_mask = (ntohl(mask->path_hdr) & NSH_SI_MASK) >> NSH_SI_SHIFT;

    WARNING: Line length is >79-characters long
    #1365 FILE: lib/odp-util.c:6452:
        nsh->path_hdr = htonl(ntohl(flow->nsh.spi) << NSH_SPI_SHIFT | flow->nsh.si);

    WARNING: Line length is >79-characters long
    #1387 FILE: lib/odp-util.c:6474:
    put_nsh_key(const struct ovs_key_nsh *nsh, struct flow *flow, bool is_mask OVS_UNUSED)

    WARNING: Line length is >79-characters long
    #1392 FILE: lib/odp-util.c:6479:
        flow->nsh.spi = htonl((ntohl(nsh->path_hdr) & NSH_SPI_MASK) >> NSH_SPI_SHIFT);

The following maybe don't need to be addressed but those titles do look
a little longer anyway.

    WARNING: Line length is >79-characters long
    #1040 FILE: lib/meta-flow.xml:1303:
            title="spi (service path identifier) field in NSH base header (24 bits)"/>

    WARNING: Line length is >79-characters long
    #1044 FILE: lib/meta-flow.xml:1307:
            title="c1 (Network Platform Context) field in NSH context header (32 bits)"/>

    WARNING: Line length is >79-characters long
    #1046 FILE: lib/meta-flow.xml:1309:
            title="c2 (Network Shared Context) field in NSH context header (32 bits)"/>

    WARNING: Line length is >79-characters long
    #1048 FILE: lib/meta-flow.xml:1311:
            title="c3 (Service Platform Context) field in NSH context header (32 bits)"/>

    WARNING: Line length is >79-characters long
    #1050 FILE: lib/meta-flow.xml:1313:
            title="c4 (Service Shared Context) field in NSH context header (32 bits)"/>


More information about the dev mailing list