linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1] net: mhi : Add support to enable ethernet interface
@ 2023-06-30  9:44 Vivek Pernamitta
  2023-06-30  9:55 ` Vivek Pernamitta
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Vivek Pernamitta @ 2023-06-30  9:44 UTC (permalink / raw)
  To: mhi
  Cc: mrana, quic_qianyu, manivannan.sadhasivam, Vivek Pernamitta,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:NETWORKING DRIVERS, open list

Add support to enable ethernet interface for MHI SWIP channels.

Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>
---
 drivers/net/mhi_net.c | 53 ++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index 3d322ac..0a47e15 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -11,6 +11,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/u64_stats_sync.h>
+#include <linux/etherdevice.h>
 
 #define MHI_NET_MIN_MTU		ETH_MIN_MTU
 #define MHI_NET_MAX_MTU		0xffff
@@ -38,10 +39,12 @@ struct mhi_net_dev {
 	u32 rx_queue_sz;
 	int msg_enable;
 	unsigned int mru;
+	bool ethernet_if;
 };
 
 struct mhi_device_info {
 	const char *netname;
+	bool ethernet_if;
 };
 
 static int mhi_ndo_open(struct net_device *ndev)
@@ -140,6 +143,14 @@ static void mhi_net_setup(struct net_device *ndev)
 	ndev->tx_queue_len = 1000;
 }
 
+static void mhi_ethernet_setup(struct net_device *ndev)
+{
+	ndev->netdev_ops = &mhi_netdev_ops;
+	ether_setup(ndev);
+	ndev->min_mtu = ETH_MIN_MTU;
+	ndev->max_mtu = ETH_MAX_MTU;
+}
+
 static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
 				       struct sk_buff *skb)
 {
@@ -209,16 +220,22 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
 			mhi_netdev->skbagg_head = NULL;
 		}
 
-		switch (skb->data[0] & 0xf0) {
-		case 0x40:
-			skb->protocol = htons(ETH_P_IP);
-			break;
-		case 0x60:
-			skb->protocol = htons(ETH_P_IPV6);
-			break;
-		default:
-			skb->protocol = htons(ETH_P_MAP);
-			break;
+		if (mhi_netdev->ethernet_if) {
+			skb_copy_to_linear_data(skb, skb->data,
+						mhi_res->bytes_xferd);
+			skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
+		} else {
+			switch (skb->data[0] & 0xf0) {
+			case 0x40:
+				skb->protocol = htons(ETH_P_IP);
+				break;
+			case 0x60:
+				skb->protocol = htons(ETH_P_IPV6);
+				break;
+			default:
+				skb->protocol = htons(ETH_P_MAP);
+				break;
+			}
 		}
 
 		u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
@@ -301,11 +318,17 @@ static void mhi_net_rx_refill_work(struct work_struct *work)
 		schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2);
 }
 
-static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
+static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
 {
 	struct mhi_net_dev *mhi_netdev;
 	int err;
 
+	if (eth_dev) {
+		eth_random_addr(ndev->dev_addr);
+		if (!is_valid_ether_addr(ndev->dev_addr))
+			return -EADDRNOTAVAIL;
+	}
+
 	mhi_netdev = netdev_priv(ndev);
 
 	dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
@@ -313,6 +336,7 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
 	mhi_netdev->mdev = mhi_dev;
 	mhi_netdev->skbagg_head = NULL;
 	mhi_netdev->mru = mhi_dev->mhi_cntrl->mru;
+	mhi_netdev->ethernet_if = eth_dev;
 
 	INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
 	u64_stats_init(&mhi_netdev->stats.rx_syncp);
@@ -356,13 +380,14 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
 	int err;
 
 	ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
-			    NET_NAME_PREDICTABLE, mhi_net_setup);
+			    NET_NAME_PREDICTABLE, info->ethernet_if ?
+			    mhi_ethernet_setup : mhi_net_setup);
 	if (!ndev)
 		return -ENOMEM;
 
 	SET_NETDEV_DEV(ndev, &mhi_dev->dev);
 
-	err = mhi_net_newlink(mhi_dev, ndev);
+	err = mhi_net_newlink(mhi_dev, ndev, info->ethernet_if);
 	if (err) {
 		free_netdev(ndev);
 		return err;
@@ -380,10 +405,12 @@ static void mhi_net_remove(struct mhi_device *mhi_dev)
 
 static const struct mhi_device_info mhi_hwip0 = {
 	.netname = "mhi_hwip%d",
+	.ethernet_if = false,
 };
 
 static const struct mhi_device_info mhi_swip0 = {
 	.netname = "mhi_swip%d",
+	.ethernet_if = false,
 };
 
 static const struct mhi_device_id mhi_net_id_table[] = {
-- 
2.7.4


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

* Re: [PATCH V1] net: mhi : Add support to enable ethernet interface
  2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
@ 2023-06-30  9:55 ` Vivek Pernamitta
  2023-06-30 11:55 ` Daniele Palmas
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vivek Pernamitta @ 2023-06-30  9:55 UTC (permalink / raw)
  To: mhi
  Cc: mrana, quic_qianyu, manivannan.sadhasivam, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:NETWORKING DRIVERS, open list, quic_krichai,
	quic_vbadigan, linux-arm-msm


On 6/30/2023 3:14 PM, Vivek Pernamitta wrote:
> Add support to enable ethernet interface for MHI SWIP channels.
>
> Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>
> ---
>   drivers/net/mhi_net.c | 53 ++++++++++++++++++++++++++++++++++++++-------------
>   1 file changed, 40 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
> index 3d322ac..0a47e15 100644
> --- a/drivers/net/mhi_net.c
> +++ b/drivers/net/mhi_net.c
> @@ -11,6 +11,7 @@
>   #include <linux/netdevice.h>
>   #include <linux/skbuff.h>
>   #include <linux/u64_stats_sync.h>
> +#include <linux/etherdevice.h>
>   
>   #define MHI_NET_MIN_MTU		ETH_MIN_MTU
>   #define MHI_NET_MAX_MTU		0xffff
> @@ -38,10 +39,12 @@ struct mhi_net_dev {
>   	u32 rx_queue_sz;
>   	int msg_enable;
>   	unsigned int mru;
> +	bool ethernet_if;
>   };
>   
>   struct mhi_device_info {
>   	const char *netname;
> +	bool ethernet_if;
>   };
>   
>   static int mhi_ndo_open(struct net_device *ndev)
> @@ -140,6 +143,14 @@ static void mhi_net_setup(struct net_device *ndev)
>   	ndev->tx_queue_len = 1000;
>   }
>   
> +static void mhi_ethernet_setup(struct net_device *ndev)
> +{
> +	ndev->netdev_ops = &mhi_netdev_ops;
> +	ether_setup(ndev);
> +	ndev->min_mtu = ETH_MIN_MTU;
> +	ndev->max_mtu = ETH_MAX_MTU;
> +}
> +
>   static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
>   				       struct sk_buff *skb)
>   {
> @@ -209,16 +220,22 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
>   			mhi_netdev->skbagg_head = NULL;
>   		}
>   
> -		switch (skb->data[0] & 0xf0) {
> -		case 0x40:
> -			skb->protocol = htons(ETH_P_IP);
> -			break;
> -		case 0x60:
> -			skb->protocol = htons(ETH_P_IPV6);
> -			break;
> -		default:
> -			skb->protocol = htons(ETH_P_MAP);
> -			break;
> +		if (mhi_netdev->ethernet_if) {
> +			skb_copy_to_linear_data(skb, skb->data,
> +						mhi_res->bytes_xferd);
> +			skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
> +		} else {
> +			switch (skb->data[0] & 0xf0) {
> +			case 0x40:
> +				skb->protocol = htons(ETH_P_IP);
> +				break;
> +			case 0x60:
> +				skb->protocol = htons(ETH_P_IPV6);
> +				break;
> +			default:
> +				skb->protocol = htons(ETH_P_MAP);
> +				break;
> +			}
>   		}
>   
>   		u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
> @@ -301,11 +318,17 @@ static void mhi_net_rx_refill_work(struct work_struct *work)
>   		schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2);
>   }
>   
> -static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
> +static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
>   {
>   	struct mhi_net_dev *mhi_netdev;
>   	int err;
>   
> +	if (eth_dev) {
> +		eth_random_addr(ndev->dev_addr);
> +		if (!is_valid_ether_addr(ndev->dev_addr))
> +			return -EADDRNOTAVAIL;
> +	}
> +
>   	mhi_netdev = netdev_priv(ndev);
>   
>   	dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
> @@ -313,6 +336,7 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
>   	mhi_netdev->mdev = mhi_dev;
>   	mhi_netdev->skbagg_head = NULL;
>   	mhi_netdev->mru = mhi_dev->mhi_cntrl->mru;
> +	mhi_netdev->ethernet_if = eth_dev;
>   
>   	INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
>   	u64_stats_init(&mhi_netdev->stats.rx_syncp);
> @@ -356,13 +380,14 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
>   	int err;
>   
>   	ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
> -			    NET_NAME_PREDICTABLE, mhi_net_setup);
> +			    NET_NAME_PREDICTABLE, info->ethernet_if ?
> +			    mhi_ethernet_setup : mhi_net_setup);
>   	if (!ndev)
>   		return -ENOMEM;
>   
>   	SET_NETDEV_DEV(ndev, &mhi_dev->dev);
>   
> -	err = mhi_net_newlink(mhi_dev, ndev);
> +	err = mhi_net_newlink(mhi_dev, ndev, info->ethernet_if);
>   	if (err) {
>   		free_netdev(ndev);
>   		return err;
> @@ -380,10 +405,12 @@ static void mhi_net_remove(struct mhi_device *mhi_dev)
>   
>   static const struct mhi_device_info mhi_hwip0 = {
>   	.netname = "mhi_hwip%d",
> +	.ethernet_if = false,
>   };
>   
>   static const struct mhi_device_info mhi_swip0 = {
>   	.netname = "mhi_swip%d",
> +	.ethernet_if = false,
>   };
>   
>   static const struct mhi_device_id mhi_net_id_table[] = {

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

* Re: [PATCH V1] net: mhi : Add support to enable ethernet interface
  2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
  2023-06-30  9:55 ` Vivek Pernamitta
@ 2023-06-30 11:55 ` Daniele Palmas
  2023-06-30 13:13 ` Simon Horman
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Daniele Palmas @ 2023-06-30 11:55 UTC (permalink / raw)
  To: Vivek Pernamitta
  Cc: mhi, mrana, quic_qianyu, manivannan.sadhasivam, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:NETWORKING DRIVERS, open list

Hello Vivek,

Il giorno ven 30 giu 2023 alle ore 11:45 Vivek Pernamitta
<quic_vpernami@quicinc.com> ha scritto:
>
> Add support to enable ethernet interface for MHI SWIP channels.
>

Shouldn't this be targeting net-next (currently closed) ?

Anyway, I'm mainly replying since I'm interested in this topic and
would like to be copied in related future submissions.

Thanks,
Daniele

> Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>
> ---
>  drivers/net/mhi_net.c | 53 ++++++++++++++++++++++++++++++++++++++-------------
>  1 file changed, 40 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
> index 3d322ac..0a47e15 100644
> --- a/drivers/net/mhi_net.c
> +++ b/drivers/net/mhi_net.c
> @@ -11,6 +11,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/skbuff.h>
>  #include <linux/u64_stats_sync.h>
> +#include <linux/etherdevice.h>
>
>  #define MHI_NET_MIN_MTU                ETH_MIN_MTU
>  #define MHI_NET_MAX_MTU                0xffff
> @@ -38,10 +39,12 @@ struct mhi_net_dev {
>         u32 rx_queue_sz;
>         int msg_enable;
>         unsigned int mru;
> +       bool ethernet_if;
>  };
>
>  struct mhi_device_info {
>         const char *netname;
> +       bool ethernet_if;
>  };
>
>  static int mhi_ndo_open(struct net_device *ndev)
> @@ -140,6 +143,14 @@ static void mhi_net_setup(struct net_device *ndev)
>         ndev->tx_queue_len = 1000;
>  }
>
> +static void mhi_ethernet_setup(struct net_device *ndev)
> +{
> +       ndev->netdev_ops = &mhi_netdev_ops;
> +       ether_setup(ndev);
> +       ndev->min_mtu = ETH_MIN_MTU;
> +       ndev->max_mtu = ETH_MAX_MTU;
> +}
> +
>  static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
>                                        struct sk_buff *skb)
>  {
> @@ -209,16 +220,22 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
>                         mhi_netdev->skbagg_head = NULL;
>                 }
>
> -               switch (skb->data[0] & 0xf0) {
> -               case 0x40:
> -                       skb->protocol = htons(ETH_P_IP);
> -                       break;
> -               case 0x60:
> -                       skb->protocol = htons(ETH_P_IPV6);
> -                       break;
> -               default:
> -                       skb->protocol = htons(ETH_P_MAP);
> -                       break;
> +               if (mhi_netdev->ethernet_if) {
> +                       skb_copy_to_linear_data(skb, skb->data,
> +                                               mhi_res->bytes_xferd);
> +                       skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
> +               } else {
> +                       switch (skb->data[0] & 0xf0) {
> +                       case 0x40:
> +                               skb->protocol = htons(ETH_P_IP);
> +                               break;
> +                       case 0x60:
> +                               skb->protocol = htons(ETH_P_IPV6);
> +                               break;
> +                       default:
> +                               skb->protocol = htons(ETH_P_MAP);
> +                               break;
> +                       }
>                 }
>
>                 u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
> @@ -301,11 +318,17 @@ static void mhi_net_rx_refill_work(struct work_struct *work)
>                 schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2);
>  }
>
> -static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
> +static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
>  {
>         struct mhi_net_dev *mhi_netdev;
>         int err;
>
> +       if (eth_dev) {
> +               eth_random_addr(ndev->dev_addr);
> +               if (!is_valid_ether_addr(ndev->dev_addr))
> +                       return -EADDRNOTAVAIL;
> +       }
> +
>         mhi_netdev = netdev_priv(ndev);
>
>         dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
> @@ -313,6 +336,7 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
>         mhi_netdev->mdev = mhi_dev;
>         mhi_netdev->skbagg_head = NULL;
>         mhi_netdev->mru = mhi_dev->mhi_cntrl->mru;
> +       mhi_netdev->ethernet_if = eth_dev;
>
>         INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
>         u64_stats_init(&mhi_netdev->stats.rx_syncp);
> @@ -356,13 +380,14 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
>         int err;
>
>         ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
> -                           NET_NAME_PREDICTABLE, mhi_net_setup);
> +                           NET_NAME_PREDICTABLE, info->ethernet_if ?
> +                           mhi_ethernet_setup : mhi_net_setup);
>         if (!ndev)
>                 return -ENOMEM;
>
>         SET_NETDEV_DEV(ndev, &mhi_dev->dev);
>
> -       err = mhi_net_newlink(mhi_dev, ndev);
> +       err = mhi_net_newlink(mhi_dev, ndev, info->ethernet_if);
>         if (err) {
>                 free_netdev(ndev);
>                 return err;
> @@ -380,10 +405,12 @@ static void mhi_net_remove(struct mhi_device *mhi_dev)
>
>  static const struct mhi_device_info mhi_hwip0 = {
>         .netname = "mhi_hwip%d",
> +       .ethernet_if = false,
>  };
>
>  static const struct mhi_device_info mhi_swip0 = {
>         .netname = "mhi_swip%d",
> +       .ethernet_if = false,
>  };
>
>  static const struct mhi_device_id mhi_net_id_table[] = {
> --
> 2.7.4
>
>

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

* Re: [PATCH V1] net: mhi : Add support to enable ethernet interface
  2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
  2023-06-30  9:55 ` Vivek Pernamitta
  2023-06-30 11:55 ` Daniele Palmas
@ 2023-06-30 13:13 ` Simon Horman
  2023-06-30 13:46 ` kernel test robot
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-06-30 13:13 UTC (permalink / raw)
  To: Vivek Pernamitta
  Cc: mhi, mrana, quic_qianyu, manivannan.sadhasivam, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:NETWORKING DRIVERS, open list

On Fri, Jun 30, 2023 at 03:14:41PM +0530, Vivek Pernamitta wrote:
> Add support to enable ethernet interface for MHI SWIP channels.
> 
> Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>

...

> @@ -301,11 +318,17 @@ static void mhi_net_rx_refill_work(struct work_struct *work)
>  		schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2);
>  }
>  
> -static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
> +static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
>  {
>  	struct mhi_net_dev *mhi_netdev;
>  	int err;
>  
> +	if (eth_dev) {
> +		eth_random_addr(ndev->dev_addr);
> +		if (!is_valid_ether_addr(ndev->dev_addr))
> +			return -EADDRNOTAVAIL;
> +	}

Hi Vivek,

This doesn't seem right.
As GCC points out, dev_addr is const.
And I don't think eth_random_addr() produces invalid addresses.

Perhaps you want eth_hw_addr_random() here.

As was mentioned elsewhere in this thread, net-next, is closed.
So please post a v2 once it re-opens, after 10th July.

-- 
pw-bot: changes-requested


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

* Re: [PATCH V1] net: mhi : Add support to enable ethernet interface
  2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
                   ` (2 preceding siblings ...)
  2023-06-30 13:13 ` Simon Horman
@ 2023-06-30 13:46 ` kernel test robot
  2023-07-02 13:37 ` kernel test robot
  2023-07-11  7:50 ` kernel test robot
  5 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-06-30 13:46 UTC (permalink / raw)
  To: Vivek Pernamitta, mhi
  Cc: oe-kbuild-all, mrana, quic_qianyu, manivannan.sadhasivam,
	Vivek Pernamitta, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

Hi Vivek,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v6.4 next-20230630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vivek-Pernamitta/net-mhi-Add-support-to-enable-ethernet-interface/20230630-174659
base:   net-next/main
patch link:    https://lore.kernel.org/r/1688118281-13032-1-git-send-email-quic_vpernami%40quicinc.com
patch subject: [PATCH V1] net: mhi : Add support to enable ethernet interface
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230630/202306302115.IYBBlrFn-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230630/202306302115.IYBBlrFn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306302115.IYBBlrFn-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/mhi_net.c: In function 'mhi_net_newlink':
>> drivers/net/mhi_net.c:327:37: warning: passing argument 1 of 'eth_random_addr' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     327 |                 eth_random_addr(ndev->dev_addr);
         |                                 ~~~~^~~~~~~~~~
   In file included from drivers/net/mhi_net.c:14:
   include/linux/etherdevice.h:230:40: note: expected 'u8 *' {aka 'unsigned char *'} but argument is of type 'const unsigned char *'
     230 | static inline void eth_random_addr(u8 *addr)
         |                                    ~~~~^~~~


vim +327 drivers/net/mhi_net.c

   320	
   321	static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
   322	{
   323		struct mhi_net_dev *mhi_netdev;
   324		int err;
   325	
   326		if (eth_dev) {
 > 327			eth_random_addr(ndev->dev_addr);
   328			if (!is_valid_ether_addr(ndev->dev_addr))
   329				return -EADDRNOTAVAIL;
   330		}
   331	
   332		mhi_netdev = netdev_priv(ndev);
   333	
   334		dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
   335		mhi_netdev->ndev = ndev;
   336		mhi_netdev->mdev = mhi_dev;
   337		mhi_netdev->skbagg_head = NULL;
   338		mhi_netdev->mru = mhi_dev->mhi_cntrl->mru;
   339		mhi_netdev->ethernet_if = eth_dev;
   340	
   341		INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
   342		u64_stats_init(&mhi_netdev->stats.rx_syncp);
   343		u64_stats_init(&mhi_netdev->stats.tx_syncp);
   344	
   345		/* Start MHI channels */
   346		err = mhi_prepare_for_transfer(mhi_dev);
   347		if (err)
   348			return err;
   349	
   350		/* Number of transfer descriptors determines size of the queue */
   351		mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
   352	
   353		err = register_netdev(ndev);
   354		if (err)
   355			return err;
   356	
   357		return 0;
   358	}
   359	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH V1] net: mhi : Add support to enable ethernet interface
  2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
                   ` (3 preceding siblings ...)
  2023-06-30 13:46 ` kernel test robot
@ 2023-07-02 13:37 ` kernel test robot
  2023-07-11  7:50 ` kernel test robot
  5 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-07-02 13:37 UTC (permalink / raw)
  To: Vivek Pernamitta, mhi
  Cc: oe-kbuild-all, mrana, quic_qianyu, manivannan.sadhasivam,
	Vivek Pernamitta, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

Hi Vivek,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v6.4 next-20230630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vivek-Pernamitta/net-mhi-Add-support-to-enable-ethernet-interface/20230630-174659
base:   net-next/main
patch link:    https://lore.kernel.org/r/1688118281-13032-1-git-send-email-quic_vpernami%40quicinc.com
patch subject: [PATCH V1] net: mhi : Add support to enable ethernet interface
config: i386-randconfig-i062-20230702 (https://download.01.org/0day-ci/archive/20230702/202307022148.nlp4Fazk-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230702/202307022148.nlp4Fazk-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307022148.nlp4Fazk-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/mhi_net.c:327:37: sparse: sparse: incorrect type in argument 1 (different modifiers) @@     expected unsigned char [usertype] *addr @@     got unsigned char const *dev_addr @@
   drivers/net/mhi_net.c:327:37: sparse:     expected unsigned char [usertype] *addr
   drivers/net/mhi_net.c:327:37: sparse:     got unsigned char const *dev_addr

vim +327 drivers/net/mhi_net.c

   320	
   321	static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
   322	{
   323		struct mhi_net_dev *mhi_netdev;
   324		int err;
   325	
   326		if (eth_dev) {
 > 327			eth_random_addr(ndev->dev_addr);
   328			if (!is_valid_ether_addr(ndev->dev_addr))
   329				return -EADDRNOTAVAIL;
   330		}
   331	
   332		mhi_netdev = netdev_priv(ndev);
   333	
   334		dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
   335		mhi_netdev->ndev = ndev;
   336		mhi_netdev->mdev = mhi_dev;
   337		mhi_netdev->skbagg_head = NULL;
   338		mhi_netdev->mru = mhi_dev->mhi_cntrl->mru;
   339		mhi_netdev->ethernet_if = eth_dev;
   340	
   341		INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
   342		u64_stats_init(&mhi_netdev->stats.rx_syncp);
   343		u64_stats_init(&mhi_netdev->stats.tx_syncp);
   344	
   345		/* Start MHI channels */
   346		err = mhi_prepare_for_transfer(mhi_dev);
   347		if (err)
   348			return err;
   349	
   350		/* Number of transfer descriptors determines size of the queue */
   351		mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
   352	
   353		err = register_netdev(ndev);
   354		if (err)
   355			return err;
   356	
   357		return 0;
   358	}
   359	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH V1] net: mhi : Add support to enable ethernet interface
  2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
                   ` (4 preceding siblings ...)
  2023-07-02 13:37 ` kernel test robot
@ 2023-07-11  7:50 ` kernel test robot
  5 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-07-11  7:50 UTC (permalink / raw)
  To: Vivek Pernamitta, mhi
  Cc: llvm, oe-kbuild-all, mrana, quic_qianyu, manivannan.sadhasivam,
	Vivek Pernamitta, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

Hi Vivek,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]
[also build test ERROR on net/main linus/master v6.5-rc1 next-20230711]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vivek-Pernamitta/net-mhi-Add-support-to-enable-ethernet-interface/20230630-174659
base:   net-next/main
patch link:    https://lore.kernel.org/r/1688118281-13032-1-git-send-email-quic_vpernami%40quicinc.com
patch subject: [PATCH V1] net: mhi : Add support to enable ethernet interface
config: riscv-randconfig-r042-20230710 (https://download.01.org/0day-ci/archive/20230711/202307111559.xDdV7vHr-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230711/202307111559.xDdV7vHr-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307111559.xDdV7vHr-lkp@intel.com/

All errors (new ones prefixed by >>):

         |                                          ~~~~~~~~~~ ^
   In file included from drivers/net/mhi_net.c:7:
   In file included from include/linux/if_arp.h:22:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:751:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     751 |         insw(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:105:53: note: expanded from macro 'insw'
     105 | #define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count)
         |                                          ~~~~~~~~~~ ^
   In file included from drivers/net/mhi_net.c:7:
   In file included from include/linux/if_arp.h:22:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:759:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     759 |         insl(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:106:53: note: expanded from macro 'insl'
     106 | #define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count)
         |                                          ~~~~~~~~~~ ^
   In file included from drivers/net/mhi_net.c:7:
   In file included from include/linux/if_arp.h:22:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:768:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     768 |         outsb(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:118:55: note: expanded from macro 'outsb'
     118 | #define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count)
         |                                            ~~~~~~~~~~ ^
   In file included from drivers/net/mhi_net.c:7:
   In file included from include/linux/if_arp.h:22:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:777:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     777 |         outsw(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:119:55: note: expanded from macro 'outsw'
     119 | #define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count)
         |                                            ~~~~~~~~~~ ^
   In file included from drivers/net/mhi_net.c:7:
   In file included from include/linux/if_arp.h:22:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:786:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     786 |         outsl(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:120:55: note: expanded from macro 'outsl'
     120 | #define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count)
         |                                            ~~~~~~~~~~ ^
   In file included from drivers/net/mhi_net.c:7:
   In file included from include/linux/if_arp.h:22:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:1134:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
    1134 |         return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
         |                                                   ~~~~~~~~~~ ^
>> drivers/net/mhi_net.c:327:19: error: passing 'const unsigned char *' to parameter of type 'u8 *' (aka 'unsigned char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
     327 |                 eth_random_addr(ndev->dev_addr);
         |                                 ^~~~~~~~~~~~~~
   include/linux/etherdevice.h:230:40: note: passing argument to parameter 'addr' here
     230 | static inline void eth_random_addr(u8 *addr)
         |                                        ^
   13 warnings and 1 error generated.


vim +327 drivers/net/mhi_net.c

   320	
   321	static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
   322	{
   323		struct mhi_net_dev *mhi_netdev;
   324		int err;
   325	
   326		if (eth_dev) {
 > 327			eth_random_addr(ndev->dev_addr);
   328			if (!is_valid_ether_addr(ndev->dev_addr))
   329				return -EADDRNOTAVAIL;
   330		}
   331	
   332		mhi_netdev = netdev_priv(ndev);
   333	
   334		dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
   335		mhi_netdev->ndev = ndev;
   336		mhi_netdev->mdev = mhi_dev;
   337		mhi_netdev->skbagg_head = NULL;
   338		mhi_netdev->mru = mhi_dev->mhi_cntrl->mru;
   339		mhi_netdev->ethernet_if = eth_dev;
   340	
   341		INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
   342		u64_stats_init(&mhi_netdev->stats.rx_syncp);
   343		u64_stats_init(&mhi_netdev->stats.tx_syncp);
   344	
   345		/* Start MHI channels */
   346		err = mhi_prepare_for_transfer(mhi_dev);
   347		if (err)
   348			return err;
   349	
   350		/* Number of transfer descriptors determines size of the queue */
   351		mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
   352	
   353		err = register_netdev(ndev);
   354		if (err)
   355			return err;
   356	
   357		return 0;
   358	}
   359	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2023-07-11  7:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  9:44 [PATCH V1] net: mhi : Add support to enable ethernet interface Vivek Pernamitta
2023-06-30  9:55 ` Vivek Pernamitta
2023-06-30 11:55 ` Daniele Palmas
2023-06-30 13:13 ` Simon Horman
2023-06-30 13:46 ` kernel test robot
2023-07-02 13:37 ` kernel test robot
2023-07-11  7:50 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).