On Tue, Jan 09, 2018 at 09:56:16PM +0800, Yi Yang wrote:
> IETF NSH draft added a new filed ttl in NSH header, this patch
> is to add new nsh key 'ttl' for it.
> 
> Signed-off-by: Yi Yang <[email protected]>

Thanks for the revision!

This breaks a test:

939: ofproto - table features (OpenFlow 1.3)         FAILED (ofproto.at:2607)

This change is user-visible so it should have a NEWS item.

I'm appending some suggested minor improvements.

Thanks again,

Ben.

--8<--------------------------cut here-------------------------->8--

diff --git a/include/openvswitch/nsh.h b/include/openvswitch/nsh.h
index 8ce63fc2a7fa..325d4bcb5910 100644
--- a/include/openvswitch/nsh.h
+++ b/include/openvswitch/nsh.h
@@ -317,7 +317,7 @@ nsh_16aligned_be32(const ovs_16aligned_be32 *x)
 }
 #else  /* __CHECKER__ */
 /* Making sparse happy with these functions also makes them unreadable, so
- *  * don't bother to show it their implementations. */
+ * don't bother to show it their implementations. */
 ovs_be32 nsh_16aligned_be32(const ovs_16aligned_be32 *x);
 #endif
 
@@ -330,21 +330,21 @@ nsh_get_path_hdr(const struct nsh_hdr *nsh)
 static inline ovs_be32
 nsh_get_spi(const struct nsh_hdr *nsh)
 {
-    uint32_t path_hdr = ntohl(nsh_16aligned_be32(&nsh->path_hdr));
-    return (ovs_be32) htonl((path_hdr & NSH_SPI_MASK) >> NSH_SPI_SHIFT);
+    uint32_t path_hdr = ntohl(nsh_get_path_hdr(nsh));
+    return htonl((path_hdr & NSH_SPI_MASK) >> NSH_SPI_SHIFT);
 }
 
 static inline uint8_t
 nsh_get_si(const struct nsh_hdr *nsh)
 {
-    uint32_t path_hdr = ntohl(nsh_16aligned_be32(&nsh->path_hdr));
+    uint32_t path_hdr = ntohl(nsh_get_path_hdr(nsh));
     return (path_hdr & NSH_SI_MASK) >> NSH_SI_SHIFT;
 }
 
 static inline ovs_be32
 nsh_path_hdr_to_spi(ovs_be32 path_hdr)
 {
-    return (ovs_be32) htonl((ntohl(path_hdr) & NSH_SPI_MASK) >> NSH_SPI_SHIFT);
+    return htonl((ntohl(path_hdr) & NSH_SPI_MASK) >> NSH_SPI_SHIFT);
 }
 
 static inline uint32_t
@@ -371,7 +371,7 @@ nsh_set_flags_and_ttl(struct nsh_hdr *nsh, uint8_t flags, 
uint8_t ttl)
     nsh->ver_flags_ttl_len
         = htons((ntohs(nsh->ver_flags_ttl_len)
                  & ~(NSH_FLAGS_MASK | NSH_TTL_MASK))
-                | ((flags << NSH_FLAGS_SHIFT)& NSH_FLAGS_MASK)
+                | ((flags << NSH_FLAGS_SHIFT) & NSH_FLAGS_MASK)
                 | ((ttl << NSH_TTL_SHIFT) & NSH_TTL_MASK));
 }
 
@@ -382,7 +382,7 @@ nsh_set_flags_ttl_len(struct nsh_hdr *nsh, uint8_t flags, 
uint8_t ttl,
     nsh->ver_flags_ttl_len
         = htons((ntohs(nsh->ver_flags_ttl_len)
                  & ~(NSH_FLAGS_MASK | NSH_TTL_MASK | NSH_LEN_MASK))
-                | ((flags << NSH_FLAGS_SHIFT)& NSH_FLAGS_MASK)
+                | ((flags << NSH_FLAGS_SHIFT) & NSH_FLAGS_MASK)
                 | ((ttl << NSH_TTL_SHIFT) & NSH_TTL_MASK)
                 | (((len >> 2) << NSH_LEN_SHIFT) & NSH_LEN_MASK));
 }
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to