DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] staging: octeon: repair "fixed-link" support
@ 2020-10-09  9:46 Alexander A Sverdlin
  2020-10-09  9:46 ` [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error Alexander A Sverdlin
  0 siblings, 1 reply; 11+ messages in thread
From: Alexander A Sverdlin @ 2020-10-09  9:46 UTC (permalink / raw)
  To: devel
  Cc: Aaro Koskinen, netdev, Ralf Baechle, Alexander Sverdlin,
	Alexander Sverdlin, Greg Kroah-Hartman, David S. Miller

From: Alexander Sverdlin <alexander.sverdlin@nsn.com>

The PHYs must be registered once in device probe function, not in device
open callback because it's only possible to register them once.

Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 drivers/staging/octeon/ethernet-mdio.c |  6 ------
 drivers/staging/octeon/ethernet.c      | 10 ++++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index cfb673a..0bf54584 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -147,12 +147,6 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
 
 	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
 	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-		int rc;
-
-		rc = of_phy_register_fixed_link(priv->of_node);
-		if (rc)
-			return rc;
-
 		phy_node = of_node_get(priv->of_node);
 	}
 	if (!phy_node)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 204f0b1..2b0d05d 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -13,6 +13,7 @@
 #include <linux/phy.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/of_mdio.h>
 #include <linux/of_net.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
@@ -892,6 +893,15 @@ static int cvm_oct_probe(struct platform_device *pdev)
 				break;
 			}
 
+			if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
+				r = of_phy_register_fixed_link(priv->of_node);
+				if (r) {
+					netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
+						   interface, priv->ipd_port);
+					dev->netdev_ops = NULL;
+				}
+			}
+
 			if (!dev->netdev_ops) {
 				free_netdev(dev);
 			} else if (register_netdev(dev) < 0) {
-- 
2.10.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error
  2020-10-09  9:46 [PATCH] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
@ 2020-10-09  9:46 ` Alexander A Sverdlin
  2020-10-09 12:24   ` Dan Carpenter
  0 siblings, 1 reply; 11+ messages in thread
From: Alexander A Sverdlin @ 2020-10-09  9:46 UTC (permalink / raw)
  To: devel
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Ralf Baechle,
	Alexander Sverdlin, netdev, David S. Miller

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

Currently in case of alignment or FCS error if the packet cannot be
corrected it's still not dropped. Report the error properly and drop the
packet while making the code around a little bit more readable.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Fixes: 80ff0fd3ab ("Staging: Add octeon-ethernet driver files.")

Change-Id: Ie1fadcc57cb5e221cf3e83c169b53a5533b8edff
---
 drivers/staging/octeon/ethernet-rx.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index 2c16230..b22f7be 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -69,14 +69,16 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
 	else
 		port = work->word1.cn38xx.ipprt;
 
-	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
+	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64))
 		/*
 		 * Ignore length errors on min size packets. Some
 		 * equipment incorrectly pads packets to 64+4FCS
 		 * instead of 60+4FCS.  Note these packets still get
 		 * counted as frame errors.
 		 */
-	} else if (work->word2.snoip.err_code == 5 ||
+		return 0;
+
+	if (work->word2.snoip.err_code == 5 ||
 		   work->word2.snoip.err_code == 7) {
 		/*
 		 * We received a packet with either an alignment error
@@ -125,14 +127,12 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
 				return 1;
 			}
 		}
-	} else {
-		printk_ratelimited("Port %d receive error code %d, packet dropped\n",
-				   port, work->word2.snoip.err_code);
-		cvm_oct_free_work(work);
-		return 1;
 	}
 
-	return 0;
+	printk_ratelimited("Port %d receive error code %d, packet dropped\n",
+			   port, work->word2.snoip.err_code);
+	cvm_oct_free_work(work);
+	return 1;
 }
 
 static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb)
-- 
2.10.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error
  2020-10-09  9:46 ` [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error Alexander A Sverdlin
@ 2020-10-09 12:24   ` Dan Carpenter
  2020-10-12 12:23     ` Alexander Sverdlin
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2020-10-09 12:24 UTC (permalink / raw)
  To: Alexander A Sverdlin
  Cc: devel, Aaro Koskinen, Greg Kroah-Hartman, Ralf Baechle, netdev,
	David S. Miller

On Fri, Oct 09, 2020 at 11:46:05AM +0200, Alexander A Sverdlin wrote:
> --- a/drivers/staging/octeon/ethernet-rx.c
> +++ b/drivers/staging/octeon/ethernet-rx.c
> @@ -69,14 +69,16 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
>  	else
>  		port = work->word1.cn38xx.ipprt;
>  
> -	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
> +	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64))
>  		/*
>  		 * Ignore length errors on min size packets. Some
>  		 * equipment incorrectly pads packets to 64+4FCS
>  		 * instead of 60+4FCS.  Note these packets still get
>  		 * counted as frame errors.
>  		 */
> -	} else if (work->word2.snoip.err_code == 5 ||
> +		return 0;
> +
> +	if (work->word2.snoip.err_code == 5 ||
>  		   work->word2.snoip.err_code == 7) {

This line is indented to match the old code and it no longer matches.
(Please update the whitespace).

>  		/*
>  		 * We received a packet with either an alignment error

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error
  2020-10-09 12:24   ` Dan Carpenter
@ 2020-10-12 12:23     ` Alexander Sverdlin
  0 siblings, 0 replies; 11+ messages in thread
From: Alexander Sverdlin @ 2020-10-12 12:23 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, Aaro Koskinen, Greg Kroah-Hartman, Ralf Baechle, netdev,
	David S. Miller

Hello Dan,

On 09/10/2020 14:24, Dan Carpenter wrote:
> On Fri, Oct 09, 2020 at 11:46:05AM +0200, Alexander A Sverdlin wrote:
>> --- a/drivers/staging/octeon/ethernet-rx.c
>> +++ b/drivers/staging/octeon/ethernet-rx.c
>> @@ -69,14 +69,16 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
>>  	else
>>  		port = work->word1.cn38xx.ipprt;
>>  
>> -	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
>> +	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64))
>>  		/*
>>  		 * Ignore length errors on min size packets. Some
>>  		 * equipment incorrectly pads packets to 64+4FCS
>>  		 * instead of 60+4FCS.  Note these packets still get
>>  		 * counted as frame errors.
>>  		 */
>> -	} else if (work->word2.snoip.err_code == 5 ||
>> +		return 0;
>> +
>> +	if (work->word2.snoip.err_code == 5 ||
>>  		   work->word2.snoip.err_code == 7) {
> This line is indented to match the old code and it no longer matches.
> (Please update the whitespace).

thanks to your comment I took a fresh look onto the patch and found a logic error
in the change. Please ignore the whole patch for now.
 
>>  		/*
>>  		 * We received a packet with either an alignment error

-- 
Best regards,
Alexander Sverdlin.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] staging: octeon: repair "fixed-link" support
  2020-10-09  9:47 [PATCH] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
  2020-10-09 11:15 ` kernel test robot
  2020-10-09 13:09 ` Greg Kroah-Hartman
@ 2020-10-09 14:31 ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2020-10-09 14:31 UTC (permalink / raw)
  To: Alexander A Sverdlin, devel
  Cc: kbuild-all, Aaro Koskinen, Greg Kroah-Hartman, Ralf Baechle,
	clang-built-linux, Alexander Sverdlin, netdev


[-- Attachment #1: Type: text/plain, Size: 11390 bytes --]

Hi Alexander,

I love your patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 76c3bdd67d27289b9e407113821eab2a70bbcca6
config: arm64-randconfig-r033-20201009 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4cfc4025cc1433ca5ef1c526053fc9c4bfe64109)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/99d271d0a7dda48d064e12957a8846907220bf44
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
        git checkout 99d271d0a7dda48d064e12957a8846907220bf44
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/staging/octeon/ethernet.c:897:5: error: use of undeclared identifier 'r'
                                   r = of_phy_register_fixed_link(priv->of_node);
                                   ^
   drivers/staging/octeon/ethernet.c:898:9: error: use of undeclared identifier 'r'
                                   if (r) {
                                       ^
   drivers/staging/octeon/ethernet.c:898:9: error: use of undeclared identifier 'r'
   drivers/staging/octeon/ethernet.c:898:9: error: use of undeclared identifier 'r'
>> drivers/staging/octeon/ethernet.c:900:27: error: no member named 'ipd_port' in 'struct octeon_ethernet'
                                                      interface, priv->ipd_port);
                                                                 ~~~~  ^
   5 errors generated.

vim +/r +897 drivers/staging/octeon/ethernet.c

   692	
   693		pip = pdev->dev.of_node;
   694		if (!pip) {
   695			pr_err("Error: No 'pip' in /aliases\n");
   696			return -EINVAL;
   697		}
   698	
   699		cvm_oct_configure_common_hw();
   700	
   701		cvmx_helper_initialize_packet_io_global();
   702	
   703		if (receive_group_order) {
   704			if (receive_group_order > 4)
   705				receive_group_order = 4;
   706			pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
   707		} else {
   708			pow_receive_groups = BIT(pow_receive_group);
   709		}
   710	
   711		/* Change the input group for all ports before input is enabled */
   712		num_interfaces = cvmx_helper_get_number_of_interfaces();
   713		for (interface = 0; interface < num_interfaces; interface++) {
   714			int num_ports = cvmx_helper_ports_on_interface(interface);
   715			int port;
   716	
   717			for (port = cvmx_helper_get_ipd_port(interface, 0);
   718			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   719			     port++) {
   720				union cvmx_pip_prt_tagx pip_prt_tagx;
   721	
   722				pip_prt_tagx.u64 =
   723				    cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
   724	
   725				if (receive_group_order) {
   726					int tag_mask;
   727	
   728					/* We support only 16 groups at the moment, so
   729					 * always disable the two additional "hidden"
   730					 * tag_mask bits on CN68XX.
   731					 */
   732					if (OCTEON_IS_MODEL(OCTEON_CN68XX))
   733						pip_prt_tagx.u64 |= 0x3ull << 44;
   734	
   735					tag_mask = ~((1 << receive_group_order) - 1);
   736					pip_prt_tagx.s.grptagbase	= 0;
   737					pip_prt_tagx.s.grptagmask	= tag_mask;
   738					pip_prt_tagx.s.grptag		= 1;
   739					pip_prt_tagx.s.tag_mode		= 0;
   740					pip_prt_tagx.s.inc_prt_flag	= 1;
   741					pip_prt_tagx.s.ip6_dprt_flag	= 1;
   742					pip_prt_tagx.s.ip4_dprt_flag	= 1;
   743					pip_prt_tagx.s.ip6_sprt_flag	= 1;
   744					pip_prt_tagx.s.ip4_sprt_flag	= 1;
   745					pip_prt_tagx.s.ip6_dst_flag	= 1;
   746					pip_prt_tagx.s.ip4_dst_flag	= 1;
   747					pip_prt_tagx.s.ip6_src_flag	= 1;
   748					pip_prt_tagx.s.ip4_src_flag	= 1;
   749					pip_prt_tagx.s.grp		= 0;
   750				} else {
   751					pip_prt_tagx.s.grptag	= 0;
   752					pip_prt_tagx.s.grp	= pow_receive_group;
   753				}
   754	
   755				cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
   756					       pip_prt_tagx.u64);
   757			}
   758		}
   759	
   760		cvmx_helper_ipd_and_packet_input_enable();
   761	
   762		memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
   763	
   764		/*
   765		 * Initialize the FAU used for counting packet buffers that
   766		 * need to be freed.
   767		 */
   768		cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
   769	
   770		/* Initialize the FAU used for counting tx SKBs that need to be freed */
   771		cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
   772	
   773		if ((pow_send_group != -1)) {
   774			struct net_device *dev;
   775	
   776			dev = alloc_etherdev(sizeof(struct octeon_ethernet));
   777			if (dev) {
   778				/* Initialize the device private structure. */
   779				struct octeon_ethernet *priv = netdev_priv(dev);
   780	
   781				SET_NETDEV_DEV(dev, &pdev->dev);
   782				dev->netdev_ops = &cvm_oct_pow_netdev_ops;
   783				priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
   784				priv->port = CVMX_PIP_NUM_INPUT_PORTS;
   785				priv->queue = -1;
   786				strscpy(dev->name, "pow%d", sizeof(dev->name));
   787				for (qos = 0; qos < 16; qos++)
   788					skb_queue_head_init(&priv->tx_free_list[qos]);
   789				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   790				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   791	
   792				if (register_netdev(dev) < 0) {
   793					pr_err("Failed to register ethernet device for POW\n");
   794					free_netdev(dev);
   795				} else {
   796					cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
   797					pr_info("%s: POW send group %d, receive group %d\n",
   798						dev->name, pow_send_group,
   799						pow_receive_group);
   800				}
   801			} else {
   802				pr_err("Failed to allocate ethernet device for POW\n");
   803			}
   804		}
   805	
   806		num_interfaces = cvmx_helper_get_number_of_interfaces();
   807		for (interface = 0; interface < num_interfaces; interface++) {
   808			cvmx_helper_interface_mode_t imode =
   809			    cvmx_helper_interface_get_mode(interface);
   810			int num_ports = cvmx_helper_ports_on_interface(interface);
   811			int port;
   812			int port_index;
   813	
   814			for (port_index = 0,
   815			     port = cvmx_helper_get_ipd_port(interface, 0);
   816			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   817			     port_index++, port++) {
   818				struct octeon_ethernet *priv;
   819				struct net_device *dev =
   820				    alloc_etherdev(sizeof(struct octeon_ethernet));
   821				if (!dev) {
   822					pr_err("Failed to allocate ethernet device for port %d\n",
   823					       port);
   824					continue;
   825				}
   826	
   827				/* Initialize the device private structure. */
   828				SET_NETDEV_DEV(dev, &pdev->dev);
   829				priv = netdev_priv(dev);
   830				priv->netdev = dev;
   831				priv->of_node = cvm_oct_node_for_port(pip, interface,
   832								      port_index);
   833	
   834				INIT_DELAYED_WORK(&priv->port_periodic_work,
   835						  cvm_oct_periodic_worker);
   836				priv->imode = imode;
   837				priv->port = port;
   838				priv->queue = cvmx_pko_get_base_queue(priv->port);
   839				priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
   840				priv->phy_mode = PHY_INTERFACE_MODE_NA;
   841				for (qos = 0; qos < 16; qos++)
   842					skb_queue_head_init(&priv->tx_free_list[qos]);
   843				for (qos = 0; qos < cvmx_pko_get_num_queues(port);
   844				     qos++)
   845					cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
   846				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   847				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   848	
   849				switch (priv->imode) {
   850				/* These types don't support ports to IPD/PKO */
   851				case CVMX_HELPER_INTERFACE_MODE_DISABLED:
   852				case CVMX_HELPER_INTERFACE_MODE_PCIE:
   853				case CVMX_HELPER_INTERFACE_MODE_PICMG:
   854					break;
   855	
   856				case CVMX_HELPER_INTERFACE_MODE_NPI:
   857					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   858					strscpy(dev->name, "npi%d", sizeof(dev->name));
   859					break;
   860	
   861				case CVMX_HELPER_INTERFACE_MODE_XAUI:
   862					dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
   863					strscpy(dev->name, "xaui%d", sizeof(dev->name));
   864					break;
   865	
   866				case CVMX_HELPER_INTERFACE_MODE_LOOP:
   867					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   868					strscpy(dev->name, "loop%d", sizeof(dev->name));
   869					break;
   870	
   871				case CVMX_HELPER_INTERFACE_MODE_SGMII:
   872					priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
   873					dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
   874					strscpy(dev->name, "eth%d", sizeof(dev->name));
   875					break;
   876	
   877				case CVMX_HELPER_INTERFACE_MODE_SPI:
   878					dev->netdev_ops = &cvm_oct_spi_netdev_ops;
   879					strscpy(dev->name, "spi%d", sizeof(dev->name));
   880					break;
   881	
   882				case CVMX_HELPER_INTERFACE_MODE_GMII:
   883					priv->phy_mode = PHY_INTERFACE_MODE_GMII;
   884					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   885					strscpy(dev->name, "eth%d", sizeof(dev->name));
   886					break;
   887	
   888				case CVMX_HELPER_INTERFACE_MODE_RGMII:
   889					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   890					strscpy(dev->name, "eth%d", sizeof(dev->name));
   891					cvm_set_rgmii_delay(priv, interface,
   892							    port_index);
   893					break;
   894				}
   895	
   896				if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
 > 897					r = of_phy_register_fixed_link(priv->of_node);
   898					if (r) {
   899						netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
 > 900							   interface, priv->ipd_port);
   901						dev->netdev_ops = NULL;
   902					}
   903				}
   904	
   905				if (!dev->netdev_ops) {
   906					free_netdev(dev);
   907				} else if (register_netdev(dev) < 0) {
   908					pr_err("Failed to register ethernet device for interface %d, port %d\n",
   909					       interface, priv->port);
   910					free_netdev(dev);
   911				} else {
   912					cvm_oct_device[priv->port] = dev;
   913					fau -=
   914					    cvmx_pko_get_num_queues(priv->port) *
   915					    sizeof(u32);
   916					schedule_delayed_work(&priv->port_periodic_work,
   917							      HZ);
   918				}
   919			}
   920		}
   921	
   922		cvm_oct_tx_initialize();
   923		cvm_oct_rx_initialize();
   924	
   925		/*
   926		 * 150 uS: about 10 1500-byte packets at 1GE.
   927		 */
   928		cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
   929	
   930		schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
   931	
   932		return 0;
   933	}
   934	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40336 bytes --]

[-- Attachment #3: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] staging: octeon: repair "fixed-link" support
  2020-10-09  9:47 [PATCH] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
  2020-10-09 11:15 ` kernel test robot
@ 2020-10-09 13:09 ` Greg Kroah-Hartman
  2020-10-09 14:31 ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2020-10-09 13:09 UTC (permalink / raw)
  To: Alexander A Sverdlin
  Cc: devel, netdev, David S. Miller, Ralf Baechle, Aaro Koskinen

On Fri, Oct 09, 2020 at 11:47:39AM +0200, Alexander A Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> The PHYs must be registered once in device probe function, not in device
> open callback because it's only possible to register them once.
> 
> Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>

Looks like it breaks the build, please fix up and test your patches when
sending them out next time.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] staging: octeon: repair "fixed-link" support
  2020-10-09  9:47 [PATCH] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
@ 2020-10-09 11:15 ` kernel test robot
  2020-10-09 13:09 ` Greg Kroah-Hartman
  2020-10-09 14:31 ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2020-10-09 11:15 UTC (permalink / raw)
  To: Alexander A Sverdlin, devel
  Cc: kbuild-all, Aaro Koskinen, netdev, Ralf Baechle,
	Alexander Sverdlin, Greg Kroah-Hartman


[-- Attachment #1: Type: text/plain, Size: 10780 bytes --]

Hi Alexander,

I love your patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 76c3bdd67d27289b9e407113821eab2a70bbcca6
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/99d271d0a7dda48d064e12957a8846907220bf44
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
        git checkout 99d271d0a7dda48d064e12957a8846907220bf44
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/staging/octeon/ethernet.c: In function 'cvm_oct_probe':
>> drivers/staging/octeon/ethernet.c:897:5: error: 'r' undeclared (first use in this function); did you mean 'rq'?
     897 |     r = of_phy_register_fixed_link(priv->of_node);
         |     ^
         |     rq
   drivers/staging/octeon/ethernet.c:897:5: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/octeon/ethernet.c:900:25: error: 'struct octeon_ethernet' has no member named 'ipd_port'
     900 |          interface, priv->ipd_port);
         |                         ^~

vim +897 drivers/staging/octeon/ethernet.c

   692	
   693		pip = pdev->dev.of_node;
   694		if (!pip) {
   695			pr_err("Error: No 'pip' in /aliases\n");
   696			return -EINVAL;
   697		}
   698	
   699		cvm_oct_configure_common_hw();
   700	
   701		cvmx_helper_initialize_packet_io_global();
   702	
   703		if (receive_group_order) {
   704			if (receive_group_order > 4)
   705				receive_group_order = 4;
   706			pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
   707		} else {
   708			pow_receive_groups = BIT(pow_receive_group);
   709		}
   710	
   711		/* Change the input group for all ports before input is enabled */
   712		num_interfaces = cvmx_helper_get_number_of_interfaces();
   713		for (interface = 0; interface < num_interfaces; interface++) {
   714			int num_ports = cvmx_helper_ports_on_interface(interface);
   715			int port;
   716	
   717			for (port = cvmx_helper_get_ipd_port(interface, 0);
   718			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   719			     port++) {
   720				union cvmx_pip_prt_tagx pip_prt_tagx;
   721	
   722				pip_prt_tagx.u64 =
   723				    cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
   724	
   725				if (receive_group_order) {
   726					int tag_mask;
   727	
   728					/* We support only 16 groups at the moment, so
   729					 * always disable the two additional "hidden"
   730					 * tag_mask bits on CN68XX.
   731					 */
   732					if (OCTEON_IS_MODEL(OCTEON_CN68XX))
   733						pip_prt_tagx.u64 |= 0x3ull << 44;
   734	
   735					tag_mask = ~((1 << receive_group_order) - 1);
   736					pip_prt_tagx.s.grptagbase	= 0;
   737					pip_prt_tagx.s.grptagmask	= tag_mask;
   738					pip_prt_tagx.s.grptag		= 1;
   739					pip_prt_tagx.s.tag_mode		= 0;
   740					pip_prt_tagx.s.inc_prt_flag	= 1;
   741					pip_prt_tagx.s.ip6_dprt_flag	= 1;
   742					pip_prt_tagx.s.ip4_dprt_flag	= 1;
   743					pip_prt_tagx.s.ip6_sprt_flag	= 1;
   744					pip_prt_tagx.s.ip4_sprt_flag	= 1;
   745					pip_prt_tagx.s.ip6_dst_flag	= 1;
   746					pip_prt_tagx.s.ip4_dst_flag	= 1;
   747					pip_prt_tagx.s.ip6_src_flag	= 1;
   748					pip_prt_tagx.s.ip4_src_flag	= 1;
   749					pip_prt_tagx.s.grp		= 0;
   750				} else {
   751					pip_prt_tagx.s.grptag	= 0;
   752					pip_prt_tagx.s.grp	= pow_receive_group;
   753				}
   754	
   755				cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
   756					       pip_prt_tagx.u64);
   757			}
   758		}
   759	
   760		cvmx_helper_ipd_and_packet_input_enable();
   761	
   762		memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
   763	
   764		/*
   765		 * Initialize the FAU used for counting packet buffers that
   766		 * need to be freed.
   767		 */
   768		cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
   769	
   770		/* Initialize the FAU used for counting tx SKBs that need to be freed */
   771		cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
   772	
   773		if ((pow_send_group != -1)) {
   774			struct net_device *dev;
   775	
   776			dev = alloc_etherdev(sizeof(struct octeon_ethernet));
   777			if (dev) {
   778				/* Initialize the device private structure. */
   779				struct octeon_ethernet *priv = netdev_priv(dev);
   780	
   781				SET_NETDEV_DEV(dev, &pdev->dev);
   782				dev->netdev_ops = &cvm_oct_pow_netdev_ops;
   783				priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
   784				priv->port = CVMX_PIP_NUM_INPUT_PORTS;
   785				priv->queue = -1;
   786				strscpy(dev->name, "pow%d", sizeof(dev->name));
   787				for (qos = 0; qos < 16; qos++)
   788					skb_queue_head_init(&priv->tx_free_list[qos]);
   789				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   790				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   791	
   792				if (register_netdev(dev) < 0) {
   793					pr_err("Failed to register ethernet device for POW\n");
   794					free_netdev(dev);
   795				} else {
   796					cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
   797					pr_info("%s: POW send group %d, receive group %d\n",
   798						dev->name, pow_send_group,
   799						pow_receive_group);
   800				}
   801			} else {
   802				pr_err("Failed to allocate ethernet device for POW\n");
   803			}
   804		}
   805	
   806		num_interfaces = cvmx_helper_get_number_of_interfaces();
   807		for (interface = 0; interface < num_interfaces; interface++) {
   808			cvmx_helper_interface_mode_t imode =
   809			    cvmx_helper_interface_get_mode(interface);
   810			int num_ports = cvmx_helper_ports_on_interface(interface);
   811			int port;
   812			int port_index;
   813	
   814			for (port_index = 0,
   815			     port = cvmx_helper_get_ipd_port(interface, 0);
   816			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   817			     port_index++, port++) {
   818				struct octeon_ethernet *priv;
   819				struct net_device *dev =
   820				    alloc_etherdev(sizeof(struct octeon_ethernet));
   821				if (!dev) {
   822					pr_err("Failed to allocate ethernet device for port %d\n",
   823					       port);
   824					continue;
   825				}
   826	
   827				/* Initialize the device private structure. */
   828				SET_NETDEV_DEV(dev, &pdev->dev);
   829				priv = netdev_priv(dev);
   830				priv->netdev = dev;
   831				priv->of_node = cvm_oct_node_for_port(pip, interface,
   832								      port_index);
   833	
   834				INIT_DELAYED_WORK(&priv->port_periodic_work,
   835						  cvm_oct_periodic_worker);
   836				priv->imode = imode;
   837				priv->port = port;
   838				priv->queue = cvmx_pko_get_base_queue(priv->port);
   839				priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
   840				priv->phy_mode = PHY_INTERFACE_MODE_NA;
   841				for (qos = 0; qos < 16; qos++)
   842					skb_queue_head_init(&priv->tx_free_list[qos]);
   843				for (qos = 0; qos < cvmx_pko_get_num_queues(port);
   844				     qos++)
   845					cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
   846				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   847				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   848	
   849				switch (priv->imode) {
   850				/* These types don't support ports to IPD/PKO */
   851				case CVMX_HELPER_INTERFACE_MODE_DISABLED:
   852				case CVMX_HELPER_INTERFACE_MODE_PCIE:
   853				case CVMX_HELPER_INTERFACE_MODE_PICMG:
   854					break;
   855	
   856				case CVMX_HELPER_INTERFACE_MODE_NPI:
   857					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   858					strscpy(dev->name, "npi%d", sizeof(dev->name));
   859					break;
   860	
   861				case CVMX_HELPER_INTERFACE_MODE_XAUI:
   862					dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
   863					strscpy(dev->name, "xaui%d", sizeof(dev->name));
   864					break;
   865	
   866				case CVMX_HELPER_INTERFACE_MODE_LOOP:
   867					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   868					strscpy(dev->name, "loop%d", sizeof(dev->name));
   869					break;
   870	
   871				case CVMX_HELPER_INTERFACE_MODE_SGMII:
   872					priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
   873					dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
   874					strscpy(dev->name, "eth%d", sizeof(dev->name));
   875					break;
   876	
   877				case CVMX_HELPER_INTERFACE_MODE_SPI:
   878					dev->netdev_ops = &cvm_oct_spi_netdev_ops;
   879					strscpy(dev->name, "spi%d", sizeof(dev->name));
   880					break;
   881	
   882				case CVMX_HELPER_INTERFACE_MODE_GMII:
   883					priv->phy_mode = PHY_INTERFACE_MODE_GMII;
   884					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   885					strscpy(dev->name, "eth%d", sizeof(dev->name));
   886					break;
   887	
   888				case CVMX_HELPER_INTERFACE_MODE_RGMII:
   889					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   890					strscpy(dev->name, "eth%d", sizeof(dev->name));
   891					cvm_set_rgmii_delay(priv, interface,
   892							    port_index);
   893					break;
   894				}
   895	
   896				if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
 > 897					r = of_phy_register_fixed_link(priv->of_node);
   898					if (r) {
   899						netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
 > 900							   interface, priv->ipd_port);
   901						dev->netdev_ops = NULL;
   902					}
   903				}
   904	
   905				if (!dev->netdev_ops) {
   906					free_netdev(dev);
   907				} else if (register_netdev(dev) < 0) {
   908					pr_err("Failed to register ethernet device for interface %d, port %d\n",
   909					       interface, priv->port);
   910					free_netdev(dev);
   911				} else {
   912					cvm_oct_device[priv->port] = dev;
   913					fau -=
   914					    cvmx_pko_get_num_queues(priv->port) *
   915					    sizeof(u32);
   916					schedule_delayed_work(&priv->port_periodic_work,
   917							      HZ);
   918				}
   919			}
   920		}
   921	
   922		cvm_oct_tx_initialize();
   923		cvm_oct_rx_initialize();
   924	
   925		/*
   926		 * 150 uS: about 10 1500-byte packets at 1GE.
   927		 */
   928		cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
   929	
   930		schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
   931	
   932		return 0;
   933	}
   934	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 75939 bytes --]

[-- Attachment #3: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] staging: octeon: repair "fixed-link" support
  2020-10-09  9:40 ` Alexander Sverdlin
@ 2020-10-09  9:54   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2020-10-09  9:54 UTC (permalink / raw)
  To: Alexander Sverdlin
  Cc: devel, netdev, David S. Miller, Ralf Baechle, Aaro Koskinen

On Fri, Oct 09, 2020 at 11:40:24AM +0200, Alexander Sverdlin wrote:
> Hello Greg, Dave and all,
> 
> the below patch is still applicable as-is, would you please re-consider it now,
> as the driver has been undeleted?
> 
> On 08/01/2020 17:09, Alexander X Sverdlin wrote:

Why would we have a patch from January still in our inboxes? :)

Please resend.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] staging: octeon: repair "fixed-link" support
@ 2020-10-09  9:47 Alexander A Sverdlin
  2020-10-09 11:15 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Alexander A Sverdlin @ 2020-10-09  9:47 UTC (permalink / raw)
  To: devel
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Ralf Baechle,
	Alexander Sverdlin, netdev, David S. Miller

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

The PHYs must be registered once in device probe function, not in device
open callback because it's only possible to register them once.

Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 drivers/staging/octeon/ethernet-mdio.c |  6 ------
 drivers/staging/octeon/ethernet.c      | 10 ++++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index cfb673a..0bf54584 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -147,12 +147,6 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
 
 	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
 	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-		int rc;
-
-		rc = of_phy_register_fixed_link(priv->of_node);
-		if (rc)
-			return rc;
-
 		phy_node = of_node_get(priv->of_node);
 	}
 	if (!phy_node)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 204f0b1..2b0d05d 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -13,6 +13,7 @@
 #include <linux/phy.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/of_mdio.h>
 #include <linux/of_net.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
@@ -892,6 +893,15 @@ static int cvm_oct_probe(struct platform_device *pdev)
 				break;
 			}
 
+			if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
+				r = of_phy_register_fixed_link(priv->of_node);
+				if (r) {
+					netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
+						   interface, priv->ipd_port);
+					dev->netdev_ops = NULL;
+				}
+			}
+
 			if (!dev->netdev_ops) {
 				free_netdev(dev);
 			} else if (register_netdev(dev) < 0) {
-- 
2.10.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] staging: octeon: repair "fixed-link" support
  2020-01-08 16:09 Alexander X Sverdlin
@ 2020-10-09  9:40 ` Alexander Sverdlin
  2020-10-09  9:54   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Alexander Sverdlin @ 2020-10-09  9:40 UTC (permalink / raw)
  To: devel
  Cc: Greg Kroah-Hartman, netdev, David S. Miller, Ralf Baechle, Aaro Koskinen

Hello Greg, Dave and all,

the below patch is still applicable as-is, would you please re-consider it now,
as the driver has been undeleted?

On 08/01/2020 17:09, Alexander X Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> The PHYs must be registered once in device probe function, not in device
> open callback because it's only possible to register them once.
> 
> Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
>  drivers/staging/octeon/ethernet-mdio.c |  6 ------
>  drivers/staging/octeon/ethernet.c      | 11 +++++++++++
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
> index c798672..d81bddf 100644
> --- a/drivers/staging/octeon/ethernet-mdio.c
> +++ b/drivers/staging/octeon/ethernet-mdio.c
> @@ -147,12 +147,6 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
>  
>  	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
>  	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
> -		int rc;
> -
> -		rc = of_phy_register_fixed_link(priv->of_node);
> -		if (rc)
> -			return rc;
> -
>  		phy_node = of_node_get(priv->of_node);
>  	}
>  	if (!phy_node)
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> index f42c381..241a1db 100644
> --- a/drivers/staging/octeon/ethernet.c
> +++ b/drivers/staging/octeon/ethernet.c
> @@ -13,6 +13,7 @@
>  #include <linux/phy.h>
>  #include <linux/slab.h>
>  #include <linux/interrupt.h>
> +#include <linux/of_mdio.h>
>  #include <linux/of_net.h>
>  #include <linux/if_ether.h>
>  #include <linux/if_vlan.h>
> @@ -894,6 +895,16 @@ static int cvm_oct_probe(struct platform_device *pdev)
>  				break;
>  			}
>  
> +			if (priv->of_node &&
> +			    of_phy_is_fixed_link(priv->of_node)) {
> +				r = of_phy_register_fixed_link(priv->of_node);
> +				if (r) {
> +					netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
> +						   interface, priv->ipd_port);
> +					dev->netdev_ops = NULL;
> +				}
> +			}
> +
>  			if (!dev->netdev_ops) {
>  				free_netdev(dev);
>  			} else if (register_netdev(dev) < 0) {
> 

-- 
Best regards,
Alexander Sverdlin.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] staging: octeon: repair "fixed-link" support
@ 2020-01-08 16:09 Alexander X Sverdlin
  2020-10-09  9:40 ` Alexander Sverdlin
  0 siblings, 1 reply; 11+ messages in thread
From: Alexander X Sverdlin @ 2020-01-08 16:09 UTC (permalink / raw)
  To: devel
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Ralf Baechle,
	Alexander Sverdlin, netdev, David S. Miller

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

The PHYs must be registered once in device probe function, not in device
open callback because it's only possible to register them once.

Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 drivers/staging/octeon/ethernet-mdio.c |  6 ------
 drivers/staging/octeon/ethernet.c      | 11 +++++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index c798672..d81bddf 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -147,12 +147,6 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
 
 	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
 	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-		int rc;
-
-		rc = of_phy_register_fixed_link(priv->of_node);
-		if (rc)
-			return rc;
-
 		phy_node = of_node_get(priv->of_node);
 	}
 	if (!phy_node)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index f42c381..241a1db 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -13,6 +13,7 @@
 #include <linux/phy.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/of_mdio.h>
 #include <linux/of_net.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
@@ -894,6 +895,16 @@ static int cvm_oct_probe(struct platform_device *pdev)
 				break;
 			}
 
+			if (priv->of_node &&
+			    of_phy_is_fixed_link(priv->of_node)) {
+				r = of_phy_register_fixed_link(priv->of_node);
+				if (r) {
+					netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
+						   interface, priv->ipd_port);
+					dev->netdev_ops = NULL;
+				}
+			}
+
 			if (!dev->netdev_ops) {
 				free_netdev(dev);
 			} else if (register_netdev(dev) < 0) {
-- 
2.4.6

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  9:46 [PATCH] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
2020-10-09  9:46 ` [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error Alexander A Sverdlin
2020-10-09 12:24   ` Dan Carpenter
2020-10-12 12:23     ` Alexander Sverdlin
  -- strict thread matches above, loose matches on Subject: below --
2020-10-09  9:47 [PATCH] staging: octeon: repair "fixed-link" support Alexander A Sverdlin
2020-10-09 11:15 ` kernel test robot
2020-10-09 13:09 ` Greg Kroah-Hartman
2020-10-09 14:31 ` kernel test robot
2020-01-08 16:09 Alexander X Sverdlin
2020-10-09  9:40 ` Alexander Sverdlin
2020-10-09  9:54   ` Greg Kroah-Hartman

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git