\hypertarget{lio__ctrl_8c_source}{}\doxysection{lio\+\_\+ctrl.\+c}
\label{lio__ctrl_8c_source}\index{dev/liquidio/base/lio\_ctrl.c@{dev/liquidio/base/lio\_ctrl.c}}
\mbox{\hyperlink{lio__ctrl_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00002}00002 \textcolor{comment}{ *   BSD LICENSE}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00004}00004 \textcolor{comment}{ *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00005}00005 \textcolor{comment}{ *   All rights reserved.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00007}00007 \textcolor{comment}{ *   Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00008}00008 \textcolor{comment}{ *   modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00009}00009 \textcolor{comment}{ *   are met:}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00011}00011 \textcolor{comment}{ *     * Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00012}00012 \textcolor{comment}{ *       notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00013}00013 \textcolor{comment}{ *     * Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00014}00014 \textcolor{comment}{ *       notice, this list of conditions and the following disclaimer in}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00015}00015 \textcolor{comment}{ *       the documentation and/or other materials provided with the}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00016}00016 \textcolor{comment}{ *       distribution.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00017}00017 \textcolor{comment}{ *     * Neither the name of Cavium, Inc. nor the names of its}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00018}00018 \textcolor{comment}{ *       contributors may be used to endorse or promote products derived}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00019}00019 \textcolor{comment}{ *       from this software without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00020}00020 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00021}00021 \textcolor{comment}{ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00022}00022 \textcolor{comment}{ *   "{}AS IS"{} AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00023}00023 \textcolor{comment}{ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00024}00024 \textcolor{comment}{ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00025}00025 \textcolor{comment}{ *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00026}00026 \textcolor{comment}{ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00027}00027 \textcolor{comment}{ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00028}00028 \textcolor{comment}{ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00029}00029 \textcolor{comment}{ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00030}00030 \textcolor{comment}{ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00031}00031 \textcolor{comment}{ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00033}00033 \textcolor{comment}{/*\$FreeBSD\$*/}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__bsd_8h}{lio\_bsd.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__common_8h}{lio\_common.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00037}00037 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__droq_8h}{lio\_droq.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00038}00038 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__iq_8h}{lio\_iq.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00039}00039 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__response__manager_8h}{lio\_response\_manager.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00040}00040 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__device_8h}{lio\_device.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00041}00041 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__ctrl_8h}{lio\_ctrl.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00042}00042 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__main_8h}{lio\_main.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00044}00044 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00045}\mbox{\hyperlink{lio__ctrl_8c_a983d3d30828169adae4e8a58c1817fd1}{00045}} \mbox{\hyperlink{lio__ctrl_8c_a983d3d30828169adae4e8a58c1817fd1}{lio\_send\_data\_pkt}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{struct} \mbox{\hyperlink{structlio__data__pkt}{lio\_data\_pkt}} *ndata)}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00046}00046 \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00047}00047         \textcolor{keywordtype}{int}     ring\_doorbell = 1;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00049}00049         \textcolor{keywordflow}{return} (\mbox{\hyperlink{lio__iq_8h_ad69baa289afaf465ca55687cba8f8ff0}{lio\_send\_command}}(oct, ndata-\/>\mbox{\hyperlink{structlio__data__pkt_aeff507c9edb9a92de781b0165a1a71c5}{q\_no}}, ring\_doorbell, \&ndata-\/>\mbox{\hyperlink{structlio__data__pkt_ae77ae7d3c0659157efda0c0230405e7c}{cmd}},}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00050}00050                                  ndata-\/>\mbox{\hyperlink{structlio__data__pkt_a325b2e2eb843eebc6b9bc24a35126a28}{buf}}, ndata-\/>\mbox{\hyperlink{structlio__data__pkt_a5c58b99afb9a5b22f18af7c410d12715}{datasize}}, ndata-\/>\mbox{\hyperlink{structlio__data__pkt_a91149557742e4d8874c1576a98455555}{reqtype}}));}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00051}00051 \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00052}00052 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00053}00053 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00054}\mbox{\hyperlink{lio__ctrl_8c_a2214608728cc814b88a54d3cc479bb56}{00054}} \mbox{\hyperlink{lio__ctrl_8c_a2214608728cc814b88a54d3cc479bb56}{lio\_ctrl\_callback}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, uint32\_t status, \textcolor{keywordtype}{void} *sc\_ptr)}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00055}00055 \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00056}00056         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}} *sc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}} *)sc\_ptr;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00057}00057         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__ctrl__pkt}{lio\_ctrl\_pkt}} *nctrl;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00059}00059         nctrl = (\textcolor{keyword}{struct }\mbox{\hyperlink{structlio__ctrl__pkt}{lio\_ctrl\_pkt}} *)sc-\/>\mbox{\hyperlink{structlio__soft__command_a288d7c6ce348f6c917681748ebf432fd}{ctxptr}};}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00060}00060 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00061}00061         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00062}00062 \textcolor{comment}{         * Call the callback function if status is OK.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00063}00063 \textcolor{comment}{         * Status is OK only if a response was expected and core returned}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00064}00064 \textcolor{comment}{         * success.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00065}00065 \textcolor{comment}{         * If no response was expected, status is OK if the command was posted}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00066}00066 \textcolor{comment}{         * successfully.}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00067}00067 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00068}00068         if (!status \&\& nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_adcc5ed7ab9f23d57202ceff098fa2146}{cb\_fn}})}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00069}00069                 nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_adcc5ed7ab9f23d57202ceff098fa2146}{cb\_fn}}(nctrl);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00071}00071         \mbox{\hyperlink{lio__iq_8h_aeacdddc60eaf524a3482cbd54a8e6fb0}{lio\_free\_soft\_command}}(oct, sc);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00072}00072 \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00074}00074 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}} *}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00075}\mbox{\hyperlink{lio__ctrl_8c_a43bfc3089b31e04bb164007e936bb559}{00075}} \mbox{\hyperlink{lio__ctrl_8c_a43bfc3089b31e04bb164007e936bb559}{lio\_alloc\_ctrl\_pkt\_sc}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{struct} \mbox{\hyperlink{structlio__ctrl__pkt}{lio\_ctrl\_pkt}} *nctrl)}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00076}00076 \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00077}00077         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}} *sc = NULL;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00078}00078         uint32\_t                \mbox{\hyperlink{structlio__soft__command_a1de9fae89229b51c7a51950253bbe3e1}{datasize}} = 0, \mbox{\hyperlink{structlio__soft__command_a604102083dd4445c12ca625394e8ebd5}{rdatasize}}, uddsize = 0;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00079}00079         uint8\_t                 *data;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00081}00081         uddsize = (uint32\_t)(nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a5ba377c8c6282ebc84f072360d28a1f7}{ncmd}}.\mbox{\hyperlink{unionocteon__cmd_ad5cae7e8f601a66277962156b10a211e}{s}}.\mbox{\hyperlink{unionocteon__cmd_a48075978cb26b25ae85be6484106c67e}{more}} * 8);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00082}00082 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00083}00083         \mbox{\hyperlink{structlio__soft__command_a1de9fae89229b51c7a51950253bbe3e1}{datasize}} = \mbox{\hyperlink{lio__common_8h_ae5c5b88cddd153bccec303ce6be63718}{OCTEON\_CMD\_SIZE}} + uddsize;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00084}00084         \mbox{\hyperlink{structlio__soft__command_a604102083dd4445c12ca625394e8ebd5}{rdatasize}} = (nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a4415355127c5111f0570276c84d198a6}{wait\_time}}) ? 16 : 0;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00086}00086         sc = \mbox{\hyperlink{lio__iq_8h_add1cd4d610e5132e206f17aa347c6116}{lio\_alloc\_soft\_command}}(oct, \mbox{\hyperlink{structlio__soft__command_a1de9fae89229b51c7a51950253bbe3e1}{datasize}}, \mbox{\hyperlink{structlio__soft__command_a604102083dd4445c12ca625394e8ebd5}{rdatasize}},}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00087}00087                                     \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__ctrl__pkt}{lio\_ctrl\_pkt}}));}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00089}00089         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00090}00090                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00092}00092         memcpy(sc-\/>\mbox{\hyperlink{structlio__soft__command_a288d7c6ce348f6c917681748ebf432fd}{ctxptr}}, nctrl, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__ctrl__pkt}{lio\_ctrl\_pkt}}));}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00094}00094         data = (uint8\_t *)sc-\/>\mbox{\hyperlink{structlio__soft__command_acaf5313ed39db3b404d471eb73a6494d}{virtdptr}};}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00095}00095 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00096}00096         memcpy(data, \&nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a5ba377c8c6282ebc84f072360d28a1f7}{ncmd}}, \mbox{\hyperlink{lio__common_8h_ae5c5b88cddd153bccec303ce6be63718}{OCTEON\_CMD\_SIZE}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00098}00098         \mbox{\hyperlink{lio__main_8h_ab294e8e0e748bf0d78f5c1c0283a79cf}{lio\_swap\_8B\_data}}((uint64\_t *)data, (\mbox{\hyperlink{lio__common_8h_ae5c5b88cddd153bccec303ce6be63718}{OCTEON\_CMD\_SIZE}} >> 3));}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00100}00100         \textcolor{keywordflow}{if} (uddsize) \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00101}00101                 \textcolor{comment}{/* Endian-\/Swap for UDD should have been done by caller. */}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00102}00102                 memcpy(data + \mbox{\hyperlink{lio__common_8h_ae5c5b88cddd153bccec303ce6be63718}{OCTEON\_CMD\_SIZE}}, nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a28267e63df880b3b6db971acee391cf5}{udd}}, uddsize);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00103}00103         \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00104}00104         sc-\/>\mbox{\hyperlink{structlio__soft__command_ad15512a7fe14de8f48679ea491ceef6d}{iq\_no}} = (uint32\_t)nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a8a585822f4eb70f431c7db4606c50a50}{iq\_no}};}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00105}00105 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00106}00106         \mbox{\hyperlink{lio__iq_8h_a6bd987af0b5107ea95f63de23cb68cda}{lio\_prepare\_soft\_command}}(oct, sc, \mbox{\hyperlink{lio__common_8h_a33e94e4d8a48c4f8fcca7f71a4f622c3}{LIO\_OPCODE\_NIC}}, \mbox{\hyperlink{lio__common_8h_a471543356599fbd11ef4ec2bd3c13d05}{LIO\_OPCODE\_NIC\_CMD}}, 0,}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00107}00107                                  0, 0);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00108}00108 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00109}00109         sc-\/>\mbox{\hyperlink{structlio__soft__command_a912a296891fe84dc401a7219a8847063}{callback}} = \mbox{\hyperlink{lio__ctrl_8c_a2214608728cc814b88a54d3cc479bb56}{lio\_ctrl\_callback}};}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00110}00110         sc-\/>\mbox{\hyperlink{structlio__soft__command_a998df93b613de98f6a4f5f47ac72f64a}{callback\_arg}} = sc;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00111}00111         sc-\/>\mbox{\hyperlink{structlio__soft__command_a8e77d97141a049d956998e5bc28bc90d}{wait\_time}} = nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a4415355127c5111f0570276c84d198a6}{wait\_time}};}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00112}00112 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00113}00113         \textcolor{keywordflow}{return} (sc);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00114}00114 \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00115}00115 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00116}00116 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00117}\mbox{\hyperlink{lio__ctrl_8c_a93d515939a6aef78b9f008a414e73940}{00117}} \mbox{\hyperlink{lio__ctrl_8c_a93d515939a6aef78b9f008a414e73940}{lio\_send\_ctrl\_pkt}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{struct} \mbox{\hyperlink{structlio__ctrl__pkt}{lio\_ctrl\_pkt}} *nctrl)}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00118}00118 \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00119}00119         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__soft__command}{lio\_soft\_command}} *sc = NULL;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00120}00120         \textcolor{keywordtype}{int}     retval;}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00122}00122         mtx\_lock(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3dfa98f1e7bb87114ed8d2f54f3a73bd}{cmd\_resp\_wqlock}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00123}00123         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00124}00124 \textcolor{comment}{         * Allow only rx ctrl command to stop traffic on the chip}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00125}00125 \textcolor{comment}{         * during offline operations}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00126}00126 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00127}00127         \textcolor{keywordflow}{if} ((oct-\/>\mbox{\hyperlink{structocteon__device_a87d0a062a62b952cc55818560584ec57}{cmd\_resp\_state}} == \mbox{\hyperlink{lio__device_8h_aa6d36e9801b6d8e8fb26402169f4490c}{LIO\_DRV\_OFFLINE}}) \&\&}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00128}00128             (nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a5ba377c8c6282ebc84f072360d28a1f7}{ncmd}}.\mbox{\hyperlink{unionocteon__cmd_ad5cae7e8f601a66277962156b10a211e}{s}}.\mbox{\hyperlink{unionocteon__cmd_ae8a289a502362b98e550d65d3986dc3f}{cmd}} != \mbox{\hyperlink{lio__common_8h_a4031877c65c5cfbac601fd533949b7de}{LIO\_CMD\_RX\_CTL}})) \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00129}00129                 mtx\_unlock(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3dfa98f1e7bb87114ed8d2f54f3a73bd}{cmd\_resp\_wqlock}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00130}00130                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}\%s cmd:\%d not processed since driver offline\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00131}00131                             \_\_func\_\_, nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a5ba377c8c6282ebc84f072360d28a1f7}{ncmd}}.\mbox{\hyperlink{unionocteon__cmd_ad5cae7e8f601a66277962156b10a211e}{s}}.\mbox{\hyperlink{unionocteon__cmd_ae8a289a502362b98e550d65d3986dc3f}{cmd}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00132}00132                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00133}00133         \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00134}00134 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00135}00135         sc = \mbox{\hyperlink{lio__ctrl_8c_a43bfc3089b31e04bb164007e936bb559}{lio\_alloc\_ctrl\_pkt\_sc}}(oct, nctrl);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00136}00136         \textcolor{keywordflow}{if} (sc == NULL) \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00137}00137                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}\%s soft command alloc failed\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00138}00138                 mtx\_unlock(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3dfa98f1e7bb87114ed8d2f54f3a73bd}{cmd\_resp\_wqlock}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00139}00139                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00140}00140         \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00142}00142         retval = \mbox{\hyperlink{lio__iq_8h_a208aa2e8ecfdc37f4f3f961afd44c264}{lio\_send\_soft\_command}}(oct, sc);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00143}00143         \textcolor{keywordflow}{if} (retval == \mbox{\hyperlink{lio__iq_8h_a7a8baba01e32a87bd344a3ec2c8f703a}{LIO\_IQ\_SEND\_FAILED}}) \{}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00144}00144                 \mbox{\hyperlink{lio__iq_8h_aeacdddc60eaf524a3482cbd54a8e6fb0}{lio\_free\_soft\_command}}(oct, sc);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00145}00145                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}\%s pf\_num:\%d soft command:\%d send failed status: \%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00146}00146                             \_\_func\_\_, oct-\/>\mbox{\hyperlink{structocteon__device_ae82b8a6df1dae1751fc3053a563dbec0}{pf\_num}}, nctrl-\/>\mbox{\hyperlink{structlio__ctrl__pkt_a5ba377c8c6282ebc84f072360d28a1f7}{ncmd}}.\mbox{\hyperlink{unionocteon__cmd_ad5cae7e8f601a66277962156b10a211e}{s}}.\mbox{\hyperlink{unionocteon__cmd_ae8a289a502362b98e550d65d3986dc3f}{cmd}}, retval);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00147}00147                 mtx\_unlock(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3dfa98f1e7bb87114ed8d2f54f3a73bd}{cmd\_resp\_wqlock}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00148}00148                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00149}00149         \}}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00150}00150 }
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00151}00151         mtx\_unlock(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3dfa98f1e7bb87114ed8d2f54f3a73bd}{cmd\_resp\_wqlock}});}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00152}00152         \textcolor{keywordflow}{return} (retval);}
\DoxyCodeLine{\Hypertarget{lio__ctrl_8c_source_l00153}00153 \}}

\end{DoxyCode}
