lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202501022323.HDFZ6FVp-lkp@intel.com>
Date: Fri, 3 Jan 2025 00:16:06 +0800
From: kernel test robot <lkp@...el.com>
To: Jiawen Wu <jiawenwu@...stnetic.com>, andrew+netdev@...n.ch,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, richardcochran@...il.com, linux@...linux.org.uk,
	horms@...nel.org, jacob.e.keller@...el.com, netdev@...r.kernel.org
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	mengyuanlou@...-swift.com, Jiawen Wu <jiawenwu@...stnetic.com>
Subject: Re: [PATCH net-next 1/4] net: wangxun: Add support for PTP clock

Hi Jiawen,

kernel test robot noticed the following build warnings:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Jiawen-Wu/net-wangxun-Add-support-for-PTP-clock/20250102-181338
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250102103026.1982137-2-jiawenwu%40trustnetic.com
patch subject: [PATCH net-next 1/4] net: wangxun: Add support for PTP clock
config: x86_64-buildonly-randconfig-004-20250102 (https://download.01.org/0day-ci/archive/20250102/202501022323.HDFZ6FVp-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250102/202501022323.HDFZ6FVp-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501022323.HDFZ6FVp-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/net/ethernet/wangxun/libwx/wx_ptp.c:4:
   In file included from include/linux/ptp_classify.h:14:
   In file included from include/linux/ip.h:16:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/x86/include/asm/cacheflush.h:5:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/net/ethernet/wangxun/libwx/wx_ptp.c:358:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
     358 |         case HWTSTAMP_TX_ON:
         |         ^
   drivers/net/ethernet/wangxun/libwx/wx_ptp.c:358:2: note: insert 'break;' to avoid fall-through
     358 |         case HWTSTAMP_TX_ON:
         |         ^
         |         break; 
   2 warnings generated.


vim +358 drivers/net/ethernet/wangxun/libwx/wx_ptp.c

   315	
   316	/**
   317	 * wx_ptp_set_timestamp_mode - setup the hardware for the requested mode
   318	 * @wx: the private board structure
   319	 * @config: the hwtstamp configuration requested
   320	 *
   321	 * Returns 0 on success, negative on failure
   322	 *
   323	 * Outgoing time stamping can be enabled and disabled. Play nice and
   324	 * disable it when requested, although it shouldn't cause any overhead
   325	 * when no packet needs it. At most one packet in the queue may be
   326	 * marked for time stamping, otherwise it would be impossible to tell
   327	 * for sure to which packet the hardware time stamp belongs.
   328	 *
   329	 * Incoming time stamping has to be configured via the hardware
   330	 * filters. Not all combinations are supported, in particular event
   331	 * type has to be specified. Matching the kind of event packet is
   332	 * not supported, with the exception of "all V2 events regardless of
   333	 * level 2 or 4".
   334	 *
   335	 * Since hardware always timestamps Path delay packets when timestamping V2
   336	 * packets, regardless of the type specified in the register, only use V2
   337	 * Event mode. This more accurately tells the user what the hardware is going
   338	 * to do anyways.
   339	 *
   340	 * Note: this may modify the hwtstamp configuration towards a more general
   341	 * mode, if required to support the specifically requested mode.
   342	 */
   343	static int wx_ptp_set_timestamp_mode(struct wx *wx,
   344					     struct hwtstamp_config *config)
   345	{
   346		u32 tsync_tx_ctl = WX_TSC_1588_CTL_ENABLED;
   347		u32 tsync_rx_ctl = WX_PSR_1588_CTL_ENABLED;
   348		DECLARE_BITMAP(flags, WX_PF_FLAGS_NBITS);
   349		u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
   350		bool is_l2 = false;
   351		u32 regval;
   352	
   353		memcpy(flags, wx->flags, sizeof(wx->flags));
   354	
   355		switch (config->tx_type) {
   356		case HWTSTAMP_TX_OFF:
   357			tsync_tx_ctl = 0;
 > 358		case HWTSTAMP_TX_ON:
   359			break;
   360		default:
   361			return -ERANGE;
   362		}
   363	
   364		switch (config->rx_filter) {
   365		case HWTSTAMP_FILTER_NONE:
   366			tsync_rx_ctl = 0;
   367			tsync_rx_mtrl = 0;
   368			clear_bit(WX_FLAG_RX_HWTSTAMP_ENABLED, flags);
   369			clear_bit(WX_FLAG_RX_HWTSTAMP_IN_REGISTER, flags);
   370			break;
   371		case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
   372			tsync_rx_ctl |= WX_PSR_1588_CTL_TYPE_L4_V1;
   373			tsync_rx_mtrl |= WX_PSR_1588_MSG_V1_SYNC;
   374			set_bit(WX_FLAG_RX_HWTSTAMP_ENABLED, flags);
   375			set_bit(WX_FLAG_RX_HWTSTAMP_IN_REGISTER, flags);
   376			break;
   377		case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
   378			tsync_rx_ctl |= WX_PSR_1588_CTL_TYPE_L4_V1;
   379			tsync_rx_mtrl |= WX_PSR_1588_MSG_V1_DELAY_REQ;
   380			set_bit(WX_FLAG_RX_HWTSTAMP_ENABLED, flags);
   381			set_bit(WX_FLAG_RX_HWTSTAMP_IN_REGISTER, flags);
   382			break;
   383		case HWTSTAMP_FILTER_PTP_V2_EVENT:
   384		case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
   385		case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
   386		case HWTSTAMP_FILTER_PTP_V2_SYNC:
   387		case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
   388		case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
   389		case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
   390		case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
   391		case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
   392			tsync_rx_ctl |= WX_PSR_1588_CTL_TYPE_EVENT_V2;
   393			is_l2 = true;
   394			config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
   395			set_bit(WX_FLAG_RX_HWTSTAMP_ENABLED, flags);
   396			set_bit(WX_FLAG_RX_HWTSTAMP_IN_REGISTER, flags);
   397			break;
   398		default:
   399			/* register RXMTRL must be set in order to do V1 packets,
   400			 * therefore it is not possible to time stamp both V1 Sync and
   401			 * Delay_Req messages unless hardware supports timestamping all
   402			 * packets => return error
   403			 */
   404			clear_bit(WX_FLAG_RX_HWTSTAMP_ENABLED, wx->flags);
   405			clear_bit(WX_FLAG_RX_HWTSTAMP_IN_REGISTER, wx->flags);
   406			config->rx_filter = HWTSTAMP_FILTER_NONE;
   407			return -ERANGE;
   408		}
   409	
   410		/* define ethertype filter for timestamping L2 packets */
   411		if (is_l2)
   412			wr32(wx, WX_PSR_ETYPE_SWC(WX_PSR_ETYPE_SWC_FILTER_1588),
   413			     (WX_PSR_ETYPE_SWC_FILTER_EN | /* enable filter */
   414			      WX_PSR_ETYPE_SWC_1588 | /* enable timestamping */
   415			      ETH_P_1588)); /* 1588 eth protocol type */
   416		else
   417			wr32(wx, WX_PSR_ETYPE_SWC(WX_PSR_ETYPE_SWC_FILTER_1588), 0);
   418	
   419		/* enable/disable TX */
   420		regval = rd32ptp(wx, WX_TSC_1588_CTL);
   421		regval &= ~WX_TSC_1588_CTL_ENABLED;
   422		regval |= tsync_tx_ctl;
   423		wr32ptp(wx, WX_TSC_1588_CTL, regval);
   424	
   425		/* enable/disable RX */
   426		regval = rd32(wx, WX_PSR_1588_CTL);
   427		regval &= ~(WX_PSR_1588_CTL_ENABLED | WX_PSR_1588_CTL_TYPE_MASK);
   428		regval |= tsync_rx_ctl;
   429		wr32(wx, WX_PSR_1588_CTL, regval);
   430	
   431		/* define which PTP packets are time stamped */
   432		wr32(wx, WX_PSR_1588_MSG, tsync_rx_mtrl);
   433	
   434		WX_WRITE_FLUSH(wx);
   435	
   436		/* configure adapter flags only when HW is actually configured */
   437		memcpy(wx->flags, flags, sizeof(wx->flags));
   438	
   439		/* clear TX/RX timestamp state, just to be sure */
   440		wx_ptp_clear_tx_timestamp(wx);
   441		rd32(wx, WX_PSR_1588_STMPH);
   442	
   443		return 0;
   444	}
   445	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ