net/ncsi: Send device address as source address
authorVijay Khemka <vijaykhemka@fb.com>
Tue, 7 Jan 2020 19:30:33 +0000 (11:30 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Jan 2020 21:09:18 +0000 (13:09 -0800)
After receiving device mac address from device, send this as
a source address for further commands instead of broadcast
address.

This will help in multi host NIC cards.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ncsi/ncsi-cmd.c

index 0187e65176c05c1ac93a18d77a12323e6a692576..ba9ae482141b0f4be035085a6f9427cf581cf169 100644 (file)
@@ -369,7 +369,15 @@ int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca)
        eh = skb_push(nr->cmd, sizeof(*eh));
        eh->h_proto = htons(ETH_P_NCSI);
        eth_broadcast_addr(eh->h_dest);
-       eth_broadcast_addr(eh->h_source);
+
+       /* If mac address received from device then use it for
+        * source address as unicast address else use broadcast
+        * address as source address
+        */
+       if (nca->ndp->gma_flag == 1)
+               memcpy(eh->h_source, nca->ndp->ndev.dev->dev_addr, ETH_ALEN);
+       else
+               eth_broadcast_addr(eh->h_source);
 
        /* Start the timer for the request that might not have
         * corresponding response. Given NCSI is an internal