1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Check PTP feature bits

This commit is contained in:
Alex Forencich 2019-09-12 10:47:26 -07:00
parent 132d44cd90
commit 9341f93b3f
3 changed files with 8 additions and 3 deletions

View File

@ -191,7 +191,9 @@ static int mqnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_info(dev, "PHC count: %d", mqnic->phc_count); dev_info(dev, "PHC count: %d", mqnic->phc_count);
mqnic->phc_offset = ioread32(mqnic->hw_addr+MQNIC_REG_PHC_OFFSET); mqnic->phc_offset = ioread32(mqnic->hw_addr+MQNIC_REG_PHC_OFFSET);
dev_info(dev, "PHC offset: 0x%08x", mqnic->phc_offset); dev_info(dev, "PHC offset: 0x%08x", mqnic->phc_offset);
mqnic->phc_hw_addr = mqnic->hw_addr+mqnic->phc_offset;
if (mqnic->phc_count)
mqnic->phc_hw_addr = mqnic->hw_addr+mqnic->phc_offset;
mqnic->if_count = ioread32(mqnic->hw_addr+MQNIC_REG_IF_COUNT); mqnic->if_count = ioread32(mqnic->hw_addr+MQNIC_REG_IF_COUNT);
dev_info(dev, "IF count: %d", mqnic->if_count); dev_info(dev, "IF count: %d", mqnic->if_count);

View File

@ -292,7 +292,10 @@ bool mqnic_process_rx_cq(struct net_device *ndev, struct mqnic_cq_ring *cq_ring,
skb->protocol = eth_type_trans(skb, priv->ndev); skb->protocol = eth_type_trans(skb, priv->ndev);
// RX hardware timestamp // RX hardware timestamp
skb_hwtstamps(skb)->hwtstamp = mqnic_read_cpl_ts(priv->mdev, ring, cpl); if (priv->if_features & MQNIC_IF_FEATURE_PTP_TS)
{
skb_hwtstamps(skb)->hwtstamp = mqnic_read_cpl_ts(priv->mdev, ring, cpl);
}
skb_record_rx_queue(skb, cq_ring->ring_index); skb_record_rx_queue(skb, cq_ring->ring_index);

View File

@ -356,7 +356,7 @@ netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *ndev)
// TX hardware timestamp // TX hardware timestamp
tx_info->ts_requested = 0; tx_info->ts_requested = 0;
if (unlikely(shinfo->tx_flags & SKBTX_HW_TSTAMP)) { if (unlikely(priv->if_features & MQNIC_IF_FEATURE_PTP_TS && shinfo->tx_flags & SKBTX_HW_TSTAMP)) {
dev_info(&priv->mdev->pdev->dev, "mqnic_start_xmit TX TS requested"); dev_info(&priv->mdev->pdev->dev, "mqnic_start_xmit TX TS requested");
shinfo->tx_flags |= SKBTX_IN_PROGRESS; shinfo->tx_flags |= SKBTX_IN_PROGRESS;
tx_info->ts_requested = 1; tx_info->ts_requested = 1;