\hypertarget{lio__response__manager_8c_source}{}\doxysection{lio\+\_\+response\+\_\+manager.\+c}
\label{lio__response__manager_8c_source}\index{dev/liquidio/base/lio\_response\_manager.c@{dev/liquidio/base/lio\_response\_manager.c}}
\mbox{\hyperlink{lio__response__manager_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00002}00002 \textcolor{comment}{ *   BSD LICENSE}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00004}00004 \textcolor{comment}{ *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00005}00005 \textcolor{comment}{ *   All rights reserved.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00007}00007 \textcolor{comment}{ *   Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00008}00008 \textcolor{comment}{ *   modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00009}00009 \textcolor{comment}{ *   are met:}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00011}00011 \textcolor{comment}{ *     * Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00012}00012 \textcolor{comment}{ *       notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00013}00013 \textcolor{comment}{ *     * Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00014}00014 \textcolor{comment}{ *       notice, this list of conditions and the following disclaimer in}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00015}00015 \textcolor{comment}{ *       the documentation and/or other materials provided with the}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00016}00016 \textcolor{comment}{ *       distribution.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00017}00017 \textcolor{comment}{ *     * Neither the name of Cavium, Inc. nor the names of its}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00018}00018 \textcolor{comment}{ *       contributors may be used to endorse or promote products derived}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00019}00019 \textcolor{comment}{ *       from this software without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00020}00020 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00021}00021 \textcolor{comment}{ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00022}00022 \textcolor{comment}{ *   "{}AS IS"{} AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00023}00023 \textcolor{comment}{ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00024}00024 \textcolor{comment}{ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00025}00025 \textcolor{comment}{ *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00026}00026 \textcolor{comment}{ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00027}00027 \textcolor{comment}{ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00028}00028 \textcolor{comment}{ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00029}00029 \textcolor{comment}{ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00030}00030 \textcolor{comment}{ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00031}00031 \textcolor{comment}{ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00033}00033 \textcolor{comment}{/*\$FreeBSD\$*/}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__bsd_8h}{lio\_bsd.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__common_8h}{lio\_common.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00037}00037 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__droq_8h}{lio\_droq.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00038}00038 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__iq_8h}{lio\_iq.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00039}00039 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__response__manager_8h}{lio\_response\_manager.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00040}00040 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__device_8h}{lio\_device.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00041}00041 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__main_8h}{lio\_main.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00042}00042 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00043}00043 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{lio__response__manager_8c_adee789ef871353005278b9e4fc329786}{lio\_poll\_req\_completion}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} pending);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00045}00045 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00046}\mbox{\hyperlink{lio__response__manager_8c_afe976f8f6ea19005fe982ff1326ff68f}{00046}} \mbox{\hyperlink{lio__response__manager_8c_afe976f8f6ea19005fe982ff1326ff68f}{lio\_setup\_response\_list}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct)}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00047}00047 \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00048}00048         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__tq}{lio\_tq}}     *ctq;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00049}00049         \textcolor{keywordtype}{int}             i, ret = 0;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00051}00051         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{lio__config_8h_a9ba331cfd24e0831512d6d0cd81dc2d9}{LIO\_MAX\_RESPONSE\_LISTS}}; i++) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00052}00052                 STAILQ\_INIT(\&oct-\/>\mbox{\hyperlink{structocteon__device_ad426f813a4e8c575116987354206fb52}{response\_list}}[i].\mbox{\hyperlink{structlio__response__list_acc17ce9bbb9961014cbd321d0ccea518}{head}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00053}00053                 mtx\_init(\&oct-\/>\mbox{\hyperlink{structocteon__device_ad426f813a4e8c575116987354206fb52}{response\_list}}[i].\mbox{\hyperlink{structlio__response__list_ace43bc509dbd78806cea845a98ace1f3}{lock}}, \textcolor{stringliteral}{"{}response\_list\_lock"{}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00054}00054                          NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00055}00055                 atomic\_store\_rel\_int(\&oct-\/>\mbox{\hyperlink{structocteon__device_ad426f813a4e8c575116987354206fb52}{response\_list}}[i].\mbox{\hyperlink{structlio__response__list_ac81957c356c41ee1198ece6bd4624e1e}{pending\_req\_count}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00056}00056                                      0);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00057}00057         \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00058}00058         mtx\_init(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3dfa98f1e7bb87114ed8d2f54f3a73bd}{cmd\_resp\_wqlock}}, \textcolor{stringliteral}{"{}cmd\_resp\_wqlock"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00060}00060         ctq = \&oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00061}00061         ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}} = taskqueue\_create(\textcolor{stringliteral}{"{}lio\_dma\_comp"{}}, M\_WAITOK,}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00062}00062                                    taskqueue\_thread\_enqueue, \&ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00063}00063         \textcolor{keywordflow}{if} (ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00064}00064                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}failed to create wq thread\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00065}00065                 \textcolor{keywordflow}{return} (-\/ENOMEM);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00066}00066         \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00067}00067 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00068}00068         TIMEOUT\_TASK\_INIT(ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}}, \&ctq-\/>\mbox{\hyperlink{structlio__tq_a93a5d499ac3cec352a5bed558ec35168}{work}}, 0, \mbox{\hyperlink{lio__response__manager_8c_adee789ef871353005278b9e4fc329786}{lio\_poll\_req\_completion}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00069}00069                           (\textcolor{keywordtype}{void} *)ctq);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00070}00070         ctq-\/>\mbox{\hyperlink{structlio__tq_a5770f6cc05773a63e58dd8f6ed1006af}{ctxptr}} = oct;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00072}00072         oct-\/>\mbox{\hyperlink{structocteon__device_a87d0a062a62b952cc55818560584ec57}{cmd\_resp\_state}} = \mbox{\hyperlink{lio__device_8h_a544a9e047ad85ad31aa681a94f1b0317}{LIO\_DRV\_ONLINE}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00073}00073         taskqueue\_start\_threads(\&ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}}, 1, PI\_NET, \textcolor{stringliteral}{"{}lio\%d\_dma\_comp"{}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00074}00074                                 oct-\/>\mbox{\hyperlink{structocteon__device_a6574a7bba62b9a35337dfe332ac83799}{octeon\_id}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00075}00075         taskqueue\_enqueue\_timeout(ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}}, \&ctq-\/>\mbox{\hyperlink{structlio__tq_a93a5d499ac3cec352a5bed558ec35168}{work}}, \mbox{\hyperlink{lio__bsd_8h_ae6eb6d875a682c72af6de3d0fa0876e5}{lio\_ms\_to\_ticks}}(50));}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00076}00076 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00077}00077         \textcolor{keywordflow}{return} (ret);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00078}00078 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00079}00079 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00080}00080 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00081}\mbox{\hyperlink{lio__response__manager_8c_ada7b712587ce5cb34fd4ae610def0296}{00081}} \mbox{\hyperlink{lio__response__manager_8c_ada7b712587ce5cb34fd4ae610def0296}{lio\_delete\_response\_list}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct)}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00082}00082 \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00084}00084         \textcolor{keywordflow}{if} (oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00085}00085                 \textcolor{keywordflow}{while} (taskqueue\_cancel\_timeout(oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00086}00086                                                 \&oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a93a5d499ac3cec352a5bed558ec35168}{work}}, NULL))}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00087}00087                         taskqueue\_drain\_timeout(oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00088}00088                                                 \&oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a93a5d499ac3cec352a5bed558ec35168}{work}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00089}00089                 taskqueue\_free(oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00090}00090                 oct-\/>\mbox{\hyperlink{structocteon__device_ac369571f467beef71fdff7945f234726}{dma\_comp\_tq}}.\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}} = NULL;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00091}00091         \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00092}00092 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00094}00094 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00095}\mbox{\hyperlink{lio__response__manager_8c_a215c9a1987332f1b9da4ba17f13f43df}{00095}} \mbox{\hyperlink{lio__response__manager_8c_a215c9a1987332f1b9da4ba17f13f43df}{lio\_process\_ordered\_list}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *octeon\_dev,}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00096}00096                          uint32\_t force\_quit)}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00097}00097 \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00098}00098         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__response__list}{lio\_response\_list}}       *ordered\_sc\_list;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00099}00099         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}}         *sc;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00100}00100         uint64\_t                        status64;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00101}00101         uint32\_t                        status;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00102}00102         \textcolor{keywordtype}{int}                             request\_complete = 0;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00103}00103         \textcolor{keywordtype}{int}                             resp\_to\_process;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00105}00105         resp\_to\_process = \mbox{\hyperlink{lio__response__manager_8h_ae9eac2b6733070c812155e71d2a4f5c0}{LIO\_MAX\_ORD\_REQS\_TO\_PROCESS}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00107}00107         ordered\_sc\_list = \&octeon\_dev-\/>\mbox{\hyperlink{structocteon__device_ad426f813a4e8c575116987354206fb52}{response\_list}}[\mbox{\hyperlink{lio__response__manager_8h_aaf105ae5beaca1dee30ae54530691fcea5422bc0a9ca1817fa2fed27de3788a37}{LIO\_ORDERED\_SC\_LIST}}];}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00108}00108 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00109}00109         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00110}00110                 mtx\_lock(\&ordered\_sc\_list-\/>\mbox{\hyperlink{structlio__response__list_ace43bc509dbd78806cea845a98ace1f3}{lock}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00111}00111 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00112}00112                 \textcolor{keywordflow}{if} (STAILQ\_EMPTY(\&ordered\_sc\_list-\/>\mbox{\hyperlink{structlio__response__list_acc17ce9bbb9961014cbd321d0ccea518}{head}})) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00113}00113                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00114}00114 \textcolor{comment}{                         * ordered\_sc\_list is empty; there is nothing to}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00115}00115 \textcolor{comment}{                         * process}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00116}00116 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00117}00117                         mtx\_unlock(\&ordered\_sc\_list-\/>\mbox{\hyperlink{structlio__response__list_ace43bc509dbd78806cea845a98ace1f3}{lock}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00118}00118                         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00119}00119                 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00121}00121                 sc = \mbox{\hyperlink{lio__response__manager_8h_a8efea90da41534b9bf4cbb9d39d2af31}{LIO\_STAILQ\_FIRST\_ENTRY}}(\&ordered\_sc\_list-\/>\mbox{\hyperlink{structlio__response__list_acc17ce9bbb9961014cbd321d0ccea518}{head}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00122}00122                                             \textcolor{keyword}{struct} \mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}}, \mbox{\hyperlink{structlio__soft__command_abddb60881d4717d684ca6a1707b5c960}{node}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00123}00123 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00124}00124                 status = \mbox{\hyperlink{lio__response__manager_8h_a80155586fa275b28773c9b203f52cabaa61ed78c6befb10da6a9111e160013c55}{LIO\_REQUEST\_PENDING}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00126}00126                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00127}00127 \textcolor{comment}{                 * check if octeon has finished DMA'ing a response to where}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00128}00128 \textcolor{comment}{                 * rptr is pointing to}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00129}00129 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00130}00130                 status64 = *sc-\/>\mbox{\hyperlink{structlio__soft__command_a01a8cb64ee068bdd3ba55f404a99af56}{status\_word}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00131}00131 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00132}00132                 \textcolor{keywordflow}{if} (status64 != \mbox{\hyperlink{lio__iq_8h_a54ac797cb9154664456e42f47a4ab860}{COMPLETION\_WORD\_INIT}}) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00133}00133                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00134}00134 \textcolor{comment}{                         * This logic ensures that all 64b have been written.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00135}00135 \textcolor{comment}{                         * 1. check byte 0 for non-\/FF}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00136}00136 \textcolor{comment}{                         * 2. if non-\/FF, then swap result from BE to host order}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00137}00137 \textcolor{comment}{                         * 3. check byte 7 (swapped to 0) for non-\/FF}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00138}00138 \textcolor{comment}{                         * 4. if non-\/FF, use the low 32-\/bit status code}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00139}00139 \textcolor{comment}{                         * 5. if either byte 0 or byte 7 is FF, don't use status}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00140}00140 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00141}00141                         \textcolor{keywordflow}{if} ((status64 \& 0xff) != 0xff) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00142}00142                                 \mbox{\hyperlink{lio__main_8h_ab294e8e0e748bf0d78f5c1c0283a79cf}{lio\_swap\_8B\_data}}(\&status64, 1);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00143}00143                                 \textcolor{keywordflow}{if} (((status64 \& 0xff) != 0xff)) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00144}00144                                         \textcolor{comment}{/* retrieve 16-\/bit firmware status */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00145}00145                                         status = (uint32\_t)(status64 \&}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00146}00146                                                             0xffffULL);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00147}00147                                         \textcolor{keywordflow}{if} (status) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00148}00148                                                 status = \mbox{\hyperlink{lio__response__manager_8h_ad2f0d9dec95570b343f8d9de1beced39}{LIO\_FW\_STATUS\_CODE}}(}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00149}00149                                                                         status);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00150}00150                                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00151}00151                                                 \textcolor{comment}{/* i.e. no error */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00152}00152                                                 status = \mbox{\hyperlink{lio__response__manager_8h_a80155586fa275b28773c9b203f52cabaa216c91047b7304dc94d9dad0459daf60}{LIO\_REQUEST\_DONE}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00153}00153                                         \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00154}00154                                 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00155}00155                         \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00156}00156                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (force\_quit || (sc-\/>\mbox{\hyperlink{structlio__soft__command_aac44b9c90f9a025341b26e9fc101ec86}{timeout}} \&\&}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00157}00157                            \mbox{\hyperlink{lio__bsd_8h_acf7d0437f6cf08fe1df1b265b83362f0}{lio\_check\_timeout}}(ticks, sc-\/>\mbox{\hyperlink{structlio__soft__command_aac44b9c90f9a025341b26e9fc101ec86}{timeout}}))) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00158}00158                         \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(octeon\_dev, \textcolor{stringliteral}{"{}\%s: cmd failed, timeout (\%u, \%u)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00159}00159                                     \_\_func\_\_, ticks, sc-\/>\mbox{\hyperlink{structlio__soft__command_aac44b9c90f9a025341b26e9fc101ec86}{timeout}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00160}00160                         status = \mbox{\hyperlink{lio__response__manager_8h_a80155586fa275b28773c9b203f52cabaaac8d449b4bd856dbca3724edacf5fc5d}{LIO\_REQUEST\_TIMEOUT}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00161}00161                 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00162}00162 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00163}00163                 \textcolor{keywordflow}{if} (status != \mbox{\hyperlink{lio__response__manager_8h_a80155586fa275b28773c9b203f52cabaa61ed78c6befb10da6a9111e160013c55}{LIO\_REQUEST\_PENDING}}) \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00164}00164                         \textcolor{comment}{/* we have received a response or we have timed out */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00165}00165                         \textcolor{comment}{/* remove node from linked list */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00166}00166                         STAILQ\_REMOVE(\&octeon\_dev-\/>\mbox{\hyperlink{structocteon__device_ad426f813a4e8c575116987354206fb52}{response\_list}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00167}00167                                       [\mbox{\hyperlink{lio__response__manager_8h_aaf105ae5beaca1dee30ae54530691fcea5422bc0a9ca1817fa2fed27de3788a37}{LIO\_ORDERED\_SC\_LIST}}].\mbox{\hyperlink{structlio__response__list_acc17ce9bbb9961014cbd321d0ccea518}{head}},}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00168}00168                                       \&sc-\/>\mbox{\hyperlink{structlio__soft__command_abddb60881d4717d684ca6a1707b5c960}{node}}, \mbox{\hyperlink{structlio__stailq__node}{lio\_stailq\_node}}, entries);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00169}00169                         atomic\_subtract\_int(\&octeon\_dev-\/>\mbox{\hyperlink{structocteon__device_ad426f813a4e8c575116987354206fb52}{response\_list}}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00170}00170                                             [\mbox{\hyperlink{lio__response__manager_8h_aaf105ae5beaca1dee30ae54530691fcea5422bc0a9ca1817fa2fed27de3788a37}{LIO\_ORDERED\_SC\_LIST}}].}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00171}00171                                             pending\_req\_count, 1);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00172}00172                         mtx\_unlock(\&ordered\_sc\_list-\/>\mbox{\hyperlink{structlio__response__list_ace43bc509dbd78806cea845a98ace1f3}{lock}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00173}00173 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00174}00174                         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structlio__soft__command_a912a296891fe84dc401a7219a8847063}{callback}} != NULL)}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00175}00175                                 sc-\/>\mbox{\hyperlink{structlio__soft__command_a912a296891fe84dc401a7219a8847063}{callback}}(octeon\_dev, status,}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00176}00176                                              sc-\/>\mbox{\hyperlink{structlio__soft__command_a998df93b613de98f6a4f5f47ac72f64a}{callback\_arg}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00178}00178                         request\_complete++;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00179}00179 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00180}00180                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00181}00181                         \textcolor{comment}{/* no response yet */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00182}00182                         request\_complete = 0;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00183}00183                         mtx\_unlock(\&ordered\_sc\_list-\/>\mbox{\hyperlink{structlio__response__list_ace43bc509dbd78806cea845a98ace1f3}{lock}});}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00184}00184                 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00185}00185 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00186}00186                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00187}00187 \textcolor{comment}{                 * If we hit the Max Ordered requests to process every loop,}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00188}00188 \textcolor{comment}{                 * we quit and let this function be invoked the next time}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00189}00189 \textcolor{comment}{                 * the poll thread runs to process the remaining requests.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00190}00190 \textcolor{comment}{                 * This function can take up the entire CPU if there is no}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00191}00191 \textcolor{comment}{                 * upper limit to the requests processed.}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00192}00192 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00193}00193                 \textcolor{keywordflow}{if} (request\_complete >= resp\_to\_process)}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00194}00194                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00195}00195         \} \textcolor{keywordflow}{while} (request\_complete);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00197}00197         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00198}00198 \}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00200}00200 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00201}\mbox{\hyperlink{lio__response__manager_8c_adee789ef871353005278b9e4fc329786}{00201}} \mbox{\hyperlink{lio__response__manager_8c_adee789ef871353005278b9e4fc329786}{lio\_poll\_req\_completion}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} pending)}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00202}00202 \{}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00203}00203         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__tq}{lio\_tq}}             *ctq = (\textcolor{keyword}{struct }\mbox{\hyperlink{structlio__tq}{lio\_tq}} *)arg;}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00204}00204         \textcolor{keyword}{struct }\mbox{\hyperlink{structocteon__device}{octeon\_device}}       *oct = (\textcolor{keyword}{struct }\mbox{\hyperlink{structocteon__device}{octeon\_device}} *)ctq-\/>\mbox{\hyperlink{structlio__tq_a5770f6cc05773a63e58dd8f6ed1006af}{ctxptr}};}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00205}00205 }
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00206}00206         \mbox{\hyperlink{lio__response__manager_8c_a215c9a1987332f1b9da4ba17f13f43df}{lio\_process\_ordered\_list}}(oct, 0);}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00207}00207         taskqueue\_enqueue\_timeout(ctq-\/>\mbox{\hyperlink{structlio__tq_a367b9bb34b913f264e45e286ccc9b499}{tq}}, \&ctq-\/>\mbox{\hyperlink{structlio__tq_a93a5d499ac3cec352a5bed558ec35168}{work}}, \mbox{\hyperlink{lio__bsd_8h_ae6eb6d875a682c72af6de3d0fa0876e5}{lio\_ms\_to\_ticks}}(50));}
\DoxyCodeLine{\Hypertarget{lio__response__manager_8c_source_l00208}00208 \}}

\end{DoxyCode}
