\hypertarget{mlx5__uar_8c_source}{}\doxysection{mlx5\+\_\+uar.\+c}
\label{mlx5__uar_8c_source}\index{dev/mlx5/mlx5\_core/mlx5\_uar.c@{dev/mlx5/mlx5\_core/mlx5\_uar.c}}
\mbox{\hyperlink{mlx5__uar_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2013-\/2020, Mellanox Technologies. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00004}00004 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00005}00005 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00006}00006 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00007}00007 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00008}00008 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00009}00009 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00011}00011 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00013}00013 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00014}00014 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00015}00015 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00016}00016 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00017}00017 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00018}00018 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00019}00019 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00020}00020 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00021}00021 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00022}00022 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00023}00023 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00024}00024 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00025}00025 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00028}00028 \textcolor{preprocessor}{\#include "{}opt\_rss.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00029}00029 \textcolor{preprocessor}{\#include "{}opt\_ratelimit.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <linux/kernel.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <linux/module.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <linux/io-\/mapping.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{driver_8h}{dev/mlx5/driver.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mlx5__core_8h}{dev/mlx5/mlx5\_core/mlx5\_core.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00037}\mbox{\hyperlink{driver_8h_a3cf4542e9146d9d9a4dbb7fda99c2b4d}{00037}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__uar_8c_a3cf4542e9146d9d9a4dbb7fda99c2b4d}{mlx5\_cmd\_alloc\_uar}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev, u32 *uarn)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00038}00038 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00039}00039         u32 out[\mbox{\hyperlink{device_8h_a2bdfa104f3d7c0635b984382d1562741}{MLX5\_ST\_SZ\_DW}}(alloc\_uar\_out)] = \{0\};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00040}00040         u32 in[\mbox{\hyperlink{device_8h_a2bdfa104f3d7c0635b984382d1562741}{MLX5\_ST\_SZ\_DW}}(alloc\_uar\_in)]   = \{0\};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00041}00041         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00042}00042 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00043}00043         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(alloc\_uar\_in, in, opcode, \mbox{\hyperlink{mlx5__ifc_8h_a871a83db4e53fc6c6872b5ac7cc94f39a783bbb4fdaa0ca6d1c615b88c9c1e06c}{MLX5\_CMD\_OP\_ALLOC\_UAR}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00044}00044         err = \mbox{\hyperlink{driver_8h_ad7393e74938540251a0c894eb1eae135}{mlx5\_cmd\_exec}}(dev, in, \textcolor{keyword}{sizeof}(in), out, \textcolor{keyword}{sizeof}(out));}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00045}00045         \textcolor{keywordflow}{if} (!err)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00046}00046                 *uarn = \mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(alloc\_uar\_out, out, uar);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00047}00047         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00048}00048 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00049}\mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{00049}} \mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{EXPORT\_SYMBOL}}(\mbox{\hyperlink{mlx5__uar_8c_a3cf4542e9146d9d9a4dbb7fda99c2b4d}{mlx5\_cmd\_alloc\_uar}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00051}\mbox{\hyperlink{driver_8h_a8abdcf1fba52dcd7db8dd5d7370c96a8}{00051}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__uar_8c_a8abdcf1fba52dcd7db8dd5d7370c96a8}{mlx5\_cmd\_free\_uar}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev, u32 uarn)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00052}00052 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00053}00053         u32 out[\mbox{\hyperlink{device_8h_a2bdfa104f3d7c0635b984382d1562741}{MLX5\_ST\_SZ\_DW}}(dealloc\_uar\_out)] = \{0\};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00054}00054         u32 in[\mbox{\hyperlink{device_8h_a2bdfa104f3d7c0635b984382d1562741}{MLX5\_ST\_SZ\_DW}}(dealloc\_uar\_in)]   = \{0\};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00056}00056         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(dealloc\_uar\_in, in, opcode, \mbox{\hyperlink{mlx5__ifc_8h_a871a83db4e53fc6c6872b5ac7cc94f39a4b57ff2135d0eb0dc9077819fb4e64ae}{MLX5\_CMD\_OP\_DEALLOC\_UAR}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00057}00057         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(dealloc\_uar\_in, in, uar, uarn);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00058}00058         \textcolor{keywordflow}{return} \mbox{\hyperlink{driver_8h_ad7393e74938540251a0c894eb1eae135}{mlx5\_cmd\_exec}}(dev, in, \textcolor{keyword}{sizeof}(in), out, \textcolor{keyword}{sizeof}(out));}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00059}00059 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00060}\mbox{\hyperlink{mlx5__uar_8c_ad491301c750318b07a0949782b6aa89f}{00060}} \mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{EXPORT\_SYMBOL}}(\mbox{\hyperlink{mlx5__uar_8c_a8abdcf1fba52dcd7db8dd5d7370c96a8}{mlx5\_cmd\_free\_uar}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00062}\mbox{\hyperlink{mlx5__uar_8c_a14e9481e95da5425e6ba6cb4edbd8ec2}{00062}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__uar_8c_a14e9481e95da5425e6ba6cb4edbd8ec2}{uars\_per\_sys\_page}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00063}00063 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00064}00064         \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(mdev, uar\_4k))}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00065}00065                 \textcolor{keywordflow}{return} \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(mdev, num\_of\_uars\_per\_page);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00067}00067         \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00068}00068 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00070}\mbox{\hyperlink{mlx5__uar_8c_afa3b68222cef553e11915e54b78b3359}{00070}} \textcolor{keyword}{static} u64 \mbox{\hyperlink{mlx5__uar_8c_afa3b68222cef553e11915e54b78b3359}{uar2pfn}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev, u32 index)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00071}00071 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00072}00072         u32 system\_page\_index;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00074}00074         \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(mdev, uar\_4k))}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00075}00075                 system\_page\_index = index >> (PAGE\_SHIFT -\/ \mbox{\hyperlink{device_8h_aae05225933a42f81e7c4a9fb286596f9aa4614720009368aaf55770e64acced36}{MLX5\_ADAPTER\_PAGE\_SHIFT}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00076}00076         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00077}00077                 system\_page\_index = index;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00079}00079         \textcolor{keywordflow}{return} (pci\_resource\_start(mdev-\/>\mbox{\hyperlink{structmlx5__core__dev_a0819dc9fa4983c9140507e1a02aa8313}{pdev}}, 0) >> PAGE\_SHIFT) + system\_page\_index;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00080}00080 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00082}\mbox{\hyperlink{mlx5__uar_8c_acf583145e7e3ee08aacd2737caac82d5}{00082}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__uar_8c_acf583145e7e3ee08aacd2737caac82d5}{up\_rel\_func}}(\textcolor{keyword}{struct} kref *kref)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00083}00083 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00084}00084         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *up = container\_of(kref, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}}, \mbox{\hyperlink{structmlx5__uars__page_ab502c6d32de0bbcb4afdddc33d97149d}{ref\_count}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00086}00086         list\_del(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6d6af888e36baa353010997c7824b4c4}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00087}00087         iounmap(up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00088}00088         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mlx5__uar_8c_a8abdcf1fba52dcd7db8dd5d7370c96a8}{mlx5\_cmd\_free\_uar}}(up-\/>\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}}))}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00089}00089                 \mbox{\hyperlink{mlx5__core_8h_ac024f7b881a7d4965ecc662bc4be81ca}{mlx5\_core\_warn}}(up-\/>\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{stringliteral}{"{}failed to free uar index \%d\(\backslash\)n"{}}, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00090}00090         bitmap\_free(up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00091}00091         bitmap\_free(up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00092}00092         kfree(up);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00093}00093 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00095}\mbox{\hyperlink{mlx5__uar_8c_a1f12a4f93f7a4bf03ec2dea840c5b91f}{00095}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *\mbox{\hyperlink{mlx5__uar_8c_a1f12a4f93f7a4bf03ec2dea840c5b91f}{alloc\_uars\_page}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}},}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00096}00096                                               \textcolor{keywordtype}{bool} map\_wc)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00097}00097 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00098}00098         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *up;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00099}00099         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00100}00100         phys\_addr\_t pfn;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00101}00101         \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00102}00102         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00104}00104         \mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}} = \mbox{\hyperlink{mlx5__uar_8c_a14e9481e95da5425e6ba6cb4edbd8ec2}{uars\_per\_sys\_page}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}) * \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00105}00105         up = kzalloc(\textcolor{keyword}{sizeof}(*up), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00106}00106         \textcolor{keywordflow}{if} (!up)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00107}00107                 \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00108}00108 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00109}00109         up-\/>\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}} = \mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00110}00110         up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}} = bitmap\_zalloc(\mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}}, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00111}00111         \textcolor{keywordflow}{if} (!up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}})}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00112}00112                 \textcolor{keywordflow}{goto} error1;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00114}00114         up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}} = bitmap\_zalloc(\mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}}, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00115}00115         \textcolor{keywordflow}{if} (!up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}})}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00116}00116                 \textcolor{keywordflow}{goto} error1;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00118}00118         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}}; i++)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00119}00119                 \textcolor{keywordflow}{if} ((i \% \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}}) < \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a6dc9775b82d7711b85c9574a97c9701d}{MLX5\_NON\_FP\_BFREGS\_PER\_UAR}})}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00120}00120                         set\_bit(i, up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00121}00121                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00122}00122                         set\_bit(i, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00123}00123 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00124}00124         up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}} = \mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00125}00125         up-\/>\mbox{\hyperlink{structmlx5__uars__page_ac98d053b17f717474a583fad506d31db}{fp\_avail}} = \mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}} * \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13aa88b0f3b3e03f3153d0b5d87476dd0e7}{MLX5\_FP\_BFREGS\_PER\_UAR}} / \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00126}00126         up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6b8b6f7b2b3b86ad9097d5b4f2fcb863}{reg\_avail}} = \mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}} * \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a6dc9775b82d7711b85c9574a97c9701d}{MLX5\_NON\_FP\_BFREGS\_PER\_UAR}} / \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00127}00127 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00128}00128         err = \mbox{\hyperlink{mlx5__uar_8c_a3cf4542e9146d9d9a4dbb7fda99c2b4d}{mlx5\_cmd\_alloc\_uar}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00129}00129         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00130}00130                 \mbox{\hyperlink{mlx5__core_8h_ac024f7b881a7d4965ecc662bc4be81ca}{mlx5\_core\_warn}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{stringliteral}{"{}mlx5\_cmd\_alloc\_uar() failed, \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00131}00131                 \textcolor{keywordflow}{goto} error1;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00132}00132         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00134}00134         pfn = \mbox{\hyperlink{mlx5__uar_8c_afa3b68222cef553e11915e54b78b3359}{uar2pfn}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00135}00135         \textcolor{keywordflow}{if} (map\_wc) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00136}00136                 up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}} = ioremap\_wc(pfn << PAGE\_SHIFT, PAGE\_SIZE);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00137}00137                 \textcolor{keywordflow}{if} (!up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00138}00138                         err = -\/EAGAIN;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00139}00139                         \textcolor{keywordflow}{goto} error2;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00140}00140                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00141}00141         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00142}00142                 up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}} = ioremap(pfn << PAGE\_SHIFT, PAGE\_SIZE);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00143}00143                 \textcolor{keywordflow}{if} (!up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00144}00144                         err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00145}00145                         \textcolor{keywordflow}{goto} error2;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00146}00146                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00147}00147         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00148}00148         kref\_init(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_ab502c6d32de0bbcb4afdddc33d97149d}{ref\_count}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00149}00149         \mbox{\hyperlink{mlx5__core_8h_abecf5f90e845f80efc57b10bd4c67c2b}{mlx5\_core\_dbg}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{stringliteral}{"{}allocated UAR page: index \%d, total bfregs \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00150}00150                       up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}}, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00151}00151         \textcolor{keywordflow}{return} up;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00153}00153 error2:}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00154}00154         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mlx5__uar_8c_a8abdcf1fba52dcd7db8dd5d7370c96a8}{mlx5\_cmd\_free\_uar}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}}))}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00155}00155                 \mbox{\hyperlink{mlx5__core_8h_ac024f7b881a7d4965ecc662bc4be81ca}{mlx5\_core\_warn}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{stringliteral}{"{}failed to free uar index \%d\(\backslash\)n"{}}, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00156}00156 error1:}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00157}00157         bitmap\_free(up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00158}00158         bitmap\_free(up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00159}00159         kfree(up);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00160}00160         \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00161}00161 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00162}00162 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00163}\mbox{\hyperlink{driver_8h_a76b81f015322a7417f58a515b7b6bd60}{00163}} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *\mbox{\hyperlink{mlx5__uar_8c_a76b81f015322a7417f58a515b7b6bd60}{mlx5\_get\_uars\_page}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}})}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00164}00164 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00165}00165         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *ret;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00166}00166 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00167}00167         mutex\_lock(\&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00168}00168         \textcolor{keywordflow}{if} (!list\_empty(\&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}})) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00169}00169                 ret = list\_first\_entry(\&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}},}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00170}00170                                        \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}}, \mbox{\hyperlink{structmlx5__uars__page_a6d6af888e36baa353010997c7824b4c4}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00171}00171                 kref\_get(\&ret-\/>\mbox{\hyperlink{structmlx5__uars__page_ab502c6d32de0bbcb4afdddc33d97149d}{ref\_count}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00172}00172                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00173}00173         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00174}00174         ret = \mbox{\hyperlink{mlx5__uar_8c_a1f12a4f93f7a4bf03ec2dea840c5b91f}{alloc\_uars\_page}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00175}00175         \textcolor{keywordflow}{if} (IS\_ERR(ret))}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00176}00176                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00177}00177         list\_add(\&ret-\/>\mbox{\hyperlink{structmlx5__uars__page_a6d6af888e36baa353010997c7824b4c4}{list}}, \&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00178}00178 out:}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00179}00179         mutex\_unlock(\&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00181}00181         \textcolor{keywordflow}{return} ret;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00182}00182 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00183}\mbox{\hyperlink{mlx5__uar_8c_a302e57d4da27fbca4641d35ac6af38bb}{00183}} \mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{EXPORT\_SYMBOL}}(\mbox{\hyperlink{mlx5__uar_8c_a76b81f015322a7417f58a515b7b6bd60}{mlx5\_get\_uars\_page}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00184}00184 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00185}\mbox{\hyperlink{driver_8h_a41357023a1da52f36274d9e307d1b7f4}{00185}} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__uar_8c_a41357023a1da52f36274d9e307d1b7f4}{mlx5\_put\_uars\_page}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *up)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00186}00186 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00187}00187         mutex\_lock(\&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00188}00188         kref\_put(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_ab502c6d32de0bbcb4afdddc33d97149d}{ref\_count}}, \mbox{\hyperlink{mlx5__uar_8c_acf583145e7e3ee08aacd2737caac82d5}{up\_rel\_func}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00189}00189         mutex\_unlock(\&\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}}.\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00190}00190 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00191}\mbox{\hyperlink{mlx5__uar_8c_a96ffece1496c2a56b7abf918e4289a39}{00191}} \mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{EXPORT\_SYMBOL}}(\mbox{\hyperlink{mlx5__uar_8c_a41357023a1da52f36274d9e307d1b7f4}{mlx5\_put\_uars\_page}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00193}\mbox{\hyperlink{mlx5__uar_8c_acc22567033ac3a25a5de0abe89795bec}{00193}} \textcolor{keyword}{static} \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \mbox{\hyperlink{mlx5__uar_8c_acc22567033ac3a25a5de0abe89795bec}{map\_offset}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{keywordtype}{int} dbi)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00194}00194 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00195}00195         \textcolor{comment}{/* return the offset in bytes from the start of the page to the}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00196}00196 \textcolor{comment}{         * blue flame area of the UAR}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00197}00197 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00198}00198         \textcolor{keywordflow}{return} dbi / \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}} * \mbox{\hyperlink{device_8h_aae05225933a42f81e7c4a9fb286596f9aa5e1036a2088772037b27f5e8e0cd543}{MLX5\_ADAPTER\_PAGE\_SIZE}} +}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00199}00199                (dbi \% \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}}) *}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00200}00200                (1 << \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, log\_bf\_reg\_size)) + \mbox{\hyperlink{doorbell_8h_a90a4a21d48634be5978d332ad2e6c76e}{MLX5\_BF\_OFFSET}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00201}00201 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00203}\mbox{\hyperlink{mlx5__uar_8c_ac6a9ed6d35b51b0b93d93a3c5f3738f3}{00203}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__uar_8c_ac6a9ed6d35b51b0b93d93a3c5f3738f3}{alloc\_bfreg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *\mbox{\hyperlink{structmlx5__uars__page_a017ed5e36a99ef53799d6ad1e2ae62a2}{mdev}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__sq__bfreg}{mlx5\_sq\_bfreg}} *\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}},}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00204}00204                        \textcolor{keywordtype}{bool} map\_wc, \textcolor{keywordtype}{bool} fast\_path)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00205}00205 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00206}00206         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__bfreg__data}{mlx5\_bfreg\_data}} *bfregs;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00207}00207         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *up;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00208}00208         \textcolor{keyword}{struct }list\_head *head;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00209}00209         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} *bitmap;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00210}00210         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} *avail;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00211}00211         \textcolor{keyword}{struct }mutex *\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}};  \textcolor{comment}{/* pointer to right mutex */}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00212}00212         \textcolor{keywordtype}{int} dbi;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00213}00213 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00214}00214         bfregs = \&mdev-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00215}00215         \textcolor{keywordflow}{if} (map\_wc) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00216}00216                 head = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_a5388e36c9e2fab819233a32a305005e9}{wc\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00217}00217                 \mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}} = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_a5388e36c9e2fab819233a32a305005e9}{wc\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00218}00218         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00219}00219                 head = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00220}00220                 \mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}} = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00221}00221         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00222}00222         mutex\_lock(\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00223}00223         \textcolor{keywordflow}{if} (list\_empty(head)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00224}00224                 up = \mbox{\hyperlink{mlx5__uar_8c_a1f12a4f93f7a4bf03ec2dea840c5b91f}{alloc\_uars\_page}}(mdev, map\_wc);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00225}00225                 \textcolor{keywordflow}{if} (IS\_ERR(up)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00226}00226                         mutex\_unlock(\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00227}00227                         \textcolor{keywordflow}{return} PTR\_ERR(up);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00228}00228                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00229}00229                 list\_add(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6d6af888e36baa353010997c7824b4c4}{list}}, head);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00230}00230         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00231}00231                 up = list\_entry(head-\/>next, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}}, list);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00232}00232                 kref\_get(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_ab502c6d32de0bbcb4afdddc33d97149d}{ref\_count}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00233}00233         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00234}00234         \textcolor{keywordflow}{if} (fast\_path) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00235}00235                 bitmap = up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00236}00236                 avail = \&up-\/>\mbox{\hyperlink{structmlx5__uars__page_ac98d053b17f717474a583fad506d31db}{fp\_avail}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00237}00237         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00238}00238                 bitmap = up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00239}00239                 avail = \&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6b8b6f7b2b3b86ad9097d5b4f2fcb863}{reg\_avail}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00240}00240         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00241}00241         dbi = find\_first\_bit(bitmap, up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6203ece191e5a919eff9d8cc8551d6f4}{bfregs}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00242}00242         clear\_bit(dbi, bitmap);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00243}00243         (*avail)-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00244}00244         \textcolor{keywordflow}{if} (!(*avail))}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00245}00245                 list\_del(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6d6af888e36baa353010997c7824b4c4}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00246}00246 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00247}00247         \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_aa8e89279f7ed37f36b2303aa277f3b88}{map}} = up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}} + \mbox{\hyperlink{mlx5__uar_8c_acc22567033ac3a25a5de0abe89795bec}{map\_offset}}(mdev, dbi);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00248}00248         \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_a290e761743152aba8a1d95ebab7eb90f}{up}} = up;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00249}00249         \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_a5c461f24ee5cb00c2bd99787243e9842}{wc}} = map\_wc;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00250}00250         \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_a2696af77aaf294f4aacc4dac9b22ea28}{index}} = up-\/>\mbox{\hyperlink{structmlx5__uars__page_a69d90f44b52999c724e78c9b76393da6}{index}} + dbi / \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00251}00251         mutex\_unlock(\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00252}00252 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00253}00253         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00254}00254 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00255}00255 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00256}\mbox{\hyperlink{driver_8h_a654725775f68d9de65f8e84e953e98ea}{00256}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__uar_8c_a654725775f68d9de65f8e84e953e98ea}{mlx5\_alloc\_bfreg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__sq__bfreg}{mlx5\_sq\_bfreg}} *\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}},}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00257}00257                      \textcolor{keywordtype}{bool} map\_wc, \textcolor{keywordtype}{bool} fast\_path)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00258}00258 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00259}00259         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00260}00260 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00261}00261         err = \mbox{\hyperlink{mlx5__uar_8c_ac6a9ed6d35b51b0b93d93a3c5f3738f3}{alloc\_bfreg}}(mdev, \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}, map\_wc, fast\_path);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00262}00262         \textcolor{keywordflow}{if} (!err)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00263}00263                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00265}00265         \textcolor{keywordflow}{if} (err == -\/EAGAIN \&\& map\_wc)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00266}00266                 \textcolor{keywordflow}{return} \mbox{\hyperlink{mlx5__uar_8c_ac6a9ed6d35b51b0b93d93a3c5f3738f3}{alloc\_bfreg}}(mdev, \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}, \textcolor{keyword}{false}, fast\_path);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00268}00268         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00269}00269 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00270}\mbox{\hyperlink{mlx5__uar_8c_a4f11018377da744ae04f869e293fb46b}{00270}} \mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{EXPORT\_SYMBOL}}(\mbox{\hyperlink{mlx5__uar_8c_a654725775f68d9de65f8e84e953e98ea}{mlx5\_alloc\_bfreg}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00271}00271 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00272}\mbox{\hyperlink{mlx5__uar_8c_af476026407e86c7239976d89aa8f8234}{00272}} \textcolor{keyword}{static} \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__uar_8c_af476026407e86c7239976d89aa8f8234}{addr\_to\_dbi\_in\_syspage}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev,}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00273}00273                                            \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *up,}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00274}00274                                            \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__sq__bfreg}{mlx5\_sq\_bfreg}} *\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}})}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00275}00275 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00276}00276         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} uar\_idx;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00277}00277         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} bfreg\_idx;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00278}00278         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} bf\_reg\_size;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00279}00279 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00280}00280         bf\_reg\_size = 1 << \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, log\_bf\_reg\_size);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00281}00281 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00282}00282         uar\_idx = (\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_aa8e89279f7ed37f36b2303aa277f3b88}{map}} -\/ up-\/>\mbox{\hyperlink{structmlx5__uars__page_a9b63936588412053d28c8a32165b8ab9}{map}}) >> \mbox{\hyperlink{device_8h_aae05225933a42f81e7c4a9fb286596f9aa4614720009368aaf55770e64acced36}{MLX5\_ADAPTER\_PAGE\_SHIFT}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00283}00283         bfreg\_idx = (((uintptr\_t)\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_aa8e89279f7ed37f36b2303aa277f3b88}{map}} \% \mbox{\hyperlink{device_8h_aae05225933a42f81e7c4a9fb286596f9aa5e1036a2088772037b27f5e8e0cd543}{MLX5\_ADAPTER\_PAGE\_SIZE}}) -\/ \mbox{\hyperlink{doorbell_8h_a90a4a21d48634be5978d332ad2e6c76e}{MLX5\_BF\_OFFSET}}) / bf\_reg\_size;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00284}00284 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00285}00285         \textcolor{keywordflow}{return} uar\_idx * \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}} + bfreg\_idx;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00286}00286 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00287}00287 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00288}\mbox{\hyperlink{driver_8h_adee537595fedf697ff978143068905cc}{00288}} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__uar_8c_adee537595fedf697ff978143068905cc}{mlx5\_free\_bfreg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__sq__bfreg}{mlx5\_sq\_bfreg}} *\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}})}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00289}00289 \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00290}00290         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__bfreg__data}{mlx5\_bfreg\_data}} *bfregs;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00291}00291         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__uars__page}{mlx5\_uars\_page}} *up;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00292}00292         \textcolor{keyword}{struct }mutex *\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}}; \textcolor{comment}{/* pointer to right mutex */}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00293}00293         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} dbi;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00294}00294         \textcolor{keywordtype}{bool} fp;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00295}00295         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} *avail;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00296}00296         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} *bitmap;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00297}00297         \textcolor{keyword}{struct }list\_head *head;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00298}00298 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00299}00299         bfregs = \&mdev-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_adb5d4bfe977fbcd035481fade9713d7d}{bfregs}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00300}00300         \textcolor{keywordflow}{if} (\mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_a5c461f24ee5cb00c2bd99787243e9842}{wc}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00301}00301                 head = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_a5388e36c9e2fab819233a32a305005e9}{wc\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00302}00302                 \mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}} = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_a5388e36c9e2fab819233a32a305005e9}{wc\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00303}00303         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00304}00304                 head = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_aa714bb00066cc6d712a5f0d477aace4d}{list}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00305}00305                 \mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}} = \&bfregs-\/>\mbox{\hyperlink{structmlx5__bfreg__data_ac5f2f403aaaa5ec763dc9023f0e989aa}{reg\_head}}.\mbox{\hyperlink{structmlx5__bfreg__head_ad1d43a5aa5eccf12e94a6b9da754faad}{lock}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00306}00306         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00307}00307         up = \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}}-\/>\mbox{\hyperlink{structmlx5__sq__bfreg_a290e761743152aba8a1d95ebab7eb90f}{up}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00308}00308         dbi = \mbox{\hyperlink{mlx5__uar_8c_af476026407e86c7239976d89aa8f8234}{addr\_to\_dbi\_in\_syspage}}(mdev, up, \mbox{\hyperlink{en_8h_a091bc3a4f66580cd5048aa1c7e22d495}{bfreg}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00309}00309         fp = (dbi \% \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a721ef6f057d063fbbf145ea4020541b6}{MLX5\_BFREGS\_PER\_UAR}}) >= \mbox{\hyperlink{device_8h_a39fca1837c5ce7715cbf571669660c13a6dc9775b82d7711b85c9574a97c9701d}{MLX5\_NON\_FP\_BFREGS\_PER\_UAR}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00310}00310         \textcolor{keywordflow}{if} (fp) \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00311}00311                 avail = \&up-\/>\mbox{\hyperlink{structmlx5__uars__page_ac98d053b17f717474a583fad506d31db}{fp\_avail}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00312}00312                 bitmap = up-\/>\mbox{\hyperlink{structmlx5__uars__page_a489cc8103dccae0ee987a8ba2b0eb659}{fp\_bitmap}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00313}00313         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00314}00314                 avail = \&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6b8b6f7b2b3b86ad9097d5b4f2fcb863}{reg\_avail}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00315}00315                 bitmap = up-\/>\mbox{\hyperlink{structmlx5__uars__page_adae3e1e48d7135c03579df9509bf2c92}{reg\_bitmap}};}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00316}00316         \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00317}00317         mutex\_lock(\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00318}00318         (*avail)++;}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00319}00319         set\_bit(dbi, bitmap);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00320}00320         \textcolor{keywordflow}{if} (*avail == 1)}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00321}00321                 list\_add\_tail(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_a6d6af888e36baa353010997c7824b4c4}{list}}, head);}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00322}00322 }
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00323}00323         kref\_put(\&up-\/>\mbox{\hyperlink{structmlx5__uars__page_ab502c6d32de0bbcb4afdddc33d97149d}{ref\_count}}, \mbox{\hyperlink{mlx5__uar_8c_acf583145e7e3ee08aacd2737caac82d5}{up\_rel\_func}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00324}00324         mutex\_unlock(\mbox{\hyperlink{en_8h_a62a876178ad5d97d65732d21f1afd004}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00325}00325 \}}
\DoxyCodeLine{\Hypertarget{mlx5__uar_8c_source_l00326}\mbox{\hyperlink{mlx5__uar_8c_a3e0d19cfe0f613f90659fd0f54a0a32e}{00326}} \mbox{\hyperlink{mlx5__uar_8c_a4e01791d782790f54062c18a044ed38d}{EXPORT\_SYMBOL}}(\mbox{\hyperlink{mlx5__uar_8c_adee537595fedf697ff978143068905cc}{mlx5\_free\_bfreg}});}

\end{DoxyCode}
