aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2011-09-06 04:10:49 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-09-06 04:10:49 -0400
commit689def90ac16df09e2b6ca6af86dca68706cc75b (patch)
treea37cb7d892363cbe582fc4738f8bd3a058800a04
parentdfa0104c2a2699e73a49b4ca10bbb99796b05889 (diff)
ath6kl: unify rx function naming in htc.c
Similarly like with the tx path, unify naming in htc rx path. No functional changes. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc.c126
1 files changed, 66 insertions, 60 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 46c6efbcd31b..9aa2e4447900 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -861,8 +861,8 @@ void ath6kl_htc_indicate_activity_change(struct htc_target *target,
861 861
862/* HTC Rx */ 862/* HTC Rx */
863 863
864static inline void htc_update_rx_stats(struct htc_endpoint *endpoint, 864static inline void ath6kl_htc_rx_update_stats(struct htc_endpoint *endpoint,
865 int n_look_ahds) 865 int n_look_ahds)
866{ 866{
867 endpoint->ep_st.rx_pkts++; 867 endpoint->ep_st.rx_pkts++;
868 if (n_look_ahds == 1) 868 if (n_look_ahds == 1)
@@ -909,8 +909,9 @@ static void reclaim_rx_ctrl_buf(struct htc_target *target,
909 spin_unlock_bh(&target->htc_lock); 909 spin_unlock_bh(&target->htc_lock);
910} 910}
911 911
912static int dev_rx_pkt(struct htc_target *target, struct htc_packet *packet, 912static int ath6kl_htc_rx_packet(struct htc_target *target,
913 u32 rx_len) 913 struct htc_packet *packet,
914 u32 rx_len)
914{ 915{
915 struct ath6kl_device *dev = target->dev; 916 struct ath6kl_device *dev = target->dev;
916 u32 padded_len; 917 u32 padded_len;
@@ -944,9 +945,9 @@ static int dev_rx_pkt(struct htc_target *target, struct htc_packet *packet,
944 * "hint" that there are more single-packets to fetch 945 * "hint" that there are more single-packets to fetch
945 * on this endpoint. 946 * on this endpoint.
946 */ 947 */
947static void set_rxpkt_indication_flag(u32 lk_ahd, 948static void ath6kl_htc_rx_set_indicate(u32 lk_ahd,
948 struct htc_endpoint *endpoint, 949 struct htc_endpoint *endpoint,
949 struct htc_packet *packet) 950 struct htc_packet *packet)
950{ 951{
951 struct htc_frame_hdr *htc_hdr = (struct htc_frame_hdr *)&lk_ahd; 952 struct htc_frame_hdr *htc_hdr = (struct htc_frame_hdr *)&lk_ahd;
952 953
@@ -957,7 +958,7 @@ static void set_rxpkt_indication_flag(u32 lk_ahd,
957 } 958 }
958} 959}
959 960
960static void chk_rx_water_mark(struct htc_endpoint *endpoint) 961static void ath6kl_htc_rx_chk_water_mark(struct htc_endpoint *endpoint)
961{ 962{
962 struct htc_ep_callbacks ep_cb = endpoint->ep_cb; 963 struct htc_ep_callbacks ep_cb = endpoint->ep_cb;
963 964
@@ -974,8 +975,9 @@ static void chk_rx_water_mark(struct htc_endpoint *endpoint)
974} 975}
975 976
976/* This function is called with rx_lock held */ 977/* This function is called with rx_lock held */
977static int htc_setup_rxpkts(struct htc_target *target, struct htc_endpoint *ep, 978static int ath6kl_htc_rx_setup(struct htc_target *target,
978 u32 *lk_ahds, struct list_head *queue, int n_msg) 979 struct htc_endpoint *ep,
980 u32 *lk_ahds, struct list_head *queue, int n_msg)
979{ 981{
980 struct htc_packet *packet; 982 struct htc_packet *packet;
981 /* FIXME: type of lk_ahds can't be right */ 983 /* FIXME: type of lk_ahds can't be right */
@@ -1075,10 +1077,10 @@ static int htc_setup_rxpkts(struct htc_target *target, struct htc_endpoint *ep,
1075 return status; 1077 return status;
1076} 1078}
1077 1079
1078static int alloc_and_prep_rxpkts(struct htc_target *target, 1080static int ath6kl_htc_rx_alloc(struct htc_target *target,
1079 u32 lk_ahds[], int msg, 1081 u32 lk_ahds[], int msg,
1080 struct htc_endpoint *endpoint, 1082 struct htc_endpoint *endpoint,
1081 struct list_head *queue) 1083 struct list_head *queue)
1082{ 1084{
1083 int status = 0; 1085 int status = 0;
1084 struct htc_packet *packet, *tmp_pkt; 1086 struct htc_packet *packet, *tmp_pkt;
@@ -1144,8 +1146,8 @@ static int alloc_and_prep_rxpkts(struct htc_target *target,
1144 n_msg = 1; 1146 n_msg = 1;
1145 1147
1146 /* Setup packet buffers for each message */ 1148 /* Setup packet buffers for each message */
1147 status = htc_setup_rxpkts(target, endpoint, &lk_ahds[i], queue, 1149 status = ath6kl_htc_rx_setup(target, endpoint, &lk_ahds[i],
1148 n_msg); 1150 queue, n_msg);
1149 1151
1150 /* 1152 /*
1151 * This is due to unavailabilty of buffers to rx entire data. 1153 * This is due to unavailabilty of buffers to rx entire data.
@@ -1422,9 +1424,9 @@ static int htc_proc_trailer(struct htc_target *target,
1422 return status; 1424 return status;
1423} 1425}
1424 1426
1425static int htc_proc_rxhdr(struct htc_target *target, 1427static int ath6kl_htc_rx_process_hdr(struct htc_target *target,
1426 struct htc_packet *packet, 1428 struct htc_packet *packet,
1427 u32 *next_lkahds, int *n_lkahds) 1429 u32 *next_lkahds, int *n_lkahds)
1428{ 1430{
1429 int status = 0; 1431 int status = 0;
1430 u16 payload_len; 1432 u16 payload_len;
@@ -1476,8 +1478,8 @@ static int htc_proc_rxhdr(struct htc_target *target,
1476 } 1478 }
1477 1479
1478 if (lk_ahd != packet->info.rx.exp_hdr) { 1480 if (lk_ahd != packet->info.rx.exp_hdr) {
1479 ath6kl_err("htc_proc_rxhdr, lk_ahd mismatch! (pPkt:0x%p flags:0x%X)\n", 1481 ath6kl_err("%s(): lk_ahd mismatch! (pPkt:0x%p flags:0x%X)\n",
1480 packet, packet->info.rx.rx_flags); 1482 __func__, packet, packet->info.rx.rx_flags);
1481 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, "Expected Message lk_ahd", 1483 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, "Expected Message lk_ahd",
1482 &packet->info.rx.exp_hdr, 4); 1484 &packet->info.rx.exp_hdr, 4);
1483 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, "Current Frame Header", 1485 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, "Current Frame Header",
@@ -1489,8 +1491,8 @@ static int htc_proc_rxhdr(struct htc_target *target,
1489 if (htc_hdr->flags & HTC_FLG_RX_TRAILER) { 1491 if (htc_hdr->flags & HTC_FLG_RX_TRAILER) {
1490 if (htc_hdr->ctrl[0] < sizeof(struct htc_record_hdr) || 1492 if (htc_hdr->ctrl[0] < sizeof(struct htc_record_hdr) ||
1491 htc_hdr->ctrl[0] > payload_len) { 1493 htc_hdr->ctrl[0] > payload_len) {
1492 ath6kl_err("htc_proc_rxhdr, invalid hdr (payload len should be :%d, CB[0] is:%d)\n", 1494 ath6kl_err("%s(): invalid hdr (payload len should be :%d, CB[0] is:%d)\n",
1493 payload_len, htc_hdr->ctrl[0]); 1495 __func__, payload_len, htc_hdr->ctrl[0]);
1494 status = -ENOMEM; 1496 status = -ENOMEM;
1495 goto fail_rx; 1497 goto fail_rx;
1496 } 1498 }
@@ -1529,8 +1531,8 @@ fail_rx:
1529 return status; 1531 return status;
1530} 1532}
1531 1533
1532static void do_rx_completion(struct htc_endpoint *endpoint, 1534static void ath6kl_htc_rx_complete(struct htc_endpoint *endpoint,
1533 struct htc_packet *packet) 1535 struct htc_packet *packet)
1534{ 1536{
1535 ath6kl_dbg(ATH6KL_DBG_HTC_RECV, 1537 ath6kl_dbg(ATH6KL_DBG_HTC_RECV,
1536 "htc calling ep %d recv callback on packet 0x%p\n", 1538 "htc calling ep %d recv callback on packet 0x%p\n",
@@ -1538,10 +1540,10 @@ static void do_rx_completion(struct htc_endpoint *endpoint,
1538 endpoint->ep_cb.rx(endpoint->target, packet); 1540 endpoint->ep_cb.rx(endpoint->target, packet);
1539} 1541}
1540 1542
1541static int htc_issue_rxpkt_bundle(struct htc_target *target, 1543static int ath6kl_htc_rx_bundle(struct htc_target *target,
1542 struct list_head *rxq, 1544 struct list_head *rxq,
1543 struct list_head *sync_compq, 1545 struct list_head *sync_compq,
1544 int *n_pkt_fetched, bool part_bundle) 1546 int *n_pkt_fetched, bool part_bundle)
1545{ 1547{
1546 struct hif_scatter_req *scat_req; 1548 struct hif_scatter_req *scat_req;
1547 struct htc_packet *packet; 1549 struct htc_packet *packet;
@@ -1563,15 +1565,15 @@ static int htc_issue_rxpkt_bundle(struct htc_target *target,
1563 * This would only happen if the target ignored our max 1565 * This would only happen if the target ignored our max
1564 * bundle limit. 1566 * bundle limit.
1565 */ 1567 */
1566 ath6kl_warn("htc_issue_rxpkt_bundle : partial bundle detected num:%d , %d\n", 1568 ath6kl_warn("%s(): partial bundle detected num:%d , %d\n",
1567 get_queue_depth(rxq), n_scat_pkt); 1569 __func__, get_queue_depth(rxq), n_scat_pkt);
1568 } 1570 }
1569 1571
1570 len = 0; 1572 len = 0;
1571 1573
1572 ath6kl_dbg(ATH6KL_DBG_HTC_RECV, 1574 ath6kl_dbg(ATH6KL_DBG_HTC_RECV,
1573 "htc_issue_rxpkt_bundle (numpackets: %d , actual : %d)\n", 1575 "%s(): (numpackets: %d , actual : %d)\n",
1574 get_queue_depth(rxq), n_scat_pkt); 1576 __func__, get_queue_depth(rxq), n_scat_pkt);
1575 1577
1576 scat_req = hif_scatter_req_get(target->dev->ar); 1578 scat_req = hif_scatter_req_get(target->dev->ar);
1577 1579
@@ -1631,9 +1633,10 @@ fail_rx_pkt:
1631 return status; 1633 return status;
1632} 1634}
1633 1635
1634static int htc_proc_fetched_rxpkts(struct htc_target *target, 1636static int ath6kl_htc_rx_process_packets(struct htc_target *target,
1635 struct list_head *comp_pktq, u32 lk_ahds[], 1637 struct list_head *comp_pktq,
1636 int *n_lk_ahd) 1638 u32 lk_ahds[],
1639 int *n_lk_ahd)
1637{ 1640{
1638 struct htc_packet *packet, *tmp_pkt; 1641 struct htc_packet *packet, *tmp_pkt;
1639 struct htc_endpoint *ep; 1642 struct htc_endpoint *ep;
@@ -1644,7 +1647,8 @@ static int htc_proc_fetched_rxpkts(struct htc_target *target,
1644 ep = &target->endpoint[packet->endpoint]; 1647 ep = &target->endpoint[packet->endpoint];
1645 1648
1646 /* process header for each of the recv packet */ 1649 /* process header for each of the recv packet */
1647 status = htc_proc_rxhdr(target, packet, lk_ahds, n_lk_ahd); 1650 status = ath6kl_htc_rx_process_hdr(target, packet, lk_ahds,
1651 n_lk_ahd);
1648 if (status) 1652 if (status)
1649 return status; 1653 return status;
1650 1654
@@ -1654,8 +1658,8 @@ static int htc_proc_fetched_rxpkts(struct htc_target *target,
1654 * based on the lookahead. 1658 * based on the lookahead.
1655 */ 1659 */
1656 if (*n_lk_ahd > 0) 1660 if (*n_lk_ahd > 0)
1657 set_rxpkt_indication_flag(lk_ahds[0], 1661 ath6kl_htc_rx_set_indicate(lk_ahds[0],
1658 ep, packet); 1662 ep, packet);
1659 } else 1663 } else
1660 /* 1664 /*
1661 * Packets in a bundle automatically have 1665 * Packets in a bundle automatically have
@@ -1664,20 +1668,20 @@ static int htc_proc_fetched_rxpkts(struct htc_target *target,
1664 packet->info.rx.indicat_flags |= 1668 packet->info.rx.indicat_flags |=
1665 HTC_RX_FLAGS_INDICATE_MORE_PKTS; 1669 HTC_RX_FLAGS_INDICATE_MORE_PKTS;
1666 1670
1667 htc_update_rx_stats(ep, *n_lk_ahd); 1671 ath6kl_htc_rx_update_stats(ep, *n_lk_ahd);
1668 1672
1669 if (packet->info.rx.rx_flags & HTC_RX_PKT_PART_OF_BUNDLE) 1673 if (packet->info.rx.rx_flags & HTC_RX_PKT_PART_OF_BUNDLE)
1670 ep->ep_st.rx_bundl += 1; 1674 ep->ep_st.rx_bundl += 1;
1671 1675
1672 do_rx_completion(ep, packet); 1676 ath6kl_htc_rx_complete(ep, packet);
1673 } 1677 }
1674 1678
1675 return status; 1679 return status;
1676} 1680}
1677 1681
1678static int htc_fetch_rxpkts(struct htc_target *target, 1682static int ath6kl_htc_rx_fetch(struct htc_target *target,
1679 struct list_head *rx_pktq, 1683 struct list_head *rx_pktq,
1680 struct list_head *comp_pktq) 1684 struct list_head *comp_pktq)
1681{ 1685{
1682 int fetched_pkts; 1686 int fetched_pkts;
1683 bool part_bundle = false; 1687 bool part_bundle = false;
@@ -1693,10 +1697,10 @@ static int htc_fetch_rxpkts(struct htc_target *target,
1693 * bundle transfer and recv bundling is 1697 * bundle transfer and recv bundling is
1694 * allowed. 1698 * allowed.
1695 */ 1699 */
1696 status = htc_issue_rxpkt_bundle(target, rx_pktq, 1700 status = ath6kl_htc_rx_bundle(target, rx_pktq,
1697 comp_pktq, 1701 comp_pktq,
1698 &fetched_pkts, 1702 &fetched_pkts,
1699 part_bundle); 1703 part_bundle);
1700 if (status) 1704 if (status)
1701 return status; 1705 return status;
1702 1706
@@ -1725,7 +1729,8 @@ static int htc_fetch_rxpkts(struct htc_target *target,
1725 HTC_RX_PKT_IGNORE_LOOKAHEAD; 1729 HTC_RX_PKT_IGNORE_LOOKAHEAD;
1726 1730
1727 /* go fetch the packet */ 1731 /* go fetch the packet */
1728 status = dev_rx_pkt(target, packet, packet->act_len); 1732 status = ath6kl_htc_rx_packet(target, packet,
1733 packet->act_len);
1729 if (status) 1734 if (status)
1730 return status; 1735 return status;
1731 1736
@@ -1779,9 +1784,9 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
1779 * Try to allocate as many HTC RX packets indicated by the 1784 * Try to allocate as many HTC RX packets indicated by the
1780 * look_aheads. 1785 * look_aheads.
1781 */ 1786 */
1782 status = alloc_and_prep_rxpkts(target, look_aheads, 1787 status = ath6kl_htc_rx_alloc(target, look_aheads,
1783 num_look_ahead, endpoint, 1788 num_look_ahead, endpoint,
1784 &rx_pktq); 1789 &rx_pktq);
1785 if (status) 1790 if (status)
1786 break; 1791 break;
1787 1792
@@ -1796,14 +1801,15 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
1796 1801
1797 num_look_ahead = 0; 1802 num_look_ahead = 0;
1798 1803
1799 status = htc_fetch_rxpkts(target, &rx_pktq, &comp_pktq); 1804 status = ath6kl_htc_rx_fetch(target, &rx_pktq, &comp_pktq);
1800 1805
1801 if (!status) 1806 if (!status)
1802 chk_rx_water_mark(endpoint); 1807 ath6kl_htc_rx_chk_water_mark(endpoint);
1803 1808
1804 /* Process fetched packets */ 1809 /* Process fetched packets */
1805 status = htc_proc_fetched_rxpkts(target, &comp_pktq, 1810 status = ath6kl_htc_rx_process_packets(target, &comp_pktq,
1806 look_aheads, &num_look_ahead); 1811 look_aheads,
1812 &num_look_ahead);
1807 1813
1808 if (!num_look_ahead || status) 1814 if (!num_look_ahead || status)
1809 break; 1815 break;
@@ -1896,14 +1902,14 @@ static struct htc_packet *htc_wait_for_ctrl_msg(struct htc_target *target)
1896 packet->completion = NULL; 1902 packet->completion = NULL;
1897 1903
1898 /* get the message from the device, this will block */ 1904 /* get the message from the device, this will block */
1899 if (dev_rx_pkt(target, packet, packet->act_len)) 1905 if (ath6kl_htc_rx_packet(target, packet, packet->act_len))
1900 goto fail_ctrl_rx; 1906 goto fail_ctrl_rx;
1901 1907
1902 /* process receive header */ 1908 /* process receive header */
1903 packet->status = htc_proc_rxhdr(target, packet, NULL, NULL); 1909 packet->status = ath6kl_htc_rx_process_hdr(target, packet, NULL, NULL);
1904 1910
1905 if (packet->status) { 1911 if (packet->status) {
1906 ath6kl_err("htc_wait_for_ctrl_msg, htc_proc_rxhdr failed (status = %d)\n", 1912 ath6kl_err("htc_wait_for_ctrl_msg, ath6kl_htc_rx_process_hdr failed (status = %d)\n",
1907 packet->status); 1913 packet->status);
1908 goto fail_ctrl_rx; 1914 goto fail_ctrl_rx;
1909 } 1915 }
@@ -1950,7 +1956,7 @@ int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
1950 list_for_each_entry_safe(packet, tmp_pkt, pkt_queue, list) { 1956 list_for_each_entry_safe(packet, tmp_pkt, pkt_queue, list) {
1951 packet->status = -ECANCELED; 1957 packet->status = -ECANCELED;
1952 list_del(&packet->list); 1958 list_del(&packet->list);
1953 do_rx_completion(endpoint, packet); 1959 ath6kl_htc_rx_complete(endpoint, packet);
1954 } 1960 }
1955 1961
1956 return status; 1962 return status;