| .. | .. |
|---|
| 1 | | -/* Copyright (c) 2014 Broadcom Corporation |
|---|
| 2 | | - * |
|---|
| 3 | | - * Permission to use, copy, modify, and/or distribute this software for any |
|---|
| 4 | | - * purpose with or without fee is hereby granted, provided that the above |
|---|
| 5 | | - * copyright notice and this permission notice appear in all copies. |
|---|
| 6 | | - * |
|---|
| 7 | | - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|---|
| 8 | | - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|---|
| 9 | | - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
|---|
| 10 | | - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|---|
| 11 | | - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
|---|
| 12 | | - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
|---|
| 13 | | - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|---|
| 1 | +// SPDX-License-Identifier: ISC |
|---|
| 2 | +/* |
|---|
| 3 | + * Copyright (c) 2014 Broadcom Corporation |
|---|
| 14 | 4 | */ |
|---|
| 15 | 5 | |
|---|
| 16 | 6 | /******************************************************************************* |
|---|
| .. | .. |
|---|
| 64 | 54 | #define BRCMF_IOCTL_REQ_PKTID 0xFFFE |
|---|
| 65 | 55 | |
|---|
| 66 | 56 | #define BRCMF_MSGBUF_MAX_PKT_SIZE 2048 |
|---|
| 57 | +#define BRCMF_MSGBUF_MAX_CTL_PKT_SIZE 8192 |
|---|
| 67 | 58 | #define BRCMF_MSGBUF_RXBUFPOST_THRESHOLD 32 |
|---|
| 68 | 59 | #define BRCMF_MSGBUF_MAX_IOCTLRESPBUF_POST 8 |
|---|
| 69 | 60 | #define BRCMF_MSGBUF_MAX_EVENTBUF_POST 8 |
|---|
| .. | .. |
|---|
| 132 | 123 | struct msgbuf_completion_hdr { |
|---|
| 133 | 124 | __le16 status; |
|---|
| 134 | 125 | __le16 flow_ring_id; |
|---|
| 126 | +}; |
|---|
| 127 | + |
|---|
| 128 | +/* Data struct for the MSGBUF_TYPE_GEN_STATUS */ |
|---|
| 129 | +struct msgbuf_gen_status { |
|---|
| 130 | + struct msgbuf_common_hdr msg; |
|---|
| 131 | + struct msgbuf_completion_hdr compl_hdr; |
|---|
| 132 | + __le16 write_idx; |
|---|
| 133 | + __le32 rsvd0[3]; |
|---|
| 134 | +}; |
|---|
| 135 | + |
|---|
| 136 | +/* Data struct for the MSGBUF_TYPE_RING_STATUS */ |
|---|
| 137 | +struct msgbuf_ring_status { |
|---|
| 138 | + struct msgbuf_common_hdr msg; |
|---|
| 139 | + struct msgbuf_completion_hdr compl_hdr; |
|---|
| 140 | + __le16 write_idx; |
|---|
| 141 | + __le16 rsvd0[5]; |
|---|
| 135 | 142 | }; |
|---|
| 136 | 143 | |
|---|
| 137 | 144 | struct msgbuf_rx_event { |
|---|
| .. | .. |
|---|
| 431 | 438 | brcmf_commonring_lock(commonring); |
|---|
| 432 | 439 | ret_ptr = brcmf_commonring_reserve_for_write(commonring); |
|---|
| 433 | 440 | if (!ret_ptr) { |
|---|
| 434 | | - brcmf_err("Failed to reserve space in commonring\n"); |
|---|
| 441 | + bphy_err(drvr, "Failed to reserve space in commonring\n"); |
|---|
| 435 | 442 | brcmf_commonring_unlock(commonring); |
|---|
| 436 | 443 | return -ENOMEM; |
|---|
| 437 | 444 | } |
|---|
| .. | .. |
|---|
| 495 | 502 | |
|---|
| 496 | 503 | timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf); |
|---|
| 497 | 504 | if (!timeout) { |
|---|
| 498 | | - brcmf_err("Timeout on response for query command\n"); |
|---|
| 505 | + bphy_err(drvr, "Timeout on response for query command\n"); |
|---|
| 499 | 506 | return -EIO; |
|---|
| 500 | 507 | } |
|---|
| 501 | 508 | |
|---|
| .. | .. |
|---|
| 529 | 536 | return -ENODEV; |
|---|
| 530 | 537 | } |
|---|
| 531 | 538 | |
|---|
| 532 | | -static void brcmf_msgbuf_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb) |
|---|
| 539 | +static void brcmf_msgbuf_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb, |
|---|
| 540 | + bool inirq) |
|---|
| 533 | 541 | { |
|---|
| 534 | 542 | } |
|---|
| 535 | 543 | |
|---|
| .. | .. |
|---|
| 572 | 580 | brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf, |
|---|
| 573 | 581 | struct brcmf_msgbuf_work_item *work) |
|---|
| 574 | 582 | { |
|---|
| 583 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 575 | 584 | struct msgbuf_tx_flowring_create_req *create; |
|---|
| 576 | 585 | struct brcmf_commonring *commonring; |
|---|
| 577 | 586 | void *ret_ptr; |
|---|
| .. | .. |
|---|
| 587 | 596 | &msgbuf->flowring_dma_handle[flowid], |
|---|
| 588 | 597 | GFP_KERNEL); |
|---|
| 589 | 598 | if (!dma_buf) { |
|---|
| 590 | | - brcmf_err("dma_alloc_coherent failed\n"); |
|---|
| 599 | + bphy_err(drvr, "dma_alloc_coherent failed\n"); |
|---|
| 591 | 600 | brcmf_flowring_delete(msgbuf->flow, flowid); |
|---|
| 592 | 601 | return BRCMF_FLOWRING_INVALID_ID; |
|---|
| 593 | 602 | } |
|---|
| .. | .. |
|---|
| 600 | 609 | brcmf_commonring_lock(commonring); |
|---|
| 601 | 610 | ret_ptr = brcmf_commonring_reserve_for_write(commonring); |
|---|
| 602 | 611 | if (!ret_ptr) { |
|---|
| 603 | | - brcmf_err("Failed to reserve space in commonring\n"); |
|---|
| 612 | + bphy_err(drvr, "Failed to reserve space in commonring\n"); |
|---|
| 604 | 613 | brcmf_commonring_unlock(commonring); |
|---|
| 605 | 614 | brcmf_msgbuf_remove_flowring(msgbuf, flowid); |
|---|
| 606 | 615 | return BRCMF_FLOWRING_INVALID_ID; |
|---|
| .. | .. |
|---|
| 627 | 636 | err = brcmf_commonring_write_complete(commonring); |
|---|
| 628 | 637 | brcmf_commonring_unlock(commonring); |
|---|
| 629 | 638 | if (err) { |
|---|
| 630 | | - brcmf_err("Failed to write commonring\n"); |
|---|
| 639 | + bphy_err(drvr, "Failed to write commonring\n"); |
|---|
| 631 | 640 | brcmf_msgbuf_remove_flowring(msgbuf, flowid); |
|---|
| 632 | 641 | return BRCMF_FLOWRING_INVALID_ID; |
|---|
| 633 | 642 | } |
|---|
| .. | .. |
|---|
| 686 | 695 | static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid) |
|---|
| 687 | 696 | { |
|---|
| 688 | 697 | struct brcmf_flowring *flow = msgbuf->flow; |
|---|
| 698 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 689 | 699 | struct brcmf_commonring *commonring; |
|---|
| 690 | 700 | void *ret_ptr; |
|---|
| 691 | 701 | u32 count; |
|---|
| .. | .. |
|---|
| 705 | 715 | while (brcmf_flowring_qlen(flow, flowid)) { |
|---|
| 706 | 716 | skb = brcmf_flowring_dequeue(flow, flowid); |
|---|
| 707 | 717 | if (skb == NULL) { |
|---|
| 708 | | - brcmf_err("No SKB, but qlen %d\n", |
|---|
| 709 | | - brcmf_flowring_qlen(flow, flowid)); |
|---|
| 718 | + bphy_err(drvr, "No SKB, but qlen %d\n", |
|---|
| 719 | + brcmf_flowring_qlen(flow, flowid)); |
|---|
| 710 | 720 | break; |
|---|
| 711 | 721 | } |
|---|
| 712 | 722 | skb_orphan(skb); |
|---|
| .. | .. |
|---|
| 714 | 724 | msgbuf->tx_pktids, skb, ETH_HLEN, |
|---|
| 715 | 725 | &physaddr, &pktid)) { |
|---|
| 716 | 726 | brcmf_flowring_reinsert(flow, flowid, skb); |
|---|
| 717 | | - brcmf_err("No PKTID available !!\n"); |
|---|
| 727 | + bphy_err(drvr, "No PKTID available !!\n"); |
|---|
| 718 | 728 | break; |
|---|
| 719 | 729 | } |
|---|
| 720 | 730 | ret_ptr = brcmf_commonring_reserve_for_write(commonring); |
|---|
| .. | .. |
|---|
| 729 | 739 | tx_msghdr = (struct msgbuf_tx_msghdr *)ret_ptr; |
|---|
| 730 | 740 | |
|---|
| 731 | 741 | tx_msghdr->msg.msgtype = MSGBUF_TYPE_TX_POST; |
|---|
| 732 | | - tx_msghdr->msg.request_id = cpu_to_le32(pktid); |
|---|
| 742 | + tx_msghdr->msg.request_id = cpu_to_le32(pktid + 1); |
|---|
| 733 | 743 | tx_msghdr->msg.ifidx = brcmf_flowring_ifidx_get(flow, flowid); |
|---|
| 734 | 744 | tx_msghdr->flags = BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_3; |
|---|
| 735 | 745 | tx_msghdr->flags |= (skb->priority & 0x07) << |
|---|
| .. | .. |
|---|
| 866 | 876 | u16 flowid; |
|---|
| 867 | 877 | |
|---|
| 868 | 878 | tx_status = (struct msgbuf_tx_status *)buf; |
|---|
| 869 | | - idx = le32_to_cpu(tx_status->msg.request_id); |
|---|
| 879 | + idx = le32_to_cpu(tx_status->msg.request_id) - 1; |
|---|
| 870 | 880 | flowid = le16_to_cpu(tx_status->compl_hdr.flow_ring_id); |
|---|
| 871 | 881 | flowid -= BRCMF_H2D_MSGRING_FLOWRING_IDSTART; |
|---|
| 872 | 882 | skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, |
|---|
| .. | .. |
|---|
| 885 | 895 | |
|---|
| 886 | 896 | static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count) |
|---|
| 887 | 897 | { |
|---|
| 898 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 888 | 899 | struct brcmf_commonring *commonring; |
|---|
| 889 | 900 | void *ret_ptr; |
|---|
| 890 | 901 | struct sk_buff *skb; |
|---|
| .. | .. |
|---|
| 912 | 923 | skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE); |
|---|
| 913 | 924 | |
|---|
| 914 | 925 | if (skb == NULL) { |
|---|
| 915 | | - brcmf_err("Failed to alloc SKB\n"); |
|---|
| 926 | + bphy_err(drvr, "Failed to alloc SKB\n"); |
|---|
| 916 | 927 | brcmf_commonring_write_cancel(commonring, alloced - i); |
|---|
| 917 | 928 | break; |
|---|
| 918 | 929 | } |
|---|
| .. | .. |
|---|
| 922 | 933 | msgbuf->rx_pktids, skb, 0, |
|---|
| 923 | 934 | &physaddr, &pktid)) { |
|---|
| 924 | 935 | dev_kfree_skb_any(skb); |
|---|
| 925 | | - brcmf_err("No PKTID available !!\n"); |
|---|
| 936 | + bphy_err(drvr, "No PKTID available !!\n"); |
|---|
| 926 | 937 | brcmf_commonring_write_cancel(commonring, alloced - i); |
|---|
| 927 | 938 | break; |
|---|
| 928 | 939 | } |
|---|
| .. | .. |
|---|
| 992 | 1003 | brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf, |
|---|
| 993 | 1004 | u32 count) |
|---|
| 994 | 1005 | { |
|---|
| 1006 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 995 | 1007 | struct brcmf_commonring *commonring; |
|---|
| 996 | 1008 | void *ret_ptr; |
|---|
| 997 | 1009 | struct sk_buff *skb; |
|---|
| .. | .. |
|---|
| 1009 | 1021 | count, |
|---|
| 1010 | 1022 | &alloced); |
|---|
| 1011 | 1023 | if (!ret_ptr) { |
|---|
| 1012 | | - brcmf_err("Failed to reserve space in commonring\n"); |
|---|
| 1024 | + bphy_err(drvr, "Failed to reserve space in commonring\n"); |
|---|
| 1013 | 1025 | brcmf_commonring_unlock(commonring); |
|---|
| 1014 | 1026 | return 0; |
|---|
| 1015 | 1027 | } |
|---|
| .. | .. |
|---|
| 1018 | 1030 | rx_bufpost = (struct msgbuf_rx_ioctl_resp_or_event *)ret_ptr; |
|---|
| 1019 | 1031 | memset(rx_bufpost, 0, sizeof(*rx_bufpost)); |
|---|
| 1020 | 1032 | |
|---|
| 1021 | | - skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE); |
|---|
| 1033 | + skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_CTL_PKT_SIZE); |
|---|
| 1022 | 1034 | |
|---|
| 1023 | 1035 | if (skb == NULL) { |
|---|
| 1024 | | - brcmf_err("Failed to alloc SKB\n"); |
|---|
| 1036 | + bphy_err(drvr, "Failed to alloc SKB\n"); |
|---|
| 1025 | 1037 | brcmf_commonring_write_cancel(commonring, alloced - i); |
|---|
| 1026 | 1038 | break; |
|---|
| 1027 | 1039 | } |
|---|
| .. | .. |
|---|
| 1031 | 1043 | msgbuf->rx_pktids, skb, 0, |
|---|
| 1032 | 1044 | &physaddr, &pktid)) { |
|---|
| 1033 | 1045 | dev_kfree_skb_any(skb); |
|---|
| 1034 | | - brcmf_err("No PKTID available !!\n"); |
|---|
| 1046 | + bphy_err(drvr, "No PKTID available !!\n"); |
|---|
| 1035 | 1047 | brcmf_commonring_write_cancel(commonring, alloced - i); |
|---|
| 1036 | 1048 | break; |
|---|
| 1037 | 1049 | } |
|---|
| .. | .. |
|---|
| 1083 | 1095 | |
|---|
| 1084 | 1096 | static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf) |
|---|
| 1085 | 1097 | { |
|---|
| 1098 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1086 | 1099 | struct msgbuf_rx_event *event; |
|---|
| 1087 | 1100 | u32 idx; |
|---|
| 1088 | 1101 | u16 buflen; |
|---|
| .. | .. |
|---|
| 1109 | 1122 | |
|---|
| 1110 | 1123 | ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx); |
|---|
| 1111 | 1124 | if (!ifp || !ifp->ndev) { |
|---|
| 1112 | | - brcmf_err("Received pkt for invalid ifidx %d\n", |
|---|
| 1113 | | - event->msg.ifidx); |
|---|
| 1125 | + bphy_err(drvr, "Received pkt for invalid ifidx %d\n", |
|---|
| 1126 | + event->msg.ifidx); |
|---|
| 1114 | 1127 | goto exit; |
|---|
| 1115 | 1128 | } |
|---|
| 1116 | 1129 | |
|---|
| 1117 | 1130 | skb->protocol = eth_type_trans(skb, ifp->ndev); |
|---|
| 1118 | 1131 | |
|---|
| 1119 | | - brcmf_fweh_process_skb(ifp->drvr, skb, 0); |
|---|
| 1132 | + brcmf_fweh_process_skb(ifp->drvr, skb, 0, GFP_KERNEL); |
|---|
| 1120 | 1133 | |
|---|
| 1121 | 1134 | exit: |
|---|
| 1122 | 1135 | brcmu_pkt_buf_free_skb(skb); |
|---|
| .. | .. |
|---|
| 1126 | 1139 | static void |
|---|
| 1127 | 1140 | brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) |
|---|
| 1128 | 1141 | { |
|---|
| 1142 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1129 | 1143 | struct msgbuf_rx_complete *rx_complete; |
|---|
| 1130 | 1144 | struct sk_buff *skb; |
|---|
| 1131 | 1145 | u16 data_offset; |
|---|
| .. | .. |
|---|
| 1159 | 1173 | ifp = msgbuf->drvr->mon_if; |
|---|
| 1160 | 1174 | |
|---|
| 1161 | 1175 | if (!ifp) { |
|---|
| 1162 | | - brcmf_err("Received unexpected monitor pkt\n"); |
|---|
| 1176 | + bphy_err(drvr, "Received unexpected monitor pkt\n"); |
|---|
| 1163 | 1177 | brcmu_pkt_buf_free_skb(skb); |
|---|
| 1164 | 1178 | return; |
|---|
| 1165 | 1179 | } |
|---|
| .. | .. |
|---|
| 1170 | 1184 | |
|---|
| 1171 | 1185 | ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx); |
|---|
| 1172 | 1186 | if (!ifp || !ifp->ndev) { |
|---|
| 1173 | | - brcmf_err("Received pkt for invalid ifidx %d\n", |
|---|
| 1174 | | - rx_complete->msg.ifidx); |
|---|
| 1187 | + bphy_err(drvr, "Received pkt for invalid ifidx %d\n", |
|---|
| 1188 | + rx_complete->msg.ifidx); |
|---|
| 1175 | 1189 | brcmu_pkt_buf_free_skb(skb); |
|---|
| 1176 | 1190 | return; |
|---|
| 1177 | 1191 | } |
|---|
| 1178 | 1192 | |
|---|
| 1179 | 1193 | skb->protocol = eth_type_trans(skb, ifp->ndev); |
|---|
| 1180 | | - brcmf_netif_rx(ifp, skb); |
|---|
| 1194 | + brcmf_netif_rx(ifp, skb, false); |
|---|
| 1181 | 1195 | } |
|---|
| 1182 | 1196 | |
|---|
| 1197 | +static void brcmf_msgbuf_process_gen_status(struct brcmf_msgbuf *msgbuf, |
|---|
| 1198 | + void *buf) |
|---|
| 1199 | +{ |
|---|
| 1200 | + struct msgbuf_gen_status *gen_status = buf; |
|---|
| 1201 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1202 | + int err; |
|---|
| 1203 | + |
|---|
| 1204 | + err = le16_to_cpu(gen_status->compl_hdr.status); |
|---|
| 1205 | + if (err) |
|---|
| 1206 | + bphy_err(drvr, "Firmware reported general error: %d\n", err); |
|---|
| 1207 | +} |
|---|
| 1208 | + |
|---|
| 1209 | +static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf, |
|---|
| 1210 | + void *buf) |
|---|
| 1211 | +{ |
|---|
| 1212 | + struct msgbuf_ring_status *ring_status = buf; |
|---|
| 1213 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1214 | + int err; |
|---|
| 1215 | + |
|---|
| 1216 | + err = le16_to_cpu(ring_status->compl_hdr.status); |
|---|
| 1217 | + if (err) { |
|---|
| 1218 | + int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id); |
|---|
| 1219 | + |
|---|
| 1220 | + bphy_err(drvr, "Firmware reported ring %d error: %d\n", ring, |
|---|
| 1221 | + err); |
|---|
| 1222 | + } |
|---|
| 1223 | +} |
|---|
| 1183 | 1224 | |
|---|
| 1184 | 1225 | static void |
|---|
| 1185 | 1226 | brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf, |
|---|
| 1186 | 1227 | void *buf) |
|---|
| 1187 | 1228 | { |
|---|
| 1229 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1188 | 1230 | struct msgbuf_flowring_create_resp *flowring_create_resp; |
|---|
| 1189 | 1231 | u16 status; |
|---|
| 1190 | 1232 | u16 flowid; |
|---|
| .. | .. |
|---|
| 1196 | 1238 | status = le16_to_cpu(flowring_create_resp->compl_hdr.status); |
|---|
| 1197 | 1239 | |
|---|
| 1198 | 1240 | if (status) { |
|---|
| 1199 | | - brcmf_err("Flowring creation failed, code %d\n", status); |
|---|
| 1241 | + bphy_err(drvr, "Flowring creation failed, code %d\n", status); |
|---|
| 1200 | 1242 | brcmf_msgbuf_remove_flowring(msgbuf, flowid); |
|---|
| 1201 | 1243 | return; |
|---|
| 1202 | 1244 | } |
|---|
| .. | .. |
|---|
| 1213 | 1255 | brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf, |
|---|
| 1214 | 1256 | void *buf) |
|---|
| 1215 | 1257 | { |
|---|
| 1258 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1216 | 1259 | struct msgbuf_flowring_delete_resp *flowring_delete_resp; |
|---|
| 1217 | 1260 | u16 status; |
|---|
| 1218 | 1261 | u16 flowid; |
|---|
| .. | .. |
|---|
| 1224 | 1267 | status = le16_to_cpu(flowring_delete_resp->compl_hdr.status); |
|---|
| 1225 | 1268 | |
|---|
| 1226 | 1269 | if (status) { |
|---|
| 1227 | | - brcmf_err("Flowring deletion failed, code %d\n", status); |
|---|
| 1270 | + bphy_err(drvr, "Flowring deletion failed, code %d\n", status); |
|---|
| 1228 | 1271 | brcmf_flowring_delete(msgbuf->flow, flowid); |
|---|
| 1229 | 1272 | return; |
|---|
| 1230 | 1273 | } |
|---|
| .. | .. |
|---|
| 1237 | 1280 | |
|---|
| 1238 | 1281 | static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf) |
|---|
| 1239 | 1282 | { |
|---|
| 1283 | + struct brcmf_pub *drvr = msgbuf->drvr; |
|---|
| 1240 | 1284 | struct msgbuf_common_hdr *msg; |
|---|
| 1241 | 1285 | |
|---|
| 1242 | 1286 | msg = (struct msgbuf_common_hdr *)buf; |
|---|
| 1243 | 1287 | switch (msg->msgtype) { |
|---|
| 1288 | + case MSGBUF_TYPE_GEN_STATUS: |
|---|
| 1289 | + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_GEN_STATUS\n"); |
|---|
| 1290 | + brcmf_msgbuf_process_gen_status(msgbuf, buf); |
|---|
| 1291 | + break; |
|---|
| 1292 | + case MSGBUF_TYPE_RING_STATUS: |
|---|
| 1293 | + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n"); |
|---|
| 1294 | + brcmf_msgbuf_process_ring_status(msgbuf, buf); |
|---|
| 1295 | + break; |
|---|
| 1244 | 1296 | case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT: |
|---|
| 1245 | 1297 | brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n"); |
|---|
| 1246 | 1298 | brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf); |
|---|
| .. | .. |
|---|
| 1269 | 1321 | brcmf_msgbuf_process_rx_complete(msgbuf, buf); |
|---|
| 1270 | 1322 | break; |
|---|
| 1271 | 1323 | default: |
|---|
| 1272 | | - brcmf_err("Unsupported msgtype %d\n", msg->msgtype); |
|---|
| 1324 | + bphy_err(drvr, "Unsupported msgtype %d\n", msg->msgtype); |
|---|
| 1273 | 1325 | break; |
|---|
| 1274 | 1326 | } |
|---|
| 1275 | 1327 | } |
|---|
| .. | .. |
|---|
| 1348 | 1400 | u8 ifidx; |
|---|
| 1349 | 1401 | int err; |
|---|
| 1350 | 1402 | |
|---|
| 1403 | + /* no need to submit if firmware can not be reached */ |
|---|
| 1404 | + if (drvr->bus_if->state != BRCMF_BUS_UP) { |
|---|
| 1405 | + brcmf_dbg(MSGBUF, "bus down, flowring will be removed\n"); |
|---|
| 1406 | + brcmf_msgbuf_remove_flowring(msgbuf, flowid); |
|---|
| 1407 | + return; |
|---|
| 1408 | + } |
|---|
| 1409 | + |
|---|
| 1351 | 1410 | commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT]; |
|---|
| 1352 | 1411 | brcmf_commonring_lock(commonring); |
|---|
| 1353 | 1412 | ret_ptr = brcmf_commonring_reserve_for_write(commonring); |
|---|
| 1354 | 1413 | if (!ret_ptr) { |
|---|
| 1355 | | - brcmf_err("FW unaware, flowring will be removed !!\n"); |
|---|
| 1414 | + bphy_err(drvr, "FW unaware, flowring will be removed !!\n"); |
|---|
| 1356 | 1415 | brcmf_commonring_unlock(commonring); |
|---|
| 1357 | 1416 | brcmf_msgbuf_remove_flowring(msgbuf, flowid); |
|---|
| 1358 | 1417 | return; |
|---|
| .. | .. |
|---|
| 1376 | 1435 | err = brcmf_commonring_write_complete(commonring); |
|---|
| 1377 | 1436 | brcmf_commonring_unlock(commonring); |
|---|
| 1378 | 1437 | if (err) { |
|---|
| 1379 | | - brcmf_err("Failed to submit RING_DELETE, flowring will be removed\n"); |
|---|
| 1438 | + bphy_err(drvr, "Failed to submit RING_DELETE, flowring will be removed\n"); |
|---|
| 1380 | 1439 | brcmf_msgbuf_remove_flowring(msgbuf, flowid); |
|---|
| 1381 | 1440 | } |
|---|
| 1382 | 1441 | } |
|---|
| .. | .. |
|---|
| 1411 | 1470 | seq_printf(seq, "\nh2d_flowrings: depth %u\n", |
|---|
| 1412 | 1471 | BRCMF_H2D_TXFLOWRING_MAX_ITEM); |
|---|
| 1413 | 1472 | seq_puts(seq, "Active flowrings:\n"); |
|---|
| 1414 | | - hash = msgbuf->flow->hash; |
|---|
| 1415 | 1473 | for (i = 0; i < msgbuf->flow->nrofrings; i++) { |
|---|
| 1416 | 1474 | if (!msgbuf->flow->rings[i]) |
|---|
| 1417 | 1475 | continue; |
|---|
| .. | .. |
|---|
| 1451 | 1509 | if_msgbuf = drvr->bus_if->msgbuf; |
|---|
| 1452 | 1510 | |
|---|
| 1453 | 1511 | if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) { |
|---|
| 1454 | | - brcmf_err("driver not configured for this many flowrings %d\n", |
|---|
| 1455 | | - if_msgbuf->max_flowrings); |
|---|
| 1512 | + bphy_err(drvr, "driver not configured for this many flowrings %d\n", |
|---|
| 1513 | + if_msgbuf->max_flowrings); |
|---|
| 1456 | 1514 | if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1; |
|---|
| 1457 | 1515 | } |
|---|
| 1458 | 1516 | |
|---|
| .. | .. |
|---|
| 1462 | 1520 | |
|---|
| 1463 | 1521 | msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow"); |
|---|
| 1464 | 1522 | if (msgbuf->txflow_wq == NULL) { |
|---|
| 1465 | | - brcmf_err("workqueue creation failed\n"); |
|---|
| 1523 | + bphy_err(drvr, "workqueue creation failed\n"); |
|---|
| 1466 | 1524 | goto fail; |
|---|
| 1467 | 1525 | } |
|---|
| 1468 | 1526 | INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker); |
|---|