[Cosmic,SRU,Bionic] hinic: Link the logical network device to the pci device in sysfs

Message ID 20180731194155.GA21439@xps13.dannf
State New
Headers show
Series
  • [Cosmic,SRU,Bionic] hinic: Link the logical network device to the pci device in sysfs
Related show

Commit Message

dann frazier July 31, 2018, 7:41 p.m.
BugLink: https://bugs.launchpad.net/bugs/1783138

Otherwise interfaces get exposed under /sys/devices/virtual, which
doesn't give udev the context it needs for PCI-based predictable
interface names.

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7856e8616273098dc6c09a6e084afd98a283ff0d)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
---
 drivers/net/ethernet/huawei/hinic/hinic_main.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Seth Forshee Aug. 1, 2018, 1:33 p.m. | #1
On Tue, Jul 31, 2018 at 01:41:55PM -0600, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1783138
> 
> Otherwise interfaces get exposed under /sys/devices/virtual, which
> doesn't give udev the context it needs for PCI-based predictable
> interface names.
> 
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 7856e8616273098dc6c09a6e084afd98a283ff0d)
> Signed-off-by: dann frazier <dann.frazier@canonical.com>

Simple change, clean cherry pick, positive testing.

Acked-by: Seth Forshee <seth.forshee@canonical.com>

Applied to cosmic/master-next and unstable/master, thanks!
Kleber Souza Aug. 14, 2018, 2:31 p.m. | #2
On 07/31/18 21:41, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1783138
> 
> Otherwise interfaces get exposed under /sys/devices/virtual, which
> doesn't give udev the context it needs for PCI-based predictable
> interface names.
> 
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 7856e8616273098dc6c09a6e084afd98a283ff0d)
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> ---
>  drivers/net/ethernet/huawei/hinic/hinic_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> index 5b122728dcb47..09e9da10b7865 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> @@ -983,6 +983,7 @@ static int nic_dev_init(struct pci_dev *pdev)
>  	hinic_hwdev_cb_register(nic_dev->hwdev, HINIC_MGMT_MSG_CMD_LINK_STATUS,
>  				nic_dev, link_status_event_handler);
>  
> +	SET_NETDEV_DEV(netdev, &pdev->dev);
>  	err = register_netdev(netdev);
>  	if (err) {
>  		dev_err(&pdev->dev, "Failed to register netdev\n");
> 

As stated on the bug report, it can break some users in some
configurations but creating predictable interface names is the right
thing to do.

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Khaled Elmously Aug. 21, 2018, 6:02 a.m. | #3
to bionic/master-next

On 2018-07-31 13:41:55 , dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1783138
> 
> Otherwise interfaces get exposed under /sys/devices/virtual, which
> doesn't give udev the context it needs for PCI-based predictable
> interface names.
> 
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 7856e8616273098dc6c09a6e084afd98a283ff0d)
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> ---
>  drivers/net/ethernet/huawei/hinic/hinic_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> index 5b122728dcb47..09e9da10b7865 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> @@ -983,6 +983,7 @@ static int nic_dev_init(struct pci_dev *pdev)
>  	hinic_hwdev_cb_register(nic_dev->hwdev, HINIC_MGMT_MSG_CMD_LINK_STATUS,
>  				nic_dev, link_status_event_handler);
>  
> +	SET_NETDEV_DEV(netdev, &pdev->dev);
>  	err = register_netdev(netdev);
>  	if (err) {
>  		dev_err(&pdev->dev, "Failed to register netdev\n");
> -- 
> 2.18.0
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Patch

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c
index 5b122728dcb47..09e9da10b7865 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_main.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c
@@ -983,6 +983,7 @@  static int nic_dev_init(struct pci_dev *pdev)
 	hinic_hwdev_cb_register(nic_dev->hwdev, HINIC_MGMT_MSG_CMD_LINK_STATUS,
 				nic_dev, link_status_event_handler);
 
+	SET_NETDEV_DEV(netdev, &pdev->dev);
 	err = register_netdev(netdev);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to register netdev\n");