Thread (11 messages) 11 messages, 4 authors, 2025-09-10

Re: [PATCH net-next v3 4/7] net: rpmsg-eth: Add netdev ops

From: <Parthiban.Veerasooran@microchip.com>
Date: 2025-09-09 06:38:59
Also in: linux-arm-kernel, linux-devicetree, linux-doc, lkml

Hi,

On 08/09/25 2:37 pm, MD Danish Anwar wrote:
+static int create_request(struct rpmsg_eth_common *common,
+                         enum rpmsg_eth_rpmsg_type rpmsg_type)
+{
+       struct message *msg = &common->send_msg;
+       int ret = 0;
+
+       msg->msg_hdr.src_id = common->port->port_id;
+       msg->req_msg.type = rpmsg_type;
+
+       switch (rpmsg_type) {
+       case RPMSG_ETH_REQ_SHM_INFO:
+               msg->msg_hdr.msg_type = RPMSG_ETH_REQUEST_MSG;
+               break;
+       case RPMSG_ETH_REQ_SET_MAC_ADDR:
+               msg->msg_hdr.msg_type = RPMSG_ETH_REQUEST_MSG;
+               ether_addr_copy(msg->req_msg.mac_addr.addr,
+                               common->port->ndev->dev_addr);
+               break;
+       case RPMSG_ETH_NOTIFY_PORT_UP:
+       case RPMSG_ETH_NOTIFY_PORT_DOWN:
+               msg->msg_hdr.msg_type = RPMSG_ETH_NOTIFY_MSG;
+               break;
+       default:
+               ret = -EINVAL;
+               dev_err(common->dev, "Invalid RPMSG request\n");
I don't think you need 'ret' here instead directly return -EINVAL and 
above 'ret' declaration can be removed.
+       }
+       return ret;
can be return 0;
+}
+
+static int rpmsg_eth_create_send_request(struct rpmsg_eth_common *common,
+                                        enum rpmsg_eth_rpmsg_type rpmsg_type,
+                                        bool wait)
+{
+       unsigned long flags;
+       int ret = 0;
No need to initialize.
+
+       if (wait)
+               reinit_completion(&common->sync_msg);
+
+       spin_lock_irqsave(&common->send_msg_lock, flags);
+
+static int rpmsg_eth_set_mac_address(struct net_device *ndev, void *addr)
+{
+       struct rpmsg_eth_common *common = rpmsg_eth_ndev_to_common(ndev);
+       int ret;
+
+       ret = eth_mac_addr(ndev, addr);
+
+       if (ret < 0)
+               return ret;
+       ret = rpmsg_eth_create_send_request(common, RPMSG_ETH_REQ_SET_MAC_ADDR, false);
You can directly return from here.
+       return ret;
+}
+
Best regards,
Parthiban V
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help