aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcs_lport.c
diff options
context:
space:
mode:
authorJing Huang <huangj@brocade.com>2010-10-18 20:10:50 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-25 17:17:14 -0400
commitba816ea8e2eacbf3d198ad1859f413c2d6213434 (patch)
tree92399b02434b350fe4c767c0cb4f1790b7fee763 /drivers/scsi/bfa/bfa_fcs_lport.c
parent6a18b1675fdf08a6dc861e39c3f94309a03e7f16 (diff)
[SCSI] bfa: replace endian swap macros with the ones provided by linux
Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs_lport.c')
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 6cee56fafa1..263a7bfa16d 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -482,9 +482,9 @@ bfa_fs_port_get_gen_topo_data(struct bfa_fcs_lport_s *port,
482 memset(gen_topo_data, 0, 482 memset(gen_topo_data, 0,
483 sizeof(struct fc_rnid_general_topology_data_s)); 483 sizeof(struct fc_rnid_general_topology_data_s));
484 484
485 gen_topo_data->asso_type = bfa_os_htonl(RNID_ASSOCIATED_TYPE_HOST); 485 gen_topo_data->asso_type = cpu_to_be32(RNID_ASSOCIATED_TYPE_HOST);
486 gen_topo_data->phy_port_num = 0; /* @todo */ 486 gen_topo_data->phy_port_num = 0; /* @todo */
487 gen_topo_data->num_attached_nodes = bfa_os_htonl(1); 487 gen_topo_data->num_attached_nodes = cpu_to_be32(1);
488} 488}
489 489
490static void 490static void
@@ -1584,7 +1584,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1584 bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr); 1584 bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr);
1585 1585
1586 rhba->hba_id = bfa_fcs_lport_get_pwwn(port); 1586 rhba->hba_id = bfa_fcs_lport_get_pwwn(port);
1587 rhba->port_list.num_ports = bfa_os_htonl(1); 1587 rhba->port_list.num_ports = cpu_to_be32(1);
1588 rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port); 1588 rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port);
1589 1589
1590 len = sizeof(rhba->hba_id) + sizeof(rhba->port_list); 1590 len = sizeof(rhba->hba_id) + sizeof(rhba->port_list);
@@ -1601,21 +1601,21 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1601 * Node Name 1601 * Node Name
1602 */ 1602 */
1603 attr = (struct fdmi_attr_s *) curr_ptr; 1603 attr = (struct fdmi_attr_s *) curr_ptr;
1604 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_NODENAME); 1604 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODENAME);
1605 attr->len = sizeof(wwn_t); 1605 attr->len = sizeof(wwn_t);
1606 memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len); 1606 memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len);
1607 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1607 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1608 len += attr->len; 1608 len += attr->len;
1609 count++; 1609 count++;
1610 attr->len = 1610 attr->len =
1611 bfa_os_htons(attr->len + sizeof(attr->type) + 1611 cpu_to_be16(attr->len + sizeof(attr->type) +
1612 sizeof(attr->len)); 1612 sizeof(attr->len));
1613 1613
1614 /* 1614 /*
1615 * Manufacturer 1615 * Manufacturer
1616 */ 1616 */
1617 attr = (struct fdmi_attr_s *) curr_ptr; 1617 attr = (struct fdmi_attr_s *) curr_ptr;
1618 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MANUFACTURER); 1618 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MANUFACTURER);
1619 attr->len = (u16) strlen(fcs_hba_attr->manufacturer); 1619 attr->len = (u16) strlen(fcs_hba_attr->manufacturer);
1620 memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len); 1620 memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len);
1621 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1621 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1626,14 +1626,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1626 len += attr->len; 1626 len += attr->len;
1627 count++; 1627 count++;
1628 attr->len = 1628 attr->len =
1629 bfa_os_htons(attr->len + sizeof(attr->type) + 1629 cpu_to_be16(attr->len + sizeof(attr->type) +
1630 sizeof(attr->len)); 1630 sizeof(attr->len));
1631 1631
1632 /* 1632 /*
1633 * Serial Number 1633 * Serial Number
1634 */ 1634 */
1635 attr = (struct fdmi_attr_s *) curr_ptr; 1635 attr = (struct fdmi_attr_s *) curr_ptr;
1636 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_SERIALNUM); 1636 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_SERIALNUM);
1637 attr->len = (u16) strlen(fcs_hba_attr->serial_num); 1637 attr->len = (u16) strlen(fcs_hba_attr->serial_num);
1638 memcpy(attr->value, fcs_hba_attr->serial_num, attr->len); 1638 memcpy(attr->value, fcs_hba_attr->serial_num, attr->len);
1639 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1639 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1644,14 +1644,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1644 len += attr->len; 1644 len += attr->len;
1645 count++; 1645 count++;
1646 attr->len = 1646 attr->len =
1647 bfa_os_htons(attr->len + sizeof(attr->type) + 1647 cpu_to_be16(attr->len + sizeof(attr->type) +
1648 sizeof(attr->len)); 1648 sizeof(attr->len));
1649 1649
1650 /* 1650 /*
1651 * Model 1651 * Model
1652 */ 1652 */
1653 attr = (struct fdmi_attr_s *) curr_ptr; 1653 attr = (struct fdmi_attr_s *) curr_ptr;
1654 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MODEL); 1654 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL);
1655 attr->len = (u16) strlen(fcs_hba_attr->model); 1655 attr->len = (u16) strlen(fcs_hba_attr->model);
1656 memcpy(attr->value, fcs_hba_attr->model, attr->len); 1656 memcpy(attr->value, fcs_hba_attr->model, attr->len);
1657 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1657 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1662,14 +1662,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1662 len += attr->len; 1662 len += attr->len;
1663 count++; 1663 count++;
1664 attr->len = 1664 attr->len =
1665 bfa_os_htons(attr->len + sizeof(attr->type) + 1665 cpu_to_be16(attr->len + sizeof(attr->type) +
1666 sizeof(attr->len)); 1666 sizeof(attr->len));
1667 1667
1668 /* 1668 /*
1669 * Model Desc 1669 * Model Desc
1670 */ 1670 */
1671 attr = (struct fdmi_attr_s *) curr_ptr; 1671 attr = (struct fdmi_attr_s *) curr_ptr;
1672 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MODEL_DESC); 1672 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL_DESC);
1673 attr->len = (u16) strlen(fcs_hba_attr->model_desc); 1673 attr->len = (u16) strlen(fcs_hba_attr->model_desc);
1674 memcpy(attr->value, fcs_hba_attr->model_desc, attr->len); 1674 memcpy(attr->value, fcs_hba_attr->model_desc, attr->len);
1675 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1675 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1680,7 +1680,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1680 len += attr->len; 1680 len += attr->len;
1681 count++; 1681 count++;
1682 attr->len = 1682 attr->len =
1683 bfa_os_htons(attr->len + sizeof(attr->type) + 1683 cpu_to_be16(attr->len + sizeof(attr->type) +
1684 sizeof(attr->len)); 1684 sizeof(attr->len));
1685 1685
1686 /* 1686 /*
@@ -1688,7 +1688,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1688 */ 1688 */
1689 if (fcs_hba_attr->hw_version[0] != '\0') { 1689 if (fcs_hba_attr->hw_version[0] != '\0') {
1690 attr = (struct fdmi_attr_s *) curr_ptr; 1690 attr = (struct fdmi_attr_s *) curr_ptr;
1691 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_HW_VERSION); 1691 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_HW_VERSION);
1692 attr->len = (u16) strlen(fcs_hba_attr->hw_version); 1692 attr->len = (u16) strlen(fcs_hba_attr->hw_version);
1693 memcpy(attr->value, fcs_hba_attr->hw_version, attr->len); 1693 memcpy(attr->value, fcs_hba_attr->hw_version, attr->len);
1694 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1694 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1699,7 +1699,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1699 len += attr->len; 1699 len += attr->len;
1700 count++; 1700 count++;
1701 attr->len = 1701 attr->len =
1702 bfa_os_htons(attr->len + sizeof(attr->type) + 1702 cpu_to_be16(attr->len + sizeof(attr->type) +
1703 sizeof(attr->len)); 1703 sizeof(attr->len));
1704 } 1704 }
1705 1705
@@ -1707,7 +1707,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1707 * Driver Version 1707 * Driver Version
1708 */ 1708 */
1709 attr = (struct fdmi_attr_s *) curr_ptr; 1709 attr = (struct fdmi_attr_s *) curr_ptr;
1710 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_DRIVER_VERSION); 1710 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_DRIVER_VERSION);
1711 attr->len = (u16) strlen(fcs_hba_attr->driver_version); 1711 attr->len = (u16) strlen(fcs_hba_attr->driver_version);
1712 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); 1712 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len);
1713 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1713 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1718,7 +1718,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1718 len += attr->len;; 1718 len += attr->len;;
1719 count++; 1719 count++;
1720 attr->len = 1720 attr->len =
1721 bfa_os_htons(attr->len + sizeof(attr->type) + 1721 cpu_to_be16(attr->len + sizeof(attr->type) +
1722 sizeof(attr->len)); 1722 sizeof(attr->len));
1723 1723
1724 /* 1724 /*
@@ -1726,7 +1726,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1726 */ 1726 */
1727 if (fcs_hba_attr->option_rom_ver[0] != '\0') { 1727 if (fcs_hba_attr->option_rom_ver[0] != '\0') {
1728 attr = (struct fdmi_attr_s *) curr_ptr; 1728 attr = (struct fdmi_attr_s *) curr_ptr;
1729 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_ROM_VERSION); 1729 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_ROM_VERSION);
1730 attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver); 1730 attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver);
1731 memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len); 1731 memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len);
1732 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1732 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1737,7 +1737,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1737 len += attr->len; 1737 len += attr->len;
1738 count++; 1738 count++;
1739 attr->len = 1739 attr->len =
1740 bfa_os_htons(attr->len + sizeof(attr->type) + 1740 cpu_to_be16(attr->len + sizeof(attr->type) +
1741 sizeof(attr->len)); 1741 sizeof(attr->len));
1742 } 1742 }
1743 1743
@@ -1745,7 +1745,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1745 * f/w Version = driver version 1745 * f/w Version = driver version
1746 */ 1746 */
1747 attr = (struct fdmi_attr_s *) curr_ptr; 1747 attr = (struct fdmi_attr_s *) curr_ptr;
1748 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_FW_VERSION); 1748 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION);
1749 attr->len = (u16) strlen(fcs_hba_attr->driver_version); 1749 attr->len = (u16) strlen(fcs_hba_attr->driver_version);
1750 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); 1750 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len);
1751 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1751 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1756,7 +1756,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1756 len += attr->len; 1756 len += attr->len;
1757 count++; 1757 count++;
1758 attr->len = 1758 attr->len =
1759 bfa_os_htons(attr->len + sizeof(attr->type) + 1759 cpu_to_be16(attr->len + sizeof(attr->type) +
1760 sizeof(attr->len)); 1760 sizeof(attr->len));
1761 1761
1762 /* 1762 /*
@@ -1764,7 +1764,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1764 */ 1764 */
1765 if (fcs_hba_attr->os_name[0] != '\0') { 1765 if (fcs_hba_attr->os_name[0] != '\0') {
1766 attr = (struct fdmi_attr_s *) curr_ptr; 1766 attr = (struct fdmi_attr_s *) curr_ptr;
1767 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_OS_NAME); 1767 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_OS_NAME);
1768 attr->len = (u16) strlen(fcs_hba_attr->os_name); 1768 attr->len = (u16) strlen(fcs_hba_attr->os_name);
1769 memcpy(attr->value, fcs_hba_attr->os_name, attr->len); 1769 memcpy(attr->value, fcs_hba_attr->os_name, attr->len);
1770 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1770 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1775,7 +1775,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1775 len += attr->len; 1775 len += attr->len;
1776 count++; 1776 count++;
1777 attr->len = 1777 attr->len =
1778 bfa_os_htons(attr->len + sizeof(attr->type) + 1778 cpu_to_be16(attr->len + sizeof(attr->type) +
1779 sizeof(attr->len)); 1779 sizeof(attr->len));
1780 } 1780 }
1781 1781
@@ -1783,13 +1783,13 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1783 * MAX_CT_PAYLOAD 1783 * MAX_CT_PAYLOAD
1784 */ 1784 */
1785 attr = (struct fdmi_attr_s *) curr_ptr; 1785 attr = (struct fdmi_attr_s *) curr_ptr;
1786 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MAX_CT); 1786 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT);
1787 attr->len = sizeof(fcs_hba_attr->max_ct_pyld); 1787 attr->len = sizeof(fcs_hba_attr->max_ct_pyld);
1788 memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len); 1788 memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len);
1789 len += attr->len; 1789 len += attr->len;
1790 count++; 1790 count++;
1791 attr->len = 1791 attr->len =
1792 bfa_os_htons(attr->len + sizeof(attr->type) + 1792 cpu_to_be16(attr->len + sizeof(attr->type) +
1793 sizeof(attr->len)); 1793 sizeof(attr->len));
1794 1794
1795 /* 1795 /*
@@ -1798,7 +1798,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1798 len += ((sizeof(attr->type) + 1798 len += ((sizeof(attr->type) +
1799 sizeof(attr->len)) * count); 1799 sizeof(attr->len)) * count);
1800 1800
1801 rhba->hba_attr_blk.attr_count = bfa_os_htonl(count); 1801 rhba->hba_attr_blk.attr_count = cpu_to_be32(count);
1802 return len; 1802 return len;
1803} 1803}
1804 1804
@@ -1825,7 +1825,7 @@ bfa_fcs_lport_fdmi_rhba_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
1825 } 1825 }
1826 1826
1827 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 1827 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
1828 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 1828 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
1829 1829
1830 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 1830 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
1831 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); 1831 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK);
@@ -1909,56 +1909,56 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1909 * FC4 Types 1909 * FC4 Types
1910 */ 1910 */
1911 attr = (struct fdmi_attr_s *) curr_ptr; 1911 attr = (struct fdmi_attr_s *) curr_ptr;
1912 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_FC4_TYPES); 1912 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FC4_TYPES);
1913 attr->len = sizeof(fcs_port_attr.supp_fc4_types); 1913 attr->len = sizeof(fcs_port_attr.supp_fc4_types);
1914 memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len); 1914 memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len);
1915 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1915 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1916 len += attr->len; 1916 len += attr->len;
1917 ++count; 1917 ++count;
1918 attr->len = 1918 attr->len =
1919 bfa_os_htons(attr->len + sizeof(attr->type) + 1919 cpu_to_be16(attr->len + sizeof(attr->type) +
1920 sizeof(attr->len)); 1920 sizeof(attr->len));
1921 1921
1922 /* 1922 /*
1923 * Supported Speed 1923 * Supported Speed
1924 */ 1924 */
1925 attr = (struct fdmi_attr_s *) curr_ptr; 1925 attr = (struct fdmi_attr_s *) curr_ptr;
1926 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_SUPP_SPEED); 1926 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_SPEED);
1927 attr->len = sizeof(fcs_port_attr.supp_speed); 1927 attr->len = sizeof(fcs_port_attr.supp_speed);
1928 memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len); 1928 memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len);
1929 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1929 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1930 len += attr->len; 1930 len += attr->len;
1931 ++count; 1931 ++count;
1932 attr->len = 1932 attr->len =
1933 bfa_os_htons(attr->len + sizeof(attr->type) + 1933 cpu_to_be16(attr->len + sizeof(attr->type) +
1934 sizeof(attr->len)); 1934 sizeof(attr->len));
1935 1935
1936 /* 1936 /*
1937 * current Port Speed 1937 * current Port Speed
1938 */ 1938 */
1939 attr = (struct fdmi_attr_s *) curr_ptr; 1939 attr = (struct fdmi_attr_s *) curr_ptr;
1940 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_PORT_SPEED); 1940 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SPEED);
1941 attr->len = sizeof(fcs_port_attr.curr_speed); 1941 attr->len = sizeof(fcs_port_attr.curr_speed);
1942 memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len); 1942 memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len);
1943 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1943 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1944 len += attr->len; 1944 len += attr->len;
1945 ++count; 1945 ++count;
1946 attr->len = 1946 attr->len =
1947 bfa_os_htons(attr->len + sizeof(attr->type) + 1947 cpu_to_be16(attr->len + sizeof(attr->type) +
1948 sizeof(attr->len)); 1948 sizeof(attr->len));
1949 1949
1950 /* 1950 /*
1951 * max frame size 1951 * max frame size
1952 */ 1952 */
1953 attr = (struct fdmi_attr_s *) curr_ptr; 1953 attr = (struct fdmi_attr_s *) curr_ptr;
1954 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_FRAME_SIZE); 1954 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FRAME_SIZE);
1955 attr->len = sizeof(fcs_port_attr.max_frm_size); 1955 attr->len = sizeof(fcs_port_attr.max_frm_size);
1956 memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len); 1956 memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len);
1957 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1957 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1958 len += attr->len; 1958 len += attr->len;
1959 ++count; 1959 ++count;
1960 attr->len = 1960 attr->len =
1961 bfa_os_htons(attr->len + sizeof(attr->type) + 1961 cpu_to_be16(attr->len + sizeof(attr->type) +
1962 sizeof(attr->len)); 1962 sizeof(attr->len));
1963 1963
1964 /* 1964 /*
@@ -1966,7 +1966,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1966 */ 1966 */
1967 if (fcs_port_attr.os_device_name[0] != '\0') { 1967 if (fcs_port_attr.os_device_name[0] != '\0') {
1968 attr = (struct fdmi_attr_s *) curr_ptr; 1968 attr = (struct fdmi_attr_s *) curr_ptr;
1969 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_DEV_NAME); 1969 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_DEV_NAME);
1970 attr->len = (u16) strlen(fcs_port_attr.os_device_name); 1970 attr->len = (u16) strlen(fcs_port_attr.os_device_name);
1971 memcpy(attr->value, fcs_port_attr.os_device_name, attr->len); 1971 memcpy(attr->value, fcs_port_attr.os_device_name, attr->len);
1972 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1972 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1977,7 +1977,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1977 len += attr->len; 1977 len += attr->len;
1978 ++count; 1978 ++count;
1979 attr->len = 1979 attr->len =
1980 bfa_os_htons(attr->len + sizeof(attr->type) + 1980 cpu_to_be16(attr->len + sizeof(attr->type) +
1981 sizeof(attr->len)); 1981 sizeof(attr->len));
1982 } 1982 }
1983 /* 1983 /*
@@ -1985,7 +1985,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1985 */ 1985 */
1986 if (fcs_port_attr.host_name[0] != '\0') { 1986 if (fcs_port_attr.host_name[0] != '\0') {
1987 attr = (struct fdmi_attr_s *) curr_ptr; 1987 attr = (struct fdmi_attr_s *) curr_ptr;
1988 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_HOST_NAME); 1988 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_HOST_NAME);
1989 attr->len = (u16) strlen(fcs_port_attr.host_name); 1989 attr->len = (u16) strlen(fcs_port_attr.host_name);
1990 memcpy(attr->value, fcs_port_attr.host_name, attr->len); 1990 memcpy(attr->value, fcs_port_attr.host_name, attr->len);
1991 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1991 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1996,14 +1996,14 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1996 len += attr->len; 1996 len += attr->len;
1997 ++count; 1997 ++count;
1998 attr->len = 1998 attr->len =
1999 bfa_os_htons(attr->len + sizeof(attr->type) + 1999 cpu_to_be16(attr->len + sizeof(attr->type) +
2000 sizeof(attr->len)); 2000 sizeof(attr->len));
2001 } 2001 }
2002 2002
2003 /* 2003 /*
2004 * Update size of payload 2004 * Update size of payload
2005 */ 2005 */
2006 port_attrib->attr_count = bfa_os_htonl(count); 2006 port_attrib->attr_count = cpu_to_be32(count);
2007 len += ((sizeof(attr->type) + 2007 len += ((sizeof(attr->type) +
2008 sizeof(attr->len)) * count); 2008 sizeof(attr->len)) * count);
2009 return len; 2009 return len;
@@ -2050,7 +2050,7 @@ bfa_fcs_lport_fdmi_rprt_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2050 } 2050 }
2051 2051
2052 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2052 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2053 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2053 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2054 2054
2055 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2055 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2056 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); 2056 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK);
@@ -2143,7 +2143,7 @@ bfa_fcs_lport_fdmi_rpa_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2143 } 2143 }
2144 2144
2145 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2145 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2146 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2146 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2147 2147
2148 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2148 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2149 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); 2149 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK);
@@ -2204,7 +2204,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi,
2204 sizeof(driver_info->host_os_patch)); 2204 sizeof(driver_info->host_os_patch));
2205 } 2205 }
2206 2206
2207 hba_attr->max_ct_pyld = bfa_os_htonl(FC_MAX_PDUSZ); 2207 hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ);
2208} 2208}
2209 2209
2210void 2210void
@@ -2230,17 +2230,17 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi,
2230 /* 2230 /*
2231 * Supported Speeds 2231 * Supported Speeds
2232 */ 2232 */
2233 port_attr->supp_speed = bfa_os_htonl(BFA_FCS_FDMI_SUPORTED_SPEEDS); 2233 port_attr->supp_speed = cpu_to_be32(BFA_FCS_FDMI_SUPORTED_SPEEDS);
2234 2234
2235 /* 2235 /*
2236 * Current Speed 2236 * Current Speed
2237 */ 2237 */
2238 port_attr->curr_speed = bfa_os_htonl(pport_attr.speed); 2238 port_attr->curr_speed = cpu_to_be32(pport_attr.speed);
2239 2239
2240 /* 2240 /*
2241 * Max PDU Size. 2241 * Max PDU Size.
2242 */ 2242 */
2243 port_attr->max_frm_size = bfa_os_htonl(FC_MAX_PDUSZ); 2243 port_attr->max_frm_size = cpu_to_be32(FC_MAX_PDUSZ);
2244 2244
2245 /* 2245 /*
2246 * OS device Name 2246 * OS device Name
@@ -2657,12 +2657,12 @@ bfa_fcs_lport_ms_gmal_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2657 } 2657 }
2658 2658
2659 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2659 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2660 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2660 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2661 2661
2662 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2662 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2663 gmal_resp = (struct fcgs_gmal_resp_s *)(cthdr + 1); 2663 gmal_resp = (struct fcgs_gmal_resp_s *)(cthdr + 1);
2664 2664
2665 num_entries = bfa_os_ntohl(gmal_resp->ms_len); 2665 num_entries = be32_to_cpu(gmal_resp->ms_len);
2666 if (num_entries == 0) { 2666 if (num_entries == 0) {
2667 bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR); 2667 bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR);
2668 return; 2668 return;
@@ -2853,7 +2853,7 @@ bfa_fcs_lport_ms_gfn_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2853 } 2853 }
2854 2854
2855 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2855 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2856 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2856 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2857 2857
2858 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2858 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2859 gfn_resp = (wwn_t *)(cthdr + 1); 2859 gfn_resp = (wwn_t *)(cthdr + 1);
@@ -3815,7 +3815,7 @@ bfa_fcs_lport_ns_rspn_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
3815 } 3815 }
3816 3816
3817 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 3817 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
3818 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 3818 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
3819 3819
3820 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 3820 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
3821 port->stats.ns_rspnid_accepts++; 3821 port->stats.ns_rspnid_accepts++;
@@ -3887,7 +3887,7 @@ bfa_fcs_lport_ns_rft_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
3887 } 3887 }
3888 3888
3889 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 3889 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
3890 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 3890 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
3891 3891
3892 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 3892 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
3893 port->stats.ns_rftid_accepts++; 3893 port->stats.ns_rftid_accepts++;
@@ -3964,7 +3964,7 @@ bfa_fcs_lport_ns_rff_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
3964 } 3964 }
3965 3965
3966 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 3966 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
3967 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 3967 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
3968 3968
3969 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 3969 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
3970 port->stats.ns_rffid_accepts++; 3970 port->stats.ns_rffid_accepts++;
@@ -4058,7 +4058,7 @@ bfa_fcs_lport_ns_gid_ft_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
4058 } 4058 }
4059 4059
4060 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 4060 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
4061 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 4061 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
4062 4062
4063 switch (cthdr->cmd_rsp_code) { 4063 switch (cthdr->cmd_rsp_code) {
4064 4064
@@ -4624,7 +4624,7 @@ bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port,
4624 int i = 0, j; 4624 int i = 0, j;
4625 4625
4626 num_entries = 4626 num_entries =
4627 (bfa_os_ntohs(rscn->payldlen) - 4627 (be16_to_cpu(rscn->payldlen) -
4628 sizeof(u32)) / sizeof(rscn->event[0]); 4628 sizeof(u32)) / sizeof(rscn->event[0]);
4629 4629
4630 bfa_trc(port->fcs, num_entries); 4630 bfa_trc(port->fcs, num_entries);