mlx4_core: boot sriov
Subsystems (3)
PATCH 16/25 mlx4_core: boot sriov
Add virtual function device ids.
Establish comm channel when sriov is enabled, and boot vfs through it. Each slave gets one msi-X for completions, the master also gets one for async events.
--- drivers/net/mlx4/eq.c | 21 ++-- drivers/net/mlx4/main.c | 315 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 260 insertions(+), 76 deletions(-)
drivers/net/mlx4/eq.c +12 -9
@@ -770,16 +770,18 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) goto err_out_unmap; } - err =mlx4_create_eq (dev,MLX4_NUM_ASYNC_EQE +MLX4_NUM_SPARE_EQE , - (dev->flags &MLX4_FLAG_MSI_X ) ? dev->caps.num_comp_vectors :0 , - &priv->eq_table.eq[dev->caps.num_comp_vectors]); -if (err) - goto err_out_comp; +if (!mlx4_is_slave (dev)) { + err =mlx4_create_eq (dev,MLX4_NUM_ASYNC_EQE +MLX4_NUM_SPARE_EQE , + (dev->flags &MLX4_FLAG_MSI_X ) ? dev->caps.num_comp_vectors :0 , + &priv->eq_table.eq[dev->caps.num_comp_vectors]); +if (err) + goto err_out_comp; + }if (dev->flags &MLX4_FLAG_MSI_X ) {const char *eq_name; -for (i =0 ; i < dev->caps.num_comp_vectors +1 ; ++i) { +for (i =0 ; i < dev->caps.num_comp_vectors + !(mlx4_is_slave (dev)); ++i) {if (i < dev->caps.num_comp_vectors) { snprintf(priv->eq_table.irq_names + i * MLX4_IRQNAME_SIZE,
@@ -825,13 +827,14 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) priv->eq_table.eq[dev->caps.num_comp_vectors].eqn, err); } -for (i =0 ; i < dev->caps.num_comp_vectors +1 ; ++i) +for (i =0 ; i < dev->caps.num_comp_vectors + !(mlx4_is_slave (dev)); ++i)eq_set_ci (&priv->eq_table.eq[i],1 );return 0 ; err_out_async: -mlx4_free_eq (dev, &priv->eq_table.eq[dev->caps.num_comp_vectors]); +if (!mlx4_is_slave (dev)) +mlx4_free_eq (dev, &priv->eq_table.eq[dev->caps.num_comp_vectors]); err_out_comp: i = dev->caps.num_comp_vectors;
@@ -866,7 +869,7 @@ void mlx4_cleanup_eq_table(struct mlx4_dev *dev)mlx4_free_irqs (dev); -for (i =0 ; i < dev->caps.num_comp_vectors +1 ; ++i) +for (i =0 ; i < dev->caps.num_comp_vectors + !mlx4_is_slave (dev); ++i)mlx4_free_eq (dev, &priv->eq_table.eq[i]);if (!mlx4_is_slave (dev))
drivers/net/mlx4/main.c +248 -67
468 lines not on this page · raw message
Signature · 9 lines
1.6.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
drivers/net/mlx4/main.c static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) · line 1265
Quoted 10 lines
drivers/net/mlx4/main.c +9
-0+/* Detect if this device is a virtual function */ +switch (id->device) { +case 0x6341 : +case 0x634b : +case 0x6733 : +case 0x673d : +case 0x6369 : +case 0x6751 : +case 0x6765 :
This isn't be maintainable or sane. How about using driver_data in the PCI device table?
Review
Quoted 2 lines
(quoted diff) +2
-0+#ifdef CONFIG_PCI_IOV + if (sr_iov) {
Can we avoid a lot of these ifdefs by just doing
#else
#define sr_iov 0
#endif /* CONFIG_PCI_IOV */
at the beginning and letting the IOV code be optimized away?
- R.
S.B.
--Liran
-----Original Message-----
From: Roland Dreier [mailto:[email protected]]
Sent: Wednesday, November 04, 2009 9:56 PM
To: Yevgeny Petrilin
Cc: [email protected]; [email protected]; Liran Liss; Tziporet Koren
Subject: Re: [PATCH 16/25] mlx4_core: boot sriov
drivers/net/mlx4/main.c static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) · line 1265
Quoted 9 lines
drivers/net/mlx4/main.c +9
-0+/* Detect if this device is a virtual function */ +switch (id->device) { +case 0x6341 : +case 0x634b : +case 0x6733 : +case 0x673d : +case 0x6369 : +case 0x6751 : +case 0x6765 :
This isn't be maintainable or sane. How about using driver_data in the PCI device table?
LL: good idea; 10x.
Review
Quoted 2 lines
(quoted diff) +2
-0+#ifdef CONFIG_PCI_IOV + if (sr_iov) {
Can we avoid a lot of these ifdefs by just doing
#else
#define sr_iov 0
#endif /* CONFIG_PCI_IOV */
at the beginning and letting the IOV code be optimized away?
LL: I think that this won't pass -Wall when compiling against a kernel with sriov compiled out.
- R.
A message that is not in the archive (sent off-list or not yet received): 2ED289D4E09FBD4D92D911E869B97FDD0166CA13-ia22CT07NJfiMCgWhms8HQC/[email protected]
Quoted 3 lines
LL: I think that this won't pass -Wall when compiling against a kernel with sriov compiled out.
Why not? The sriov code provides stubs like:
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
{
return -ENODEV;
}if CONFIG_PCI_IOV is not enabled.
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
I was also thinking about backports to older kernels without sriov at all, which will probably be in our VMs in the near future. For these kernels, we still want to the code to operate in slave mode...
Anyway, we can push the pci_enable_sriov() stub to the OFED backport system as well, so I am fine.
10x,
--Liran
-----Original Message-----
From: Roland Dreier [mailto:[email protected]]
Sent: Thursday, November 05, 2009 5:57 PM
To: Liran Liss
Cc: Yevgeny Petrilin; [email protected];
[email protected]; Tziporet Koren
Subject: Re: [PATCH 16/25] mlx4_core: boot sriov
Quoted 1 line
LL: I think that this won't pass -Wall when compiling against a
kernel > with sriov compiled out.
Why not? The sriov code provides stubs like:
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) {
return -ENODEV;
}if CONFIG_PCI_IOV is not enabled.
- R.