Hi Justin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/Justin-Iurman/Data-plane-support-for-IOAM-Pre-allocated-Trace-with-IPv6/20200625-033536
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
0558c396040734bc1d361919566a581fd41aa539
config: i386-randconfig-s002-20200624 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>


sparse warnings: (new ones prefixed by >>)

>> net/ipv6/ioam6.c:149:36: sparse: sparse: cast to restricted __be32
>> net/ipv6/ioam6.c:149:36: sparse: sparse: cast from restricted __be64
>> net/ipv6/ioam6.c:81:6: sparse: sparse: symbol 'ioam6_fill_trace_data_node' 
>> was not declared. Should it be static?

Please review and possibly fold the followup patch.

vim +149 net/ipv6/ioam6.c

    80  
  > 81  void ioam6_fill_trace_data_node(struct sk_buff *skb, int nodeoff,
    82                                  u32 trace_type, struct ioam6_namespace 
*ns)
    83  {
    84          u8 *data = skb_network_header(skb) + nodeoff;
    85          struct __kernel_sock_timeval ts;
    86          u64 raw_u64;
    87          u32 raw_u32;
    88          u16 raw_u16;
    89          u8 byte;
    90  
    91          /* hop_lim and node_id */
    92          if (trace_type & IOAM6_TRACE_TYPE0) {
    93                  byte = ipv6_hdr(skb)->hop_limit - 1;
    94                  raw_u32 = dev_net(skb->dev)->ipv6.sysctl.ioam6_id;
    95                  if (!raw_u32)
    96                          raw_u32 = IOAM6_EMPTY_FIELD_u24;
    97                  else
    98                          raw_u32 &= IOAM6_EMPTY_FIELD_u24;
    99                  *(__be32 *)data = cpu_to_be32((byte << 24) | raw_u32);
   100                  data += sizeof(__be32);
   101          }
   102  
   103          /* ingress_if_id and egress_if_id */
   104          if (trace_type & IOAM6_TRACE_TYPE1) {
   105                  raw_u16 = __in6_dev_get(skb->dev)->cnf.ioam6_id;
   106                  if (!raw_u16)
   107                          raw_u16 = IOAM6_EMPTY_FIELD_u16;
   108                  *(__be16 *)data = cpu_to_be16(raw_u16);
   109                  data += sizeof(__be16);
   110  
   111                  raw_u16 = 
__in6_dev_get(skb_dst(skb)->dev)->cnf.ioam6_id;
   112                  if (!raw_u16)
   113                          raw_u16 = IOAM6_EMPTY_FIELD_u16;
   114                  *(__be16 *)data = cpu_to_be16(raw_u16);
   115                  data += sizeof(__be16);
   116          }
   117  
   118          /* timestamp seconds */
   119          if (trace_type & IOAM6_TRACE_TYPE2) {
   120                  if (!skb->tstamp) {
   121                          *(__be32 *)data = 
cpu_to_be32(IOAM6_EMPTY_FIELD_u32);
   122                  } else {
   123                          skb_get_new_timestamp(skb, &ts);
   124                          *(__be32 *)data = cpu_to_be32((u32)ts.tv_sec);
   125                  }
   126                  data += sizeof(__be32);
   127          }
   128  
   129          /* timestamp subseconds */
   130          if (trace_type & IOAM6_TRACE_TYPE3) {
   131                  if (!skb->tstamp) {
   132                          *(__be32 *)data = 
cpu_to_be32(IOAM6_EMPTY_FIELD_u32);
   133                  } else {
   134                          if (!(trace_type & IOAM6_TRACE_TYPE2))
   135                                  skb_get_new_timestamp(skb, &ts);
   136                          *(__be32 *)data = cpu_to_be32((u32)ts.tv_usec);
   137                  }
   138                  data += sizeof(__be32);
   139          }
   140  
   141          /* transit delay */
   142          if (trace_type & IOAM6_TRACE_TYPE4) {
   143                  *(__be32 *)data = cpu_to_be32(IOAM6_EMPTY_FIELD_u32);
   144                  data += sizeof(__be32);
   145          }
   146  
   147          /* namespace data */
   148          if (trace_type & IOAM6_TRACE_TYPE5) {
 > 149                  *(__be32 *)data = (__be32)ns->data;
   150                  data += sizeof(__be32);
   151          }
   152  
   153          /* queue depth */
   154          if (trace_type & IOAM6_TRACE_TYPE6) {
   155                  *(__be32 *)data = cpu_to_be32(IOAM6_EMPTY_FIELD_u32);
   156                  data += sizeof(__be32);
   157          }
   158  
   159          /* hop_lim and node_id (wide) */
   160          if (trace_type & IOAM6_TRACE_TYPE7) {
   161                  byte = ipv6_hdr(skb)->hop_limit - 1;
   162                  raw_u64 = dev_net(skb->dev)->ipv6.sysctl.ioam6_id;
   163                  if (!raw_u64)
   164                          raw_u64 = IOAM6_EMPTY_FIELD_u56;
   165                  else
   166                          raw_u64 &= IOAM6_EMPTY_FIELD_u56;
   167                  *(__be64 *)data = cpu_to_be64(((u64)byte << 56) | 
raw_u64);
   168                  data += sizeof(__be64);
   169          }
   170  
   171          /* ingress_if_id and egress_if_id (wide) */
   172          if (trace_type & IOAM6_TRACE_TYPE8) {
   173                  raw_u32 = __in6_dev_get(skb->dev)->cnf.ioam6_id;
   174                  if (!raw_u32)
   175                          raw_u32 = IOAM6_EMPTY_FIELD_u32;
   176                  *(__be32 *)data = cpu_to_be32(raw_u32);
   177                  data += sizeof(__be32);
   178  
   179                  raw_u32 = 
__in6_dev_get(skb_dst(skb)->dev)->cnf.ioam6_id;
   180                  if (!raw_u32)
   181                          raw_u32 = IOAM6_EMPTY_FIELD_u32;
   182                  *(__be32 *)data = cpu_to_be32(raw_u32);
   183                  data += sizeof(__be32);
   184          }
   185  
   186          /* namespace data (wide) */
   187          if (trace_type & IOAM6_TRACE_TYPE9) {
   188                  *(__be64 *)data = ns->data;
   189                  data += sizeof(__be64);
   190          }
   191  
   192          /* buffer occupancy */
   193          if (trace_type & IOAM6_TRACE_TYPE10) {
   194                  *(__be32 *)data = cpu_to_be32(IOAM6_EMPTY_FIELD_u32);
   195                  data += sizeof(__be32);
   196          }
   197  
   198          /* checksum complement */
   199          if (trace_type & IOAM6_TRACE_TYPE11) {
   200                  *(__be32 *)data = cpu_to_be32(IOAM6_EMPTY_FIELD_u32);
   201                  data += sizeof(__be32);
   202          }
   203  
   204          /* opaque state snapshot */
   205          if (trace_type & IOAM6_TRACE_TYPE22) {
   206                  if (!ns->schema) {
   207                          *(__be32 *)data = 
cpu_to_be32(IOAM6_EMPTY_FIELD_u24);
   208                  } else {
   209                          *(__be32 *)data = ns->schema->hdr;
   210                          data += sizeof(__be32);
   211                          memcpy(data, ns->schema->data, ns->schema->len);
   212                  }
   213          }
   214  }
   215  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to