tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
master
head:   fdd6d771c7de9d351c6dbdbab5bdc83805c06955
commit: 1280c0f8aafc4c09c59c576c8d50f367070b2619 [1917/1931] sfc: support 
second + quarter ns time format for receive datapath
reproduce:
        # apt-get install sparse
        git checkout 1280c0f8aafc4c09c59c576c8d50f367070b2619
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/net/ethernet/sfc/ptp.c:646:43: sparse: constant 4000000000 is so big 
>> it is long
   drivers/net/ethernet/sfc/ptp.c:369:6: sparse: symbol 'efx_ptp_want_txqs' was 
not declared. Should it be
   drivers/net/ethernet/sfc/ptp.c:2132:31: sparse: symbol 
'efx_ptp_channel_type' was not declared. Should it be

vim +646 drivers/net/ethernet/sfc/ptp.c

   598  
   599  /* Get PTP attributes and set up time conversions */
   600  static int efx_ptp_get_attributes(struct efx_nic *efx)
   601  {
   602          MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_GET_ATTRIBUTES_LEN);
   603          MCDI_DECLARE_BUF(outbuf, MC_CMD_PTP_OUT_GET_ATTRIBUTES_LEN);
   604          struct efx_ptp_data *ptp = efx->ptp_data;
   605          int rc;
   606          u32 fmt;
   607          size_t out_len;
   608  
   609          /* Get the PTP attributes. If the NIC doesn't support the 
operation we
   610           * use the default format for compatibility with older NICs i.e.
   611           * seconds and nanoseconds.
   612           */
   613          MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_GET_ATTRIBUTES);
   614          MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0);
   615          rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf),
   616                                  outbuf, sizeof(outbuf), &out_len);
   617          if (rc == 0) {
   618                  fmt = MCDI_DWORD(outbuf, 
PTP_OUT_GET_ATTRIBUTES_TIME_FORMAT);
   619          } else if (rc == -EINVAL) {
   620                  fmt = MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS;
   621          } else if (rc == -EPERM) {
   622                  netif_info(efx, probe, efx->net_dev, "no PTP 
support\n");
   623                  return rc;
   624          } else {
   625                  efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf),
   626                                         outbuf, sizeof(outbuf), rc);
   627                  return rc;
   628          }
   629  
   630          switch (fmt) {
   631          case MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_27FRACTION:
   632                  ptp->ns_to_nic_time = efx_ptp_ns_to_s27;
   633                  ptp->nic_to_kernel_time = 
efx_ptp_s27_to_ktime_correction;
   634                  ptp->nic_time.minor_max = 1 << 27;
   635                  ptp->nic_time.sync_event_minor_shift = 19;
   636                  break;
   637          case MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS:
   638                  ptp->ns_to_nic_time = efx_ptp_ns_to_s_ns;
   639                  ptp->nic_to_kernel_time = 
efx_ptp_s_ns_to_ktime_correction;
   640                  ptp->nic_time.minor_max = 1000000000;
   641                  ptp->nic_time.sync_event_minor_shift = 22;
   642                  break;
   643          case MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_QTR_NANOSECONDS:
   644                  ptp->ns_to_nic_time = efx_ptp_ns_to_s_qns;
   645                  ptp->nic_to_kernel_time = 
efx_ptp_s_qns_to_ktime_correction;
 > 646                  ptp->nic_time.minor_max = 4000000000;
   647                  ptp->nic_time.sync_event_minor_shift = 24;
   648                  break;
   649          default:
   650                  return -ERANGE;
   651          }
   652  
   653          /* Precalculate acceptable difference between the minor time in 
the
   654           * packet prefix and the last MCDI time sync event. We expect 
the
   655           * packet prefix timestamp to be after of sync event by up to 
one
   656           * sync event interval (0.25s) but we allow it to exceed this 
by a
   657           * fuzz factor of (0.1s)
   658           */
   659          ptp->nic_time.sync_event_diff_min = ptp->nic_time.minor_max
   660                  - (ptp->nic_time.minor_max / 10);
   661          ptp->nic_time.sync_event_diff_max = (ptp->nic_time.minor_max / 
4)
   662                  + (ptp->nic_time.minor_max / 10);
   663  
   664          /* MC_CMD_PTP_OP_GET_ATTRIBUTES has been extended twice from an 
older
   665           * operation MC_CMD_PTP_OP_GET_TIME_FORMAT. The function now 
may return
   666           * a value to use for the minimum acceptable corrected 
synchronization
   667           * window and may return further capabilities.
   668           * If we have the extra information store it. For older 
firmware that
   669           * does not implement the extended command use the default 
value.
   670           */
   671          if (rc == 0 &&
   672              out_len >= MC_CMD_PTP_OUT_GET_ATTRIBUTES_CAPABILITIES_OFST)
   673                  ptp->min_synchronisation_ns =
   674                          MCDI_DWORD(outbuf,
   675                                     
PTP_OUT_GET_ATTRIBUTES_SYNC_WINDOW_MIN);
   676          else
   677                  ptp->min_synchronisation_ns = 
DEFAULT_MIN_SYNCHRONISATION_NS;
   678  
   679          return 0;
   680  }
   681  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Reply via email to