lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <qbvrpeywjv6jvngkdtfcducex4jpsgqktfqs6ar2plc5bcgt5o@7bsfau64w3om>
Date: Tue, 16 Sep 2025 21:20:54 +0200
From: Jörg Sommer <joerg@...so.de>
To: Dong Yibo <dong100@...se.com>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com, 
	kuba@...nel.org, pabeni@...hat.com, horms@...nel.org, corbet@....net, 
	gur.stavi@...wei.com, maddy@...ux.ibm.com, mpe@...erman.id.au, danishanwar@...com, 
	lee@...ger.us, gongfan1@...wei.com, lorenzo@...nel.org, geert+renesas@...der.be, 
	Parthiban.Veerasooran@...rochip.com, lukas.bulwahn@...hat.com, alexanderduyck@...com, 
	richardcochran@...il.com, kees@...nel.org, gustavoars@...nel.org, rdunlap@...radead.org, 
	vadim.fedorenko@...ux.dev, netdev@...r.kernel.org, linux-doc@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH net-next v12 2/5] net: rnpgbe: Add n500/n210 chip support
 with BAR2 mapping

Dong Yibo schrieb am Di 16. Sep, 19:29 (+0800):
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
> index 60bbc806f17b..0afe39621661 100644
> --- a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
> +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
> @@ -2,8 +2,11 @@
>  /* Copyright(c) 2020 - 2025 Mucse Corporation. */
>  
>  #include <linux/pci.h>
> +#include <net/rtnetlink.h>
> +#include <linux/etherdevice.h>
>  
>  #include "rnpgbe.h"
> +#include "rnpgbe_hw.h"
>  
>  static const char rnpgbe_driver_name[] = "rnpgbe";
>  
> @@ -25,6 +28,54 @@ static struct pci_device_id rnpgbe_pci_tbl[] = {
>  	{0, },
>  };
>  
> +/**
> + * rnpgbe_add_adapter - Add netdev for this pci_dev
> + * @pdev: PCI device information structure
> + * @board_type: board type
> + *
> + * rnpgbe_add_adapter initializes a netdev for this pci_dev
> + * structure. Initializes Bar map, private structure, and a
> + * hardware reset occur.
> + *
> + * Return: 0 on success, negative errno on failure
> + **/
> +static int rnpgbe_add_adapter(struct pci_dev *pdev,
> +			      int board_type)
> +{
> +	struct net_device *netdev;
> +	void __iomem *hw_addr;
> +	struct mucse *mucse;
> +	struct mucse_hw *hw;
> +	int err;
> +
> +	netdev = alloc_etherdev_mq(sizeof(struct mucse), RNPGBE_MAX_QUEUES);
> +	if (!netdev)
> +		return -ENOMEM;
> +
> +	SET_NETDEV_DEV(netdev, &pdev->dev);
> +	mucse = netdev_priv(netdev);
> +	mucse->netdev = netdev;
> +	mucse->pdev = pdev;
> +	pci_set_drvdata(pdev, mucse);
> +
> +	hw = &mucse->hw;
> +	hw_addr = devm_ioremap(&pdev->dev,
> +			       pci_resource_start(pdev, 2),
> +			       pci_resource_len(pdev, 2));
> +	if (!hw_addr) {
> +		err = -EIO;
> +		goto err_free_net;
> +	}
> +
> +	hw->hw_addr = hw_addr;
> +
> +	return 0;
> +
> +err_free_net:
> +	free_netdev(netdev);
> +	return err;
> +}
> +
>  /**
>   * rnpgbe_probe - Device initialization routine
>   * @pdev: PCI device information struct
> @@ -37,6 +88,7 @@ static struct pci_device_id rnpgbe_pci_tbl[] = {
>   **/
>  static int rnpgbe_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  {
> +	int board_type = id->driver_data;
>  	int err;
>  
>  	err = pci_enable_device_mem(pdev);
> @@ -63,6 +115,9 @@ static int rnpgbe_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  		dev_err(&pdev->dev, "pci_save_state failed %d\n", err);
>  		goto err_free_regions;
>  	}
> +	err = rnpgbe_add_adapter(pdev, board_type);

Would an empty line before this assignment make the code more readable?



-- 
Professor: ‚Gott‘, unverständliches und mythisches Wesen, das sich einmal
  pro Woche im Kreis der Sterblichen manifestiert um Weisheit auf Folien
  unter das Volk zu bringen.		(Dschungelbuch 11, FSU Jena)

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ