diff options
Diffstat (limited to 'net/ncsi/ncsi-rsp.c')
-rw-r--r-- | net/ncsi/ncsi-rsp.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index 85fa59afae34..77e07ba3f493 100644 --- a/net/ncsi/ncsi-rsp.c +++ b/net/ncsi/ncsi-rsp.c | |||
@@ -611,19 +611,59 @@ static int ncsi_rsp_handler_snfc(struct ncsi_request *nr) | |||
611 | return 0; | 611 | return 0; |
612 | } | 612 | } |
613 | 613 | ||
614 | /* Response handler for Broadcom command Get Mac Address */ | ||
615 | static int ncsi_rsp_handler_oem_bcm_gma(struct ncsi_request *nr) | ||
616 | { | ||
617 | struct ncsi_dev_priv *ndp = nr->ndp; | ||
618 | struct net_device *ndev = ndp->ndev.dev; | ||
619 | const struct net_device_ops *ops = ndev->netdev_ops; | ||
620 | struct ncsi_rsp_oem_pkt *rsp; | ||
621 | struct sockaddr saddr; | ||
622 | int ret = 0; | ||
623 | |||
624 | /* Get the response header */ | ||
625 | rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp); | ||
626 | |||
627 | saddr.sa_family = ndev->type; | ||
628 | ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | ||
629 | memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN); | ||
630 | /* Increase mac address by 1 for BMC's address */ | ||
631 | saddr.sa_data[ETH_ALEN - 1]++; | ||
632 | ret = ops->ndo_set_mac_address(ndev, &saddr); | ||
633 | if (ret < 0) | ||
634 | netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n"); | ||
635 | |||
636 | return ret; | ||
637 | } | ||
638 | |||
639 | /* Response handler for Broadcom card */ | ||
640 | static int ncsi_rsp_handler_oem_bcm(struct ncsi_request *nr) | ||
641 | { | ||
642 | struct ncsi_rsp_oem_bcm_pkt *bcm; | ||
643 | struct ncsi_rsp_oem_pkt *rsp; | ||
644 | |||
645 | /* Get the response header */ | ||
646 | rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp); | ||
647 | bcm = (struct ncsi_rsp_oem_bcm_pkt *)(rsp->data); | ||
648 | |||
649 | if (bcm->type == NCSI_OEM_BCM_CMD_GMA) | ||
650 | return ncsi_rsp_handler_oem_bcm_gma(nr); | ||
651 | return 0; | ||
652 | } | ||
653 | |||
614 | static struct ncsi_rsp_oem_handler { | 654 | static struct ncsi_rsp_oem_handler { |
615 | unsigned int mfr_id; | 655 | unsigned int mfr_id; |
616 | int (*handler)(struct ncsi_request *nr); | 656 | int (*handler)(struct ncsi_request *nr); |
617 | } ncsi_rsp_oem_handlers[] = { | 657 | } ncsi_rsp_oem_handlers[] = { |
618 | { NCSI_OEM_MFR_MLX_ID, NULL }, | 658 | { NCSI_OEM_MFR_MLX_ID, NULL }, |
619 | { NCSI_OEM_MFR_BCM_ID, NULL } | 659 | { NCSI_OEM_MFR_BCM_ID, ncsi_rsp_handler_oem_bcm } |
620 | }; | 660 | }; |
621 | 661 | ||
622 | /* Response handler for OEM command */ | 662 | /* Response handler for OEM command */ |
623 | static int ncsi_rsp_handler_oem(struct ncsi_request *nr) | 663 | static int ncsi_rsp_handler_oem(struct ncsi_request *nr) |
624 | { | 664 | { |
625 | struct ncsi_rsp_oem_pkt *rsp; | ||
626 | struct ncsi_rsp_oem_handler *nrh = NULL; | 665 | struct ncsi_rsp_oem_handler *nrh = NULL; |
666 | struct ncsi_rsp_oem_pkt *rsp; | ||
627 | unsigned int mfr_id, i; | 667 | unsigned int mfr_id, i; |
628 | 668 | ||
629 | /* Get the response header */ | 669 | /* Get the response header */ |