diff mbox series

[next-queue,v3,2/3] igc: Enable PCIe PTM

Message ID 20210322161822.1546454-3-vinicius.gomes@intel.com (mailing list archive)
State Superseded
Headers show
Series igc: Add support for PCIe PTM | expand

Commit Message

Vinicius Costa Gomes March 22, 2021, 4:18 p.m. UTC
In practice, enabling PTM also sets the enabled_ptm flag in the PCI
device, the flag will be used for detecting if PTM is enabled before
adding support for the SYSOFFSET_PRECISE ioctl() (which is added by
implementing the getcrosststamp() PTP function).

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Bjorn Helgaas March 23, 2021, 7:29 p.m. UTC | #1
On Mon, Mar 22, 2021 at 09:18:21AM -0700, Vinicius Costa Gomes wrote:
> In practice, enabling PTM also sets the enabled_ptm flag in the PCI
> device, the flag will be used for detecting if PTM is enabled before
> adding support for the SYSOFFSET_PRECISE ioctl() (which is added by
> implementing the getcrosststamp() PTP function).

I think you're referring to the "pci_dev.ptm_enabled" flag.  I'm not
sure what the connection to this patch is.  The SYSOFFSET_PRECISE
stuff also seems to belong with some other patch.

This patch merely enables PTM if it's supported (might be worth
expanding Precision Time Measurement for context).

> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
>  drivers/net/ethernet/intel/igc/igc_main.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index f77feadde8d2..04319ffae288 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -12,6 +12,8 @@
>  #include <net/pkt_sched.h>
>  #include <linux/bpf_trace.h>
>  #include <net/xdp_sock_drv.h>
> +#include <linux/pci.h>
> +
>  #include <net/ipv6.h>
>  
>  #include "igc.h"
> @@ -5792,6 +5794,10 @@ static int igc_probe(struct pci_dev *pdev,
>  
>  	pci_enable_pcie_error_reporting(pdev);
>  
> +	err = pci_enable_ptm(pdev, NULL);
> +	if (err < 0)
> +		dev_err(&pdev->dev, "PTM not supported\n");
> +
>  	pci_set_master(pdev);
>  
>  	err = -ENOMEM;
> -- 
> 2.31.0
>
Vinicius Costa Gomes March 23, 2021, 7:40 p.m. UTC | #2
Bjorn Helgaas <helgaas@kernel.org> writes:

> On Mon, Mar 22, 2021 at 09:18:21AM -0700, Vinicius Costa Gomes wrote:
>> In practice, enabling PTM also sets the enabled_ptm flag in the PCI
>> device, the flag will be used for detecting if PTM is enabled before
>> adding support for the SYSOFFSET_PRECISE ioctl() (which is added by
>> implementing the getcrosststamp() PTP function).
>
> I think you're referring to the "pci_dev.ptm_enabled" flag.  I'm not
> sure what the connection to this patch is.  The SYSOFFSET_PRECISE
> stuff also seems to belong with some other patch.

Yeah, I will improve the commit message to make it clear that this patch
is a preparation patch for the one that will add support for
PTP_SYS_OFFSET_PRECISE/getcrosststamp() and what's the relation with
PCIe PTM.

>
> This patch merely enables PTM if it's supported (might be worth
> expanding Precision Time Measurement for context).

Yes. Will expand the definition in the commit message.


Cheers,
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index f77feadde8d2..04319ffae288 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -12,6 +12,8 @@ 
 #include <net/pkt_sched.h>
 #include <linux/bpf_trace.h>
 #include <net/xdp_sock_drv.h>
+#include <linux/pci.h>
+
 #include <net/ipv6.h>
 
 #include "igc.h"
@@ -5792,6 +5794,10 @@  static int igc_probe(struct pci_dev *pdev,
 
 	pci_enable_pcie_error_reporting(pdev);
 
+	err = pci_enable_ptm(pdev, NULL);
+	if (err < 0)
+		dev_err(&pdev->dev, "PTM not supported\n");
+
 	pci_set_master(pdev);
 
 	err = -ENOMEM;