ncsi-rsp.c (9771b8ccdfa6dcb1ac5128ca7fe8649f3092d392) ncsi-rsp.c (cb10c7c0dfd9e6fd3d69ced98b05cbd198c48cf6)
1/*
2 * Copyright Gavin Shan, IBM Corporation 2016.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */

--- 597 unchanged lines hidden (view full) ---

606 /* Update to flow control mode */
607 cmd = (struct ncsi_cmd_snfc_pkt *)skb_network_header(nr->cmd);
608 ncm->enable = 1;
609 ncm->data[0] = cmd->mode;
610
611 return 0;
612}
613
1/*
2 * Copyright Gavin Shan, IBM Corporation 2016.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */

--- 597 unchanged lines hidden (view full) ---

606 /* Update to flow control mode */
607 cmd = (struct ncsi_cmd_snfc_pkt *)skb_network_header(nr->cmd);
608 ncm->enable = 1;
609 ncm->data[0] = cmd->mode;
610
611 return 0;
612}
613
614/* Response handler for Broadcom command Get Mac Address */
615static 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 */
640static 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
614static struct ncsi_rsp_oem_handler {
615 unsigned int mfr_id;
616 int (*handler)(struct ncsi_request *nr);
617} ncsi_rsp_oem_handlers[] = {
618 { NCSI_OEM_MFR_MLX_ID, NULL },
654static struct ncsi_rsp_oem_handler {
655 unsigned int mfr_id;
656 int (*handler)(struct ncsi_request *nr);
657} ncsi_rsp_oem_handlers[] = {
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};
621
622/* Response handler for OEM command */
623static int ncsi_rsp_handler_oem(struct ncsi_request *nr)
624{
660};
661
662/* Response handler for OEM command */
663static int ncsi_rsp_handler_oem(struct ncsi_request *nr)
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;
628
629 /* Get the response header */
630 rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp);
631 mfr_id = ntohl(rsp->mfr_id);
632
633 /* Check for manufacturer id and Find the handler */
634 for (i = 0; i < ARRAY_SIZE(ncsi_rsp_oem_handlers); i++) {

--- 481 unchanged lines hidden ---
667 unsigned int mfr_id, i;
668
669 /* Get the response header */
670 rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp);
671 mfr_id = ntohl(rsp->mfr_id);
672
673 /* Check for manufacturer id and Find the handler */
674 for (i = 0; i < ARRAY_SIZE(ncsi_rsp_oem_handlers); i++) {

--- 481 unchanged lines hidden ---