MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ixgbe_start_timecounters

Function ixgbe_start_timecounters

dpdk/drivers/net/ixgbe/ixgbe_ethdev.c:6972–7039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6970}
6971
6972static void
6973ixgbe_start_timecounters(struct rte_eth_dev *dev)
6974{
6975 struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
6976 struct ixgbe_adapter *adapter = dev->data->dev_private;
6977 struct rte_eth_link link;
6978 uint32_t incval = 0;
6979 uint32_t shift = 0;
6980
6981 /* Get current link speed. */
6982 ixgbe_dev_link_update(dev, 1);
6983 rte_eth_linkstatus_get(dev, &link);
6984
6985 switch (link.link_speed) {
6986 case RTE_ETH_SPEED_NUM_100M:
6987 incval = IXGBE_INCVAL_100;
6988 shift = IXGBE_INCVAL_SHIFT_100;
6989 break;
6990 case RTE_ETH_SPEED_NUM_1G:
6991 incval = IXGBE_INCVAL_1GB;
6992 shift = IXGBE_INCVAL_SHIFT_1GB;
6993 break;
6994 case RTE_ETH_SPEED_NUM_10G:
6995 default:
6996 incval = IXGBE_INCVAL_10GB;
6997 shift = IXGBE_INCVAL_SHIFT_10GB;
6998 break;
6999 }
7000
7001 switch (hw->mac.type) {
7002 case ixgbe_mac_X550:
7003 case ixgbe_mac_X550EM_x:
7004 case ixgbe_mac_X550EM_a:
7005 /* Independent of link speed. */
7006 incval = 1;
7007 /* Cycles read will be interpreted as ns. */
7008 shift = 0;
7009 /* Fall-through */
7010 case ixgbe_mac_X540:
7011 IXGBE_WRITE_REG(hw, IXGBE_TIMINCA, incval);
7012 break;
7013 case ixgbe_mac_82599EB:
7014 incval >>= IXGBE_INCVAL_SHIFT_82599;
7015 shift -= IXGBE_INCVAL_SHIFT_82599;
7016 IXGBE_WRITE_REG(hw, IXGBE_TIMINCA,
7017 (1 << IXGBE_INCPER_SHIFT_82599) | incval);
7018 break;
7019 default:
7020 /* Not supported. */
7021 return;
7022 }
7023
7024 memset(&adapter->systime_tc, 0, sizeof(struct rte_timecounter));
7025 memset(&adapter->rx_tstamp_tc, 0, sizeof(struct rte_timecounter));
7026 memset(&adapter->tx_tstamp_tc, 0, sizeof(struct rte_timecounter));
7027
7028 adapter->systime_tc.cc_mask = IXGBE_CYCLECOUNTER_MASK;
7029 adapter->systime_tc.cc_shift = shift;

Callers 1

ixgbe_timesync_enableFunction · 0.85

Calls 3

ixgbe_dev_link_updateFunction · 0.85
rte_eth_linkstatus_getFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected