Message ID | 20220818222742.1070935-11-jacob.e.keller@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ptp: convert drivers to .adjfine | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | fail | Errors and warnings before: 85 this patch: 10 |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/build_clang | fail | Errors and warnings before: 0 this patch: 10 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | fail | Errors and warnings before: 85 this patch: 10 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 51 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
Hi Jacob, I love your patch! Yet something to improve: [auto build test ERROR on 9017462f006c4b686cb1e1e1a3a52ea8363076e6] url: https://github.com/intel-lab-lkp/linux/commits/Jacob-Keller/ptp-convert-drivers-to-adjfine/20220819-063154 base: 9017462f006c4b686cb1e1e1a3a52ea8363076e6 config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20220819/202208191003.18DiEs1l-lkp@intel.com/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/d3c6eac5778f2ce74e7d6d7be90a60f616551718 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jacob-Keller/ptp-convert-drivers-to-adjfine/20220819-063154 git checkout d3c6eac5778f2ce74e7d6d7be90a60f616551718 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/net/ethernet/microchip/lan743x_ptp.c:368:12: error: redefinition of 'lan743x_ptpci_adjfine' static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long delta) ^ drivers/net/ethernet/microchip/lan743x_ptp.c:335:12: note: previous definition is here static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long scaled_ppm) ^ >> drivers/net/ethernet/microchip/lan743x_ptp.c:386:3: error: use of undeclared identifier 'lan743_rate_adj'; did you mean 'lan743x_rate_adj'? lan743_rate_adj = (u32)diff; ^~~~~~~~~~~~~~~ lan743x_rate_adj drivers/net/ethernet/microchip/lan743x_ptp.c:374:6: note: 'lan743x_rate_adj' declared here u64 lan743x_rate_adj; ^ >> drivers/net/ethernet/microchip/lan743x_ptp.c:388:3: error: use of undeclared identifier 'lan74e_rage_adj'; did you mean 'lan743x_rate_adj'? lan74e_rage_adj = (u32)diff | PTP_CLOCK_RATE_ADJ_DIR_; ^~~~~~~~~~~~~~~ lan743x_rate_adj drivers/net/ethernet/microchip/lan743x_ptp.c:374:6: note: 'lan743x_rate_adj' declared here u64 lan743x_rate_adj; ^ 3 errors generated. vim +386 drivers/net/ethernet/microchip/lan743x_ptp.c 367 368 static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long delta) 369 { 370 struct lan743x_ptp *ptp = 371 container_of(ptpci, struct lan743x_ptp, ptp_clock_info); 372 struct lan743x_adapter *adapter = 373 container_of(ptp, struct lan743x_adapter, ptp); 374 u64 lan743x_rate_adj; 375 s32 delta_ppb; 376 u64 diff; 377 378 delta_ppb = scaled_ppm_to_ppb(delta); 379 if ((delta_ppb < (-LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB)) || 380 delta_ppb > LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB) { 381 return -EINVAL; 382 } 383 384 /* diff_by_scaled_ppm returns true if the difference is negative */ 385 if (diff_by_scaled_ppm(1ULL << 35, delta, &diff)) > 386 lan743_rate_adj = (u32)diff; 387 else > 388 lan74e_rage_adj = (u32)diff | PTP_CLOCK_RATE_ADJ_DIR_; 389 390 lan743x_csr_write(adapter, PTP_CLOCK_RATE_ADJ, 391 lan743x_rate_adj); 392 393 return 0; 394 } 395
Hi Jacob, I love your patch! Yet something to improve: [auto build test ERROR on 9017462f006c4b686cb1e1e1a3a52ea8363076e6] url: https://github.com/intel-lab-lkp/linux/commits/Jacob-Keller/ptp-convert-drivers-to-adjfine/20220819-063154 base: 9017462f006c4b686cb1e1e1a3a52ea8363076e6 config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20220821/202208212326.87xlsbQB-lkp@intel.com/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 01ffe31cbb54bfd8e38e71b3cf804a1d67ebf9c1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install powerpc cross compiling tool for clang build # apt-get install binutils-powerpc-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/d3c6eac5778f2ce74e7d6d7be90a60f616551718 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jacob-Keller/ptp-convert-drivers-to-adjfine/20220819-063154 git checkout d3c6eac5778f2ce74e7d6d7be90a60f616551718 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/net/ethernet/microchip/lan743x_ptp.c:368:12: error: redefinition of 'lan743x_ptpci_adjfine' static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long delta) ^ drivers/net/ethernet/microchip/lan743x_ptp.c:335:12: note: previous definition is here static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long scaled_ppm) ^ >> drivers/net/ethernet/microchip/lan743x_ptp.c:386:3: error: use of undeclared identifier 'lan743_rate_adj'; did you mean 'lan743x_rate_adj'? lan743_rate_adj = (u32)diff; ^~~~~~~~~~~~~~~ lan743x_rate_adj drivers/net/ethernet/microchip/lan743x_ptp.c:374:6: note: 'lan743x_rate_adj' declared here u64 lan743x_rate_adj; ^ >> drivers/net/ethernet/microchip/lan743x_ptp.c:388:3: error: use of undeclared identifier 'lan74e_rage_adj'; did you mean 'lan743x_rate_adj'? lan74e_rage_adj = (u32)diff | PTP_CLOCK_RATE_ADJ_DIR_; ^~~~~~~~~~~~~~~ lan743x_rate_adj drivers/net/ethernet/microchip/lan743x_ptp.c:374:6: note: 'lan743x_rate_adj' declared here u64 lan743x_rate_adj; ^ 3 errors generated. vim +/lan743x_ptpci_adjfine +368 drivers/net/ethernet/microchip/lan743x_ptp.c 367 > 368 static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long delta) 369 { 370 struct lan743x_ptp *ptp = 371 container_of(ptpci, struct lan743x_ptp, ptp_clock_info); 372 struct lan743x_adapter *adapter = 373 container_of(ptp, struct lan743x_adapter, ptp); 374 u64 lan743x_rate_adj; 375 s32 delta_ppb; 376 u64 diff; 377 378 delta_ppb = scaled_ppm_to_ppb(delta); 379 if ((delta_ppb < (-LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB)) || 380 delta_ppb > LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB) { 381 return -EINVAL; 382 } 383 384 /* diff_by_scaled_ppm returns true if the difference is negative */ 385 if (diff_by_scaled_ppm(1ULL << 35, delta, &diff)) > 386 lan743_rate_adj = (u32)diff; 387 else > 388 lan74e_rage_adj = (u32)diff | PTP_CLOCK_RATE_ADJ_DIR_; 389 390 lan743x_csr_write(adapter, PTP_CLOCK_RATE_ADJ, 391 lan743x_rate_adj); 392 393 return 0; 394 } 395
> -----Original Message----- > From: lkp <lkp@intel.com> > Sent: Sunday, August 21, 2022 8:22 AM > To: Keller, Jacob E <jacob.e.keller@intel.com>; netdev@vger.kernel.org > Cc: llvm@lists.linux.dev; kbuild-all@lists.01.org; Keller, Jacob E > <jacob.e.keller@intel.com>; K. Y. Srinivasan <kys@microsoft.com>; Haiyang > Zhang <haiyangz@microsoft.com>; Stephen Hemminger > <sthemmin@microsoft.com>; Wei Liu <wei.liu@kernel.org>; Cui, Dexuan > <decui@microsoft.com>; Tom Lendacky <thomas.lendacky@amd.com>; Shyam > Sundar S K <Shyam-sundar.S-k@amd.com>; Eric Dumazet > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni > <pabeni@redhat.com>; Siva Reddy Kallam <siva.kallam@broadcom.com>; > Prashant Sreedharan <prashant@broadcom.com>; Michael Chan > <mchan@broadcom.com>; Yisen Zhuang <yisen.zhuang@huawei.com>; Salil > Mehta <salil.mehta@huawei.com>; Brandeburg, Jesse > <jesse.brandeburg@intel.com>; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; Tariq Toukan <tariqt@nvidia.com>; Saeed > Mahameed <saeedm@nvidia.com>; Leon Romanovsky <leon@kernel.org>; > Bryan Whitehead <bryan.whitehead@microchip.com>; Sergey Shtylyov > <s.shtylyov@omp.ru>; Giuseppe Cavallaro <peppe.cavallaro@st.com>; > Alexandre Torgue <alexandre.torgue@foss.st.com>; Jose Abreu > <joabreu@synopsys.com>; Maxime Coquelin <mcoquelin.stm32@gmail.com>; > Richard Cochran <richardcochran@gmail.com>; Thampi, Vivek > <vithampi@vmware.com> > Subject: Re: [net-next 10/14] ptp: lan743x: convert to .adjfine and > diff_by_scaled_ppm > > Hi Jacob, > > I love your patch! Yet something to improve: > > [auto build test ERROR on 9017462f006c4b686cb1e1e1a3a52ea8363076e6] > > url: https://github.com/intel-lab-lkp/linux/commits/Jacob-Keller/ptp-convert- > drivers-to-adjfine/20220819-063154 > base: 9017462f006c4b686cb1e1e1a3a52ea8363076e6 > config: powerpc-allyesconfig (https://download.01.org/0day- > ci/archive/20220821/202208212326.87xlsbQB-lkp@intel.com/config) > compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project > 01ffe31cbb54bfd8e38e71b3cf804a1d67ebf9c1) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp- > tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install powerpc cross compiling tool for clang build > # apt-get install binutils-powerpc-linux-gnu > # https://github.com/intel-lab- > lkp/linux/commit/d3c6eac5778f2ce74e7d6d7be90a60f616551718 > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review Jacob-Keller/ptp-convert-drivers-to- > adjfine/20220819-063154 > git checkout d3c6eac5778f2ce74e7d6d7be90a60f616551718 > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 > O=build_dir ARCH=powerpc SHELL=/bin/bash > > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot <lkp@intel.com> > > All errors (new ones prefixed by >>): > > >> drivers/net/ethernet/microchip/lan743x_ptp.c:368:12: error: redefinition of > 'lan743x_ptpci_adjfine' > static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long delta) > ^ > drivers/net/ethernet/microchip/lan743x_ptp.c:335:12: note: previous > definition is here > static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long scaled_ppm) > ^ > >> drivers/net/ethernet/microchip/lan743x_ptp.c:386:3: error: use of undeclared > identifier 'lan743_rate_adj'; did you mean 'lan743x_rate_adj'? > lan743_rate_adj = (u32)diff; > ^~~~~~~~~~~~~~~ > lan743x_rate_adj > drivers/net/ethernet/microchip/lan743x_ptp.c:374:6: note: 'lan743x_rate_adj' > declared here > u64 lan743x_rate_adj; > ^ > >> drivers/net/ethernet/microchip/lan743x_ptp.c:388:3: error: use of undeclared > identifier 'lan74e_rage_adj'; did you mean 'lan743x_rate_adj'? > lan74e_rage_adj = (u32)diff | PTP_CLOCK_RATE_ADJ_DIR_; > ^~~~~~~~~~~~~~~ > lan743x_rate_adj > drivers/net/ethernet/microchip/lan743x_ptp.c:374:6: note: 'lan743x_rate_adj' > declared here > u64 lan743x_rate_adj; > ^ > 3 errors generated. > > I'll fix this in v2 once I get feedback for the rest of the patches. Thanks, Jake
diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.c b/drivers/net/ethernet/microchip/lan743x_ptp.c index 6a11e2ceb013..a88606236710 100644 --- a/drivers/net/ethernet/microchip/lan743x_ptp.c +++ b/drivers/net/ethernet/microchip/lan743x_ptp.c @@ -365,33 +365,27 @@ static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long scaled_ppm) return 0; } -static int lan743x_ptpci_adjfreq(struct ptp_clock_info *ptpci, s32 delta_ppb) +static int lan743x_ptpci_adjfine(struct ptp_clock_info *ptpci, long delta) { struct lan743x_ptp *ptp = container_of(ptpci, struct lan743x_ptp, ptp_clock_info); struct lan743x_adapter *adapter = container_of(ptp, struct lan743x_adapter, ptp); - u32 lan743x_rate_adj = 0; - bool positive = true; - u32 u32_delta = 0; - u64 u64_delta = 0; + u64 lan743x_rate_adj; + s32 delta_ppb; + u64 diff; + delta_ppb = scaled_ppm_to_ppb(delta); if ((delta_ppb < (-LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB)) || delta_ppb > LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB) { return -EINVAL; } - if (delta_ppb > 0) { - u32_delta = (u32)delta_ppb; - positive = true; - } else { - u32_delta = (u32)(-delta_ppb); - positive = false; - } - u64_delta = (((u64)u32_delta) << 35); - lan743x_rate_adj = div_u64(u64_delta, 1000000000); - if (positive) - lan743x_rate_adj |= PTP_CLOCK_RATE_ADJ_DIR_; + /* diff_by_scaled_ppm returns true if the difference is negative */ + if (diff_by_scaled_ppm(1ULL << 35, delta, &diff)) + lan743_rate_adj = (u32)diff; + else + lan74e_rage_adj = (u32)diff | PTP_CLOCK_RATE_ADJ_DIR_; lan743x_csr_write(adapter, PTP_CLOCK_RATE_ADJ, lan743x_rate_adj); @@ -1576,7 +1570,7 @@ int lan743x_ptp_open(struct lan743x_adapter *adapter) ptp->ptp_clock_info.pps = LAN743X_PTP_N_PPS; ptp->ptp_clock_info.pin_config = ptp->pin_config; ptp->ptp_clock_info.adjfine = lan743x_ptpci_adjfine; - ptp->ptp_clock_info.adjfreq = lan743x_ptpci_adjfreq; + ptp->ptp_clock_info.adjfine = lan743x_ptpci_adjfine; ptp->ptp_clock_info.adjtime = lan743x_ptpci_adjtime; ptp->ptp_clock_info.gettime64 = lan743x_ptpci_gettime64; ptp->ptp_clock_info.getcrosststamp = NULL;
The lan743x implementation of .adjfreq is implemented in terms of a straight forward "base * ppb / 1 billion" calculation. Convert this driver to .adjfine and use diff_by_scaled_ppm to calculate the difference value for the PTP_CLOCK_RATE_ADJ csr. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Cc: Bryan Whitehead <bryan.whitehead@microchip.com> Cc: UNGLinuxDriver@microchip.com --- I do not have this hardware, and have only compile tested the change. drivers/net/ethernet/microchip/lan743x_ptp.c | 28 ++++++++------------ 1 file changed, 11 insertions(+), 17 deletions(-)