\hypertarget{mlx5__ib__mr_8c_source}{}\doxysection{mlx5\+\_\+ib\+\_\+mr.\+c}
\label{mlx5__ib__mr_8c_source}\index{dev/mlx5/mlx5\_ib/mlx5\_ib\_mr.c@{dev/mlx5/mlx5\_ib/mlx5\_ib\_mr.c}}
\mbox{\hyperlink{mlx5__ib__mr_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2013-\/2021, Mellanox Technologies, Ltd.  All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00004}00004 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00005}00005 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00006}00006 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00007}00007 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00008}00008 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00009}00009 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00011}00011 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00013}00013 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00014}00014 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00015}00015 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00016}00016 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00017}00017 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00018}00018 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00019}00019 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00020}00020 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00021}00021 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00022}00022 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00023}00023 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00024}00024 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00025}00025 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00028}00028 \textcolor{preprocessor}{\#include "{}opt\_rss.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00029}00029 \textcolor{preprocessor}{\#include "{}opt\_ratelimit.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <linux/kref.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <linux/random.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <linux/delay.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <linux/sched.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <rdma/ib\_umem.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <rdma/ib\_umem\_odp.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <rdma/ib\_verbs.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mlx5__ib_8h}{dev/mlx5/mlx5\_ib/mlx5\_ib.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00040}00040 \textcolor{keyword}{enum} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00041}\mbox{\hyperlink{mlx5__ib__mr_8c_adab0c4467b3c6f365e87d0316a74bf64ae6e5dbda9ce5b9999d09492604d7efe1}{00041}}         \mbox{\hyperlink{mlx5__ib__mr_8c_adab0c4467b3c6f365e87d0316a74bf64ae6e5dbda9ce5b9999d09492604d7efe1}{MAX\_PENDING\_REG\_MR}} = 8,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00042}00042 \};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00044}\mbox{\hyperlink{mlx5__ib__mr_8c_add5931494b7184a4abdcc06549462528}{00044}} \textcolor{preprocessor}{\#define MLX5\_UMR\_ALIGN 2048}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00045}00045 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00046}00046 \textcolor{keyword}{static} \_\_be64 mlx5\_ib\_update\_mtt\_emergency\_buffer[}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00047}00047                 \mbox{\hyperlink{device_8h_a033e6064753079e9276f53e4db9c241b}{MLX5\_UMR\_MTT\_MIN\_CHUNK\_SIZE}}/\textcolor{keyword}{sizeof}(\_\_be64)]}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00048}00048         \mbox{\hyperlink{device_8h_a10efdd0d161c5288c1a421e9d10d6b80}{\_\_aligned}}(\mbox{\hyperlink{mlx5__ib__mr_8c_add5931494b7184a4abdcc06549462528}{MLX5\_UMR\_ALIGN}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00049}00049 \textcolor{keyword}{static} \mbox{\hyperlink{mlx5__main_8c_a1e2c256c64151c2a82d47cd774a36534}{DEFINE\_MUTEX}}(mlx5\_ib\_update\_mtt\_emergency\_buffer\_mutex);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00050}00050 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00052}00052 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a4868a585f618cea1d66243862fcd4747}{clean\_mr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00054}\mbox{\hyperlink{mlx5__ib__mr_8c_ab6652542d5195ad81a8620d7a62a184d}{00054}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_ab6652542d5195ad81a8620d7a62a184d}{destroy\_mkey}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00055}00055 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00056}00056         \textcolor{keywordtype}{int} err = \mbox{\hyperlink{driver_8h_a1bb1877ebc3a53b0563d915e4a061178}{mlx5\_core\_destroy\_mkey}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00058}00058 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00059}00059         \textcolor{comment}{/* Wait until all page fault handlers using the mr complete. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00060}00060         synchronize\_srcu(\&dev-\/>mr\_srcu);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00061}00061 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00062}00062 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00063}00063         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00064}00064 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00066}\mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{00066}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{order2idx}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \textcolor{keywordtype}{int} order)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00067}00067 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00068}00068         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00070}00070         \textcolor{keywordflow}{if} (order < cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[0].order)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00071}00071                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00072}00072         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00073}00073                 \textcolor{keywordflow}{return} order -\/ cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[0].\mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00074}00074 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00076}\mbox{\hyperlink{mlx5__ib__mr_8c_aa6b029c299fb3c59ea3a322307b5971a}{00076}} \textcolor{keyword}{static} \textcolor{keywordtype}{bool} \mbox{\hyperlink{mlx5__ib__mr_8c_aa6b029c299fb3c59ea3a322307b5971a}{use\_umr\_mtt\_update}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr, u64 start, u64 length)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00077}00077 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00078}00078         \textcolor{keywordflow}{return} ((u64)1 << mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}}) * \mbox{\hyperlink{device_8h_aae05225933a42f81e7c4a9fb286596f9aa5e1036a2088772037b27f5e8e0cd543}{MLX5\_ADAPTER\_PAGE\_SIZE}} >=}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00079}00079                 length + (start \& (\mbox{\hyperlink{device_8h_aae05225933a42f81e7c4a9fb286596f9aa5e1036a2088772037b27f5e8e0cd543}{MLX5\_ADAPTER\_PAGE\_SIZE}} -\/ 1));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00080}00080 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00082}00082 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00083}00083 \textcolor{keyword}{static} \textcolor{keywordtype}{void} update\_odp\_mr(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00084}00084 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00085}00085         \textcolor{keywordflow}{if} (mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}-\/>odp\_data) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00086}00086                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00087}00087 \textcolor{comment}{                 * This barrier prevents the compiler from moving the}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00088}00088 \textcolor{comment}{                 * setting of umem-\/>odp\_data-\/>private to point to our}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00089}00089 \textcolor{comment}{                 * MR, before reg\_umr finished, to ensure that the MR}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00090}00090 \textcolor{comment}{                 * initialization have finished before starting to}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00091}00091 \textcolor{comment}{                 * handle invalidations.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00092}00092 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00093}00093                 smp\_wmb();}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00094}00094                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}-\/>odp\_data-\/>private = mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00095}00095                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00096}00096 \textcolor{comment}{                 * Make sure we will see the new}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00097}00097 \textcolor{comment}{                 * umem-\/>odp\_data-\/>private value in the invalidation}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00098}00098 \textcolor{comment}{                 * routines, before we can get page faults on the}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00099}00099 \textcolor{comment}{                 * MR. Page faults can happen once we put the MR in}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00100}00100 \textcolor{comment}{                 * the tree, below this line. Without the barrier,}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00101}00101 \textcolor{comment}{                 * there can be a fault handling and an invalidation}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00102}00102 \textcolor{comment}{                 * before umem-\/>odp\_data-\/>private == mr is visible to}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00103}00103 \textcolor{comment}{                 * the invalidation handler.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00104}00104 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00105}00105                 smp\_wmb();}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00106}00106         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00107}00107 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00108}00108 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00110}\mbox{\hyperlink{mlx5__ib__mr_8c_a77a7b488b88f40d639b1aaa97f0e81b8}{00110}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a77a7b488b88f40d639b1aaa97f0e81b8}{reg\_mr\_callback}}(\textcolor{keywordtype}{int} status, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__async__work}{mlx5\_async\_work}} *context)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00111}00111 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00112}00112         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00113}00113                 container\_of(context, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}}, \mbox{\hyperlink{structmlx5__ib__mr_abace10ccef030a6f42e193a51588fd55}{cb\_work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00114}00114         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00115}00115         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00116}00116         \textcolor{keywordtype}{int} c = \mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{order2idx}}(dev, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00117}00117         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[c];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00118}00118         u8 key;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00119}00119         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} flags;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00120}00120         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__table}{mlx5\_mr\_table}} *table = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_a3361c1d42e64541bf7c71c98149c8cc5}{mr\_table}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00121}00121         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00122}00122 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00123}00123         spin\_lock\_irqsave(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00124}00124         ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ad1646bfaadb0ce7d3a3e1cfad27500b8}{pending}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00125}00125         spin\_unlock\_irqrestore(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00126}00126         \textcolor{keywordflow}{if} (status) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00127}00127                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}async reg mr failed. status \%d\(\backslash\)n"{}}, status);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00128}00128                 kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00129}00129                 dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_a86a3195136e573e21cfac848c6b9aa2a}{fill\_delay}} = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00130}00130                 mod\_timer(\&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ac1a50cc20e467df066c0d2e10c28552a}{delay\_timer}}, jiffies + HZ);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00131}00131                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00132}00132         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00134}00134         spin\_lock\_irqsave(\&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_ae2186e7a0aecba1a6f5532b260eff06c}{mkey\_lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00135}00135         key = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_ac6911e12a2fc56d0f0e17c93f4a277f4}{mkey\_key}}++;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00136}00136         spin\_unlock\_irqrestore(\&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_ae2186e7a0aecba1a6f5532b260eff06c}{mkey\_lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00137}00137         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}} = \mbox{\hyperlink{driver_8h_ad8a720070bde83cd55739f561e79cfd5}{mlx5\_idx\_to\_mkey}}(\mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(create\_mkey\_out, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a9d8da6ec58cb2bb142fb1aefee8fb7db}{out}}, mkey\_index)) | key;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00138}00138 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00139}00139         cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_acf2912a82d482867ddd153301db6799d}{last\_add}} = jiffies;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00140}00140 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00141}00141         spin\_lock\_irqsave(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00142}00142         list\_add\_tail(\&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}}, \&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00143}00143         ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}}++;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00144}00144         ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a3a645df8fe0c9abd9ccda55cb82bf7e2}{size}}++;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00145}00145         spin\_unlock\_irqrestore(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00146}00146 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00147}00147         spin\_lock\_irqsave(\&table-\/>\mbox{\hyperlink{structmlx5__mr__table_a5730e6ace8e7b808769fd919b8d1f1af}{lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00148}00148         err = radix\_tree\_insert(\&table-\/>\mbox{\hyperlink{structmlx5__mr__table_a1dfcce11962ff48ec786fea6fdc80fa5}{tree}}, \mbox{\hyperlink{driver_8h_aa35d31fc98ef8df8fdef0536c4a83632}{mlx5\_mkey\_to\_idx}}(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}}),}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00149}00149                                 \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00150}00150         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00151}00151                 pr\_err(\textcolor{stringliteral}{"{}Error inserting to mkey tree. 0x\%x\(\backslash\)n"{}}, -\/err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00152}00152         spin\_unlock\_irqrestore(\&table-\/>\mbox{\hyperlink{structmlx5__mr__table_a5730e6ace8e7b808769fd919b8d1f1af}{lock}}, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00153}00153 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00155}\mbox{\hyperlink{mlx5__ib__mr_8c_a2d5cfe74afd398dde37dd578df00d39d}{00155}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a2d5cfe74afd398dde37dd578df00d39d}{add\_keys}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \textcolor{keywordtype}{int} c, \textcolor{keywordtype}{int} num)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00156}00156 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00157}00157         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00158}00158         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[c];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00159}00159         \textcolor{keywordtype}{int} inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(create\_mkey\_in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00160}00160         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00161}00161         \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} = 1 << ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00162}00162         \textcolor{keywordtype}{void} *mkc;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00163}00163         u32 *in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00164}00164         \textcolor{keywordtype}{int} err = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00165}00165         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00166}00166 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00167}00167         in = kzalloc(inlen, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00168}00168         \textcolor{keywordflow}{if} (!in)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00169}00169                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00170}00170 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00171}00171         mkc = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(create\_mkey\_in, in, memory\_key\_mkey\_entry);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00172}00172         \textcolor{keywordflow}{for} (i = 0; i < num; i++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00173}00173                 \textcolor{keywordflow}{if} (ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ad1646bfaadb0ce7d3a3e1cfad27500b8}{pending}} >= \mbox{\hyperlink{mlx5__ib__mr_8c_adab0c4467b3c6f365e87d0316a74bf64ae6e5dbda9ce5b9999d09492604d7efe1}{MAX\_PENDING\_REG\_MR}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00174}00174                         err = -\/EAGAIN;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00175}00175                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00176}00176                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00178}00178                 mr = kzalloc(\textcolor{keyword}{sizeof}(*mr), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00179}00179                 \textcolor{keywordflow}{if} (!mr) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00180}00180                         err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00181}00181                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00182}00182                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00183}00183                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}} = ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00184}00184                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_affdb4556e3946c5fcf73eb427e269588}{umred}} = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00185}00185                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}} = \mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00186}00186 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00187}00187                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, free, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00188}00188                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, umr\_en, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00189}00189                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, \mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}}, \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5afd47a643b123a67e70880f2c19ea987e}{MLX5\_ACCESS\_MODE\_MTT}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00191}00191                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, qpn, 0xffffff);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00192}00192                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, translations\_octword\_size, (\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} + 1) / 2);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00193}00193                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, log\_page\_size, 12);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00194}00194 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00195}00195                 spin\_lock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00196}00196                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ad1646bfaadb0ce7d3a3e1cfad27500b8}{pending}}++;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00197}00197                 spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00198}00198                 err = \mbox{\hyperlink{driver_8h_afb84a7e03e2dbd56d565a9d3e0630851}{mlx5\_core\_create\_mkey\_cb}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00199}00199                                                \&\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_afc60cbb4b143f0a47eaac1d4071210d1}{async\_ctx}}, in, inlen,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00200}00200                                                mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a9d8da6ec58cb2bb142fb1aefee8fb7db}{out}}, \textcolor{keyword}{sizeof}(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a9d8da6ec58cb2bb142fb1aefee8fb7db}{out}}),}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00201}00201                                                \mbox{\hyperlink{mlx5__ib__mr_8c_a77a7b488b88f40d639b1aaa97f0e81b8}{reg\_mr\_callback}}, \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_abace10ccef030a6f42e193a51588fd55}{cb\_work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00202}00202                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00203}00203                         spin\_lock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00204}00204                         ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ad1646bfaadb0ce7d3a3e1cfad27500b8}{pending}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00205}00205                         spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00206}00206                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{stringliteral}{"{}create mkey failed \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00207}00207                         kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00208}00208                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00209}00209                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00210}00210         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00211}00211 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00212}00212         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00213}00213         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00214}00214 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00215}00215 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00216}\mbox{\hyperlink{mlx5__ib__mr_8c_ac711dafdb8047636fed7629df818ceb9}{00216}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_ac711dafdb8047636fed7629df818ceb9}{remove\_keys}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{keywordtype}{int} c, \textcolor{keywordtype}{int} num)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00217}00217 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00218}00218         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00219}00219         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[c];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00220}00220         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00221}00221         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00222}00222         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00223}00223 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00224}00224         \textcolor{keywordflow}{for} (i = 0; i < num; i++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00225}00225                 spin\_lock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00226}00226                 \textcolor{keywordflow}{if} (list\_empty(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}})) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00227}00227                         spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00228}00228                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00229}00229                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00230}00230                 mr = list\_first\_entry(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}}, \mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00231}00231                 list\_del(\&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00232}00232                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00233}00233                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a3a645df8fe0c9abd9ccda55cb82bf7e2}{size}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00234}00234                 spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00235}00235                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_ab6652542d5195ad81a8620d7a62a184d}{destroy\_mkey}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00236}00236                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00237}00237                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{stringliteral}{"{}failed destroy mkey\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00238}00238                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00239}00239                         kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00240}00240         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00241}00241 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00243}\mbox{\hyperlink{mlx5__ib__mr_8c_a6a89cd27ff178d41bf2dbe24436eeaa1}{00243}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a6a89cd27ff178d41bf2dbe24436eeaa1}{someone\_adding}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00244}00244 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00245}00245         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00246}00246 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00247}00247         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{driver_8h_adbaf9202177df73e6880eab6e6aab329aef6e666b0effafdee0afd0ac6c7f3fe8}{MAX\_MR\_CACHE\_ENTRIES}}; i++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00248}00248                 \textcolor{keywordflow}{if} (cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i].\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} < cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i].\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00249}00249                         \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00250}00250         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00251}00251 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00252}00252         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00253}00253 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00254}00254 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00255}\mbox{\hyperlink{mlx5__ib__mr_8c_a0f13c67d488b44bd03264edf7e93051b}{00255}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a0f13c67d488b44bd03264edf7e93051b}{\_\_cache\_work\_func}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00256}00256 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00257}00257         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00258}00258         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00259}00259         \textcolor{keywordtype}{int} i = \mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{order2idx}}(dev, \mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00260}00260         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00261}00261 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00262}00262         \textcolor{keywordflow}{if} (cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_a72e7b835e4859684d3d3b2e2a3924995}{stopped}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00263}00263                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00265}00265         \mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}} = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}}.\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00266}00266         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} < 2 * \mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}} \&\& !dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_a86a3195136e573e21cfac848c6b9aa2a}{fill\_delay}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00267}00267                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_a2d5cfe74afd398dde37dd578df00d39d}{add\_keys}}(dev, i, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00268}00268                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} < 2 * \mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00269}00269                         \textcolor{keywordflow}{if} (err == -\/EAGAIN) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00270}00270                                 \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}returned eagain, order \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00271}00271                                             i + 2);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00272}00272                                 queue\_delayed\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a2270717158881be9eb4e35f92c19dbc8}{dwork}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00273}00273                                                    msecs\_to\_jiffies(3));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00274}00274                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00275}00275                                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}command failed order \%d, err \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00276}00276                                              i + 2, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00277}00277                                 queue\_delayed\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a2270717158881be9eb4e35f92c19dbc8}{dwork}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00278}00278                                                    msecs\_to\_jiffies(1000));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00279}00279                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00280}00280                                 queue\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00281}00281                         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00282}00282                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00283}00283         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} > 2 * \mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00284}00284                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00285}00285 \textcolor{comment}{                 * The remove\_keys() logic is performed as garbage collection}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00286}00286 \textcolor{comment}{                 * task. Such task is intended to be run when no other active}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00287}00287 \textcolor{comment}{                 * processes are running.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00288}00288 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00289}00289 \textcolor{comment}{                 * The need\_resched() will return TRUE if there are user tasks}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00290}00290 \textcolor{comment}{                 * to be activated in near future.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00291}00291 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00292}00292 \textcolor{comment}{                 * In such case, we don't execute remove\_keys() and postpone}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00293}00293 \textcolor{comment}{                 * the garbage collection work to try to run in next cycle,}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00294}00294 \textcolor{comment}{                 * in order to free CPU resources to other tasks.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00295}00295 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00296}00296                 \textcolor{keywordflow}{if} (!need\_resched() \&\& !\mbox{\hyperlink{mlx5__ib__mr_8c_a6a89cd27ff178d41bf2dbe24436eeaa1}{someone\_adding}}(cache) \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00297}00297                     time\_after(jiffies, cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_acf2912a82d482867ddd153301db6799d}{last\_add}} + 300 * HZ)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00298}00298                         \mbox{\hyperlink{mlx5__ib__mr_8c_ac711dafdb8047636fed7629df818ceb9}{remove\_keys}}(dev, i, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00299}00299                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} > \mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00300}00300                                 queue\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00301}00301                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00302}00302                         queue\_delayed\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}-\/>\mbox{\hyperlink{structmlx5__cache__ent_a2270717158881be9eb4e35f92c19dbc8}{dwork}}, 300 * HZ);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00303}00303                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00304}00304         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00305}00305 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00306}00306 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00307}\mbox{\hyperlink{mlx5__ib__mr_8c_a022c7ba99c98c44ce053b594c9319122}{00307}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a022c7ba99c98c44ce053b594c9319122}{delayed\_cache\_work\_func}}(\textcolor{keyword}{struct} work\_struct *\mbox{\hyperlink{en__hw__tls_8h_a623997e11b94d7c467ce26627cc488a2}{work}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00308}00308 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00309}00309         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00310}00310 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00311}00311         ent = container\_of(\mbox{\hyperlink{en__hw__tls_8h_a623997e11b94d7c467ce26627cc488a2}{work}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}}, \mbox{\hyperlink{structmlx5__cache__ent_a2270717158881be9eb4e35f92c19dbc8}{dwork}}.work);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00312}00312         \mbox{\hyperlink{mlx5__ib__mr_8c_a0f13c67d488b44bd03264edf7e93051b}{\_\_cache\_work\_func}}(ent);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00313}00313 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00314}00314 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00315}\mbox{\hyperlink{mlx5__ib__mr_8c_a52e3489167ce909cf5e2983152633eb4}{00315}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a52e3489167ce909cf5e2983152633eb4}{cache\_work\_func}}(\textcolor{keyword}{struct} work\_struct *\mbox{\hyperlink{en__hw__tls_8h_a623997e11b94d7c467ce26627cc488a2}{work}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00316}00316 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00317}00317         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00318}00318 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00319}00319         ent = container\_of(\mbox{\hyperlink{en__hw__tls_8h_a623997e11b94d7c467ce26627cc488a2}{work}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}}, \mbox{\hyperlink{en__hw__tls_8h_a623997e11b94d7c467ce26627cc488a2}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00320}00320         \mbox{\hyperlink{mlx5__ib__mr_8c_a0f13c67d488b44bd03264edf7e93051b}{\_\_cache\_work\_func}}(ent);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00321}00321 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00322}00322 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00323}\mbox{\hyperlink{mlx5__ib__mr_8c_a212314b32cd8034bd1dd0ca395a15835}{00323}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *\mbox{\hyperlink{mlx5__ib__mr_8c_a212314b32cd8034bd1dd0ca395a15835}{alloc\_cached\_mr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00324}00324 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00325}00325         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00326}00326         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00327}00327         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00328}00328         \textcolor{keywordtype}{int} c;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00329}00329         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00330}00330 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00331}00331         c = \mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{order2idx}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00332}00332         \textcolor{keywordflow}{if} (c < 0 || c >= \mbox{\hyperlink{driver_8h_adbaf9202177df73e6880eab6e6aab329aef6e666b0effafdee0afd0ac6c7f3fe8}{MAX\_MR\_CACHE\_ENTRIES}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00333}00333                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \textcolor{stringliteral}{"{}order \%d, cache index \%d\(\backslash\)n"{}}, \mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}}, c);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00334}00334                 \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00335}00335         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00336}00336 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00337}00337         \textcolor{keywordflow}{for} (i = c; i < \mbox{\hyperlink{driver_8h_adbaf9202177df73e6880eab6e6aab329aef6e666b0effafdee0afd0ac6c7f3fe8}{MAX\_MR\_CACHE\_ENTRIES}}; i++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00338}00338                 ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00339}00339 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00340}00340                 \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \textcolor{stringliteral}{"{}order \%d, cache index \%d\(\backslash\)n"{}}, ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}}, i);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00341}00341 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00342}00342                 spin\_lock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00343}00343                 \textcolor{keywordflow}{if} (!list\_empty(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}})) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00344}00344                         mr = list\_first\_entry(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00345}00345                                               list);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00346}00346                         list\_del(\&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00347}00347                         ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00348}00348                         spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00349}00349                         \textcolor{keywordflow}{if} (ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} < ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00350}00350                                 queue\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00351}00351                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00352}00352                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00353}00353                 spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00354}00354 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00355}00355                 queue\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00356}00356         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00357}00357 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00358}00358         \textcolor{keywordflow}{if} (!mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00359}00359                 cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[c].\mbox{\hyperlink{structmlx5__cache__ent_a727235710bd0f4fd3d03daf22f94d71a}{miss}}++;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00360}00360 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00361}00361         \textcolor{keywordflow}{return} mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00362}00362 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00363}00363 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00364}\mbox{\hyperlink{mlx5__ib__mr_8c_a0cdef076bcacca8388ffebb47063e136}{00364}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a0cdef076bcacca8388ffebb47063e136}{free\_cached\_mr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00365}00365 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00366}00366         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00367}00367         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00368}00368         \textcolor{keywordtype}{int} shrink = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00369}00369         \textcolor{keywordtype}{int} c;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00371}00371         c = \mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{order2idx}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00372}00372         \textcolor{keywordflow}{if} (c < 0 || c >= \mbox{\hyperlink{driver_8h_adbaf9202177df73e6880eab6e6aab329aef6e666b0effafdee0afd0ac6c7f3fe8}{MAX\_MR\_CACHE\_ENTRIES}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00373}00373                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \textcolor{stringliteral}{"{}order \%d, cache index \%d\(\backslash\)n"{}}, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}}, c);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00374}00374                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00375}00375         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00376}00376         ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[c];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00377}00377         spin\_lock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00378}00378         list\_add\_tail(\&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}}, \&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00379}00379         ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}}++;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00380}00380         \textcolor{keywordflow}{if} (ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}} > 2 * ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00381}00381                 shrink = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00382}00382         spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00383}00383 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00384}00384         \textcolor{keywordflow}{if} (shrink)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00385}00385                 queue\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00386}00386 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00387}00387 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00388}\mbox{\hyperlink{mlx5__ib__mr_8c_a63a723363fb4487fc8cf211993168cf5}{00388}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a63a723363fb4487fc8cf211993168cf5}{clean\_keys}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \textcolor{keywordtype}{int} c)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00389}00389 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00390}00390         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00391}00391         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[c];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00392}00392         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00393}00393         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00394}00394 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00395}00395         cancel\_delayed\_work(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a2270717158881be9eb4e35f92c19dbc8}{dwork}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00396}00396         \textcolor{keywordflow}{while} (1) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00397}00397                 spin\_lock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00398}00398                 \textcolor{keywordflow}{if} (list\_empty(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}})) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00399}00399                         spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00400}00400                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00401}00401                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00402}00402                 mr = list\_first\_entry(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}}, \mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00403}00403                 list\_del(\&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a06c25b2b3b8feb8a32872a126eac05d8}{list}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00404}00404                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a5a44e55a91c039c659494f498e7237ce}{cur}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00405}00405                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a3a645df8fe0c9abd9ccda55cb82bf7e2}{size}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00406}00406                 spin\_unlock\_irq(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00407}00407                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_ab6652542d5195ad81a8620d7a62a184d}{destroy\_mkey}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00408}00408                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00409}00409                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{stringliteral}{"{}failed destroy mkey\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00410}00410                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00411}00411                         kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00412}00412         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00413}00413 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00414}00414 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00415}\mbox{\hyperlink{mlx5__ib__mr_8c_a47d120d2d27a92831ee4ce4cb754530b}{00415}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a47d120d2d27a92831ee4ce4cb754530b}{delay\_time\_func}}(\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \mbox{\hyperlink{device_8h_a8d4d31e2784e411744d2776ed7a2fa32}{ctx}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00416}00416 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00417}00417         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = (\textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *)\mbox{\hyperlink{device_8h_a8d4d31e2784e411744d2776ed7a2fa32}{ctx}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00418}00418 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00419}00419         dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_a86a3195136e573e21cfac848c6b9aa2a}{fill\_delay}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00420}00420 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00421}00421 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00422}\mbox{\hyperlink{mlx5__ib_8h_a05f3cff2732df0dd5f843b5667b1efe2}{00422}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a05f3cff2732df0dd5f843b5667b1efe2}{mlx5\_mr\_cache\_init}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00423}00423 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00424}00424         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__mr__cache}{mlx5\_mr\_cache}} *cache = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00425}00425         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cache__ent}{mlx5\_cache\_ent}} *ent;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00426}00426         \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00427}00427         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00428}00428 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00429}00429         mutex\_init(\&\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_a43c8568e133ee81f02f2a29da155ea97}{slow\_path\_mutex}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00430}00430         cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}} = alloc\_ordered\_workqueue(\textcolor{stringliteral}{"{}mkey\_cache"{}}, WQ\_MEM\_RECLAIM);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00431}00431         \textcolor{keywordflow}{if} (!cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00432}00432                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, \textcolor{stringliteral}{"{}failed to create work queue\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00433}00433                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00434}00434         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00435}00435 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00436}00436         \mbox{\hyperlink{driver_8h_a41bbf0e47162f91f5d40886211077941}{mlx5\_cmd\_init\_async\_ctx}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_afc60cbb4b143f0a47eaac1d4071210d1}{async\_ctx}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00437}00437         setup\_timer(\&\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ac1a50cc20e467df066c0d2e10c28552a}{delay\_timer}}, \mbox{\hyperlink{mlx5__ib__mr_8c_a47d120d2d27a92831ee4ce4cb754530b}{delay\_time\_func}}, (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long})\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00438}00438         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{driver_8h_adbaf9202177df73e6880eab6e6aab329aef6e666b0effafdee0afd0ac6c7f3fe8}{MAX\_MR\_CACHE\_ENTRIES}}; i++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00439}00439                 INIT\_LIST\_HEAD(\&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i].\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00440}00440                 spin\_lock\_init(\&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i].\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00441}00441 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00442}00442                 ent = \&cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_aedcc26c66fd7ef4b37fcf95a701dde20}{ent}}[i];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00443}00443                 INIT\_LIST\_HEAD(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a53daca9ba0ddf10da1a2a45ce9aa8961}{head}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00444}00444                 spin\_lock\_init(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_af356c69015af6f7501976c3e245756d7}{lock}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00445}00445                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ab0549a2e8eb9791c01405acee2c96764}{order}} = i + 2;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00446}00446                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}} = \mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00448}00448                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a9bc009032613923725ba5a4102e47ae6}{profile}}-\/>\mbox{\hyperlink{structmlx5__profile_adaa3f640cb95d6efe598cb47e0c036de}{mask}} \& \mbox{\hyperlink{driver_8h_a4f126a0a9b1d8c6a8f46a051ef8830bbae69a1b481c3e1667692ecf891daf9f30}{MLX5\_PROF\_MASK\_MR\_CACHE}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00449}00449                         \mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}} = \mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a9bc009032613923725ba5a4102e47ae6}{profile}}-\/>\mbox{\hyperlink{structmlx5__profile_abfefee45340c9d1c241df60464cfaf64}{mr\_cache}}[i].\mbox{\hyperlink{structmlx5__profile_a3b9c354ef16a65e6ca568d77b750fcf2}{limit}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00450}00450                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00451}00451                         \mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00452}00452 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00453}00453                 INIT\_WORK(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}}, \mbox{\hyperlink{mlx5__ib__mr_8c_a52e3489167ce909cf5e2983152633eb4}{cache\_work\_func}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00454}00454                 INIT\_DELAYED\_WORK(\&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a2270717158881be9eb4e35f92c19dbc8}{dwork}}, \mbox{\hyperlink{mlx5__ib__mr_8c_a022c7ba99c98c44ce053b594c9319122}{delayed\_cache\_work\_func}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00455}00455                 ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}} = \mbox{\hyperlink{structmlx5__cache__ent_ac97b1399e1e6886a59f7da2f5b4ec432}{limit}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00456}00456                 queue\_work(cache-\/>\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}}, \&ent-\/>\mbox{\hyperlink{structmlx5__cache__ent_a428c24b133871e685a4fb92c4897a129}{work}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00457}00457         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00458}00458 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00459}00459         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00460}00460 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00461}00461 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00462}\mbox{\hyperlink{mlx5__ib_8h_af7f3ffc072de0b4eb5c18c9a76ddcbe5}{00462}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_af7f3ffc072de0b4eb5c18c9a76ddcbe5}{mlx5\_mr\_cache\_cleanup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00463}00463 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00464}00464         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00465}00465 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00466}00466         \mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}}.\mbox{\hyperlink{structmlx5__mr__cache_a72e7b835e4859684d3d3b2e2a3924995}{stopped}} = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00467}00467         flush\_workqueue(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}}.\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00468}00468         \mbox{\hyperlink{driver_8h_a9484d1ea63ca4263ba7e61591ce03ae0}{mlx5\_cmd\_cleanup\_async\_ctx}}(\&\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_afc60cbb4b143f0a47eaac1d4071210d1}{async\_ctx}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00469}00469 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00470}00470         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{driver_8h_adbaf9202177df73e6880eab6e6aab329aef6e666b0effafdee0afd0ac6c7f3fe8}{MAX\_MR\_CACHE\_ENTRIES}}; i++)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00471}00471                 \mbox{\hyperlink{mlx5__ib__mr_8c_a63a723363fb4487fc8cf211993168cf5}{clean\_keys}}(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}, i);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00472}00472 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00473}00473         destroy\_workqueue(\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_af132fb459d31a9d55144cf61106d0799}{cache}}.\mbox{\hyperlink{structmlx5__mr__cache_ab5d898abb963ddfd1cd2b5009a7ff220}{wq}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00474}00474         del\_timer\_sync(\&\mbox{\hyperlink{structmlx5__cache__ent_a1623aaec0cbfb93b058d24b3c3bf751f}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ac1a50cc20e467df066c0d2e10c28552a}{delay\_timer}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00475}00475 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00476}00476         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00477}00477 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00478}00478 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00479}\mbox{\hyperlink{mlx5__ib_8h_ad59f36bb0fc30ad1c7ea6bb708fc4be8}{00479}} \textcolor{keyword}{struct }ib\_mr *\mbox{\hyperlink{mlx5__ib__mr_8c_ad59f36bb0fc30ad1c7ea6bb708fc4be8}{mlx5\_ib\_get\_dma\_mr}}(\textcolor{keyword}{struct} ib\_pd *pd, \textcolor{keywordtype}{int} acc)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00480}00480 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00481}00481         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00482}00482         \textcolor{keywordtype}{int} inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(create\_mkey\_in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00483}00483         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00484}00484         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00485}00485         \textcolor{keywordtype}{void} *mkc;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00486}00486         u32 *in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00487}00487         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00488}00488 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00489}00489         mr = kzalloc(\textcolor{keyword}{sizeof}(*mr), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00490}00490         \textcolor{keywordflow}{if} (!mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00491}00491                 \textcolor{keywordflow}{return} ERR\_PTR(-\/ENOMEM);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00492}00492 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00493}00493         in = kzalloc(inlen, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00494}00494         \textcolor{keywordflow}{if} (!in) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00495}00495                 err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00496}00496                 \textcolor{keywordflow}{goto} err\_free;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00497}00497         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00498}00498 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00499}00499         mkc = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(create\_mkey\_in, in, memory\_key\_mkey\_entry);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00500}00500 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00501}00501         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, \mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}}, \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5a7629e18ab02e9643bda5701f756dc481}{MLX5\_ACCESS\_MODE\_PA}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00502}00502         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, a, !!(acc \& IB\_ACCESS\_REMOTE\_ATOMIC));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00503}00503         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, rw, !!(acc \& IB\_ACCESS\_REMOTE\_WRITE));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00504}00504         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, rr, !!(acc \& IB\_ACCESS\_REMOTE\_READ));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00505}00505         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, lw, !!(acc \& IB\_ACCESS\_LOCAL\_WRITE));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00506}00506         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, lr, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00507}00507 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00508}00508         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, length64, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00509}00509         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, pd, \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>pdn);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00510}00510         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, qpn, 0xffffff);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00511}00511         \mbox{\hyperlink{device_8h_a6e7776ca1e3178584753950058580eb6}{MLX5\_SET64}}(mkc, mkc, start\_addr, 0);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00512}00512 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00513}00513         err = \mbox{\hyperlink{driver_8h_aa55afac86fb98fe1a074177838e412bf}{mlx5\_core\_create\_mkey}}(mdev, \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}, in, inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00514}00514         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00515}00515                 \textcolor{keywordflow}{goto} err\_in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00516}00516 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00517}00517         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00518}00518         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.lkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00519}00519         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.rkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00520}00520         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}} = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00521}00521 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00522}00522         \textcolor{keywordflow}{return} \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00523}00523 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00524}00524 err\_in:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00525}00525         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00526}00526 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00527}00527 err\_free:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00528}00528         kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00529}00529 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00530}00530         \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00531}00531 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00532}00532 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00533}\mbox{\hyperlink{mlx5__ib__mr_8c_a39a05430812e582f1965e1c01cfa8498}{00533}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a39a05430812e582f1965e1c01cfa8498}{get\_octo\_len}}(u64 addr, u64 len, \textcolor{keywordtype}{int} page\_size)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00534}00534 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00535}00535         u64 offset;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00536}00536         \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00538}00538         offset = addr \& (page\_size -\/ 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00539}00539         \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} = ALIGN(len + offset, page\_size) >> ilog2(page\_size);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00540}00540         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} + 1) / 2;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00541}00541 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00542}00542 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00543}\mbox{\hyperlink{mlx5__ib__mr_8c_aeaa95ee1079ca218ffc951f7a14c39ca}{00543}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_aeaa95ee1079ca218ffc951f7a14c39ca}{use\_umr}}(\textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00544}00544 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00545}00545         \textcolor{keywordflow}{return} \mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}} <= \mbox{\hyperlink{mlx5__ib_8h_a832ccce715ef20ad43bf6e95a3a17cd7}{MLX5\_MAX\_UMR\_SHIFT}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00546}00546 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00547}00547 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00548}\mbox{\hyperlink{mlx5__ib__mr_8c_a1977b866554bf8d0d0dcabe054f0a725}{00548}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a1977b866554bf8d0d0dcabe054f0a725}{dma\_map\_mr\_pas}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{keyword}{struct} ib\_umem *\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00549}00549                           \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}}, \textcolor{keywordtype}{int} page\_shift, \textcolor{keywordtype}{int} *size,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00550}00550                           \_\_be64 **mr\_pas, dma\_addr\_t *dma)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00551}00551 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00552}00552         \_\_be64 *pas;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00553}00553         \textcolor{keyword}{struct }device *ddev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad6e3ba2b9a0e5ae708df08538ef40b45}{ib\_dev}}.dma\_device;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00554}00554 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00555}00555         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00556}00556 \textcolor{comment}{         * UMR copies MTTs in units of MLX5\_UMR\_MTT\_ALIGNMENT bytes.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00557}00557 \textcolor{comment}{         * To avoid copying garbage after the pas array, we allocate}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00558}00558 \textcolor{comment}{         * a little more.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00559}00559 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00560}00560         *size = ALIGN(\textcolor{keyword}{sizeof}(u64) * npages, \mbox{\hyperlink{device_8h_ac8ed7b0b157b55c32fcc4fa23a5bedb9}{MLX5\_UMR\_MTT\_ALIGNMENT}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00561}00561         *mr\_pas = kmalloc(*size + \mbox{\hyperlink{mlx5__ib__mr_8c_add5931494b7184a4abdcc06549462528}{MLX5\_UMR\_ALIGN}} -\/ 1, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00562}00562         \textcolor{keywordflow}{if} (!(*mr\_pas))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00563}00563                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00564}00564 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00565}00565         pas = PTR\_ALIGN(*mr\_pas, \mbox{\hyperlink{mlx5__ib__mr_8c_add5931494b7184a4abdcc06549462528}{MLX5\_UMR\_ALIGN}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00566}00566         \mbox{\hyperlink{mlx5__ib_8h_aa632996b34ed7613321620a079856f8e}{mlx5\_ib\_populate\_pas}}(dev, umem, page\_shift, pas, \mbox{\hyperlink{mlx5__ib_8h_aeceb9d669123387f2174caa2b6b3d37d}{MLX5\_IB\_MTT\_PRESENT}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00567}00567         \textcolor{comment}{/* Clear padding after the actual pages. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00568}00568         memset(pas + npages, 0, *size -\/ npages * \textcolor{keyword}{sizeof}(u64));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00569}00569 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00570}00570         *dma = dma\_map\_single(ddev, pas, *size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00571}00571         \textcolor{keywordflow}{if} (dma\_mapping\_error(ddev, *dma)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00572}00572                 kfree(*mr\_pas);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00573}00573                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00574}00574         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00575}00575 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00576}00576         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00577}00577 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00578}00578 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00579}\mbox{\hyperlink{mlx5__ib__mr_8c_af0c1b2e91ca64fb31b0ab62aae1ebc88}{00579}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_af0c1b2e91ca64fb31b0ab62aae1ebc88}{prep\_umr\_wqe\_common}}(\textcolor{keyword}{struct} ib\_pd *pd, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} *umrwr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00580}00580                                 \textcolor{keyword}{struct} ib\_sge *sg, u64 dma, \textcolor{keywordtype}{int} n, u32 key,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00581}00581                                 \textcolor{keywordtype}{int} page\_shift)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00582}00582 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00583}00583         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00584}00584 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00585}00585         sg-\/>addr = dma;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00586}00586         sg-\/>length = ALIGN(\textcolor{keyword}{sizeof}(u64) * n, 64);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00587}00587         sg-\/>lkey = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_adc5e0d08f6c214673a25dc6779f4f6b5}{umrc}}.\mbox{\hyperlink{structumr__common_a23b839c3bbe38540720ab84cafdba2b3}{pd}}-\/>local\_dma\_lkey;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00588}00588 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00589}00589         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.next = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00590}00590         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.sg\_list = sg;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00591}00591         \textcolor{keywordflow}{if} (n)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00592}00592                 umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.num\_sge = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00593}00593         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00594}00594                 umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.num\_sge = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00595}00595 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00596}00596         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.opcode = \mbox{\hyperlink{mlx5__ib_8h_a9c1a097bc875c8f49b91b7548bcd9021}{MLX5\_IB\_WR\_UMR}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00597}00597 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00598}00598         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ae436805d064e44a14ecad34dcd1f2032}{npages}} = n;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00599}00599         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_a9bd977301292a0e26a3381d33cc44292}{page\_shift}} = page\_shift;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00600}00600         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_aa749214d743e8749c2c324746c4baadf}{mkey}} = key;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00601}00601 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00602}00602 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00603}\mbox{\hyperlink{mlx5__ib__mr_8c_ae1f32021dd43f017914869675c8fbab4}{00603}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_ae1f32021dd43f017914869675c8fbab4}{prep\_umr\_reg\_wqe}}(\textcolor{keyword}{struct} ib\_pd *pd, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} *umrwr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00604}00604                              \textcolor{keyword}{struct} ib\_sge *sg, u64 dma, \textcolor{keywordtype}{int} n, u32 key,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00605}00605                              \textcolor{keywordtype}{int} page\_shift, u64 virt\_addr, u64 len,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00606}00606                              \textcolor{keywordtype}{int} access\_flags)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00607}00607 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00608}00608         \mbox{\hyperlink{mlx5__ib__mr_8c_af0c1b2e91ca64fb31b0ab62aae1ebc88}{prep\_umr\_wqe\_common}}(pd, umrwr, sg, dma, n, key, page\_shift);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00609}00609 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00610}00610         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.send\_flags = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00611}00611 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00612}00612         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_a3af88ab83e0f31595ebd43f691c0a7dc}{target}}.\mbox{\hyperlink{structmlx5__umr__wr_ab35f6129de107163322f03f1dd4988ab}{virt\_addr}} = virt\_addr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00613}00613         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_aad836ba7db4caba32523f8ff43be95a7}{length}} = len;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00614}00614         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_a97f6d3c268adc88f896037a5cc368aea}{access\_flags}} = access\_flags;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00615}00615         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_aa0f54d3492ea10e693ef457b45d17482}{pd}} = pd;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00616}00616 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00617}00617 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00618}\mbox{\hyperlink{mlx5__ib__mr_8c_aadb110a930466c34dcc139d70a6268c8}{00618}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_aadb110a930466c34dcc139d70a6268c8}{prep\_umr\_unreg\_wqe}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00619}00619                                \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} *umrwr, u32 key)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00620}00620 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00621}00621         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.send\_flags = \mbox{\hyperlink{mlx5__ib_8h_a782746899333ff398cb8be18e2446201}{MLX5\_IB\_SEND\_UMR\_UNREG}} | \mbox{\hyperlink{mlx5__ib_8h_a6ca8f3bde88dae90a6350de496d60d5b}{MLX5\_IB\_SEND\_UMR\_FAIL\_IF\_FREE}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00622}00622         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.opcode = \mbox{\hyperlink{mlx5__ib_8h_a9c1a097bc875c8f49b91b7548bcd9021}{MLX5\_IB\_WR\_UMR}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00623}00623         umrwr-\/>\mbox{\hyperlink{structmlx5__umr__wr_aa749214d743e8749c2c324746c4baadf}{mkey}} = key;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00624}00624 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00625}00625 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00626}\mbox{\hyperlink{mlx5__ib__mr_8c_ab9fa77a337f87305728948030e1b1ea6}{00626}} \textcolor{keyword}{static} \textcolor{keyword}{struct }ib\_umem *\mbox{\hyperlink{mlx5__ib__mr_8c_ab9fa77a337f87305728948030e1b1ea6}{mr\_umem\_get}}(\textcolor{keyword}{struct} ib\_pd *pd, u64 start, u64 length,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00627}00627                                    \textcolor{keywordtype}{int} access\_flags, \textcolor{keywordtype}{int} *npages,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00628}00628                                    \textcolor{keywordtype}{int} *page\_shift, \textcolor{keywordtype}{int} *ncont, \textcolor{keywordtype}{int} *order)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00629}00629 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00630}00630         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00631}00631         \textcolor{keyword}{struct }ib\_umem *umem = ib\_umem\_get(pd-\/>uobject-\/>context, start, length,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00632}00632                                            access\_flags, 0);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00633}00633         \textcolor{keywordflow}{if} (IS\_ERR(umem)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00634}00634                 \mbox{\hyperlink{mlx5__ib_8h_a70f92b9d27cecd20a7902a42e72544f7}{mlx5\_ib\_err}}(dev, \textcolor{stringliteral}{"{}umem get failed (\%ld)\(\backslash\)n"{}}, PTR\_ERR(umem));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00635}00635                 \textcolor{keywordflow}{return} (\textcolor{keywordtype}{void} *)umem;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00636}00636         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00637}00637 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00638}00638         \mbox{\hyperlink{mlx5__ib_8h_a078af05e9a50b56546252df6754917b9}{mlx5\_ib\_cont\_pages}}(umem, start, \mbox{\hyperlink{mlx5__ib_8h_a712f77822baa8709812c601599197d68}{MLX5\_MKEY\_PAGE\_SHIFT\_MASK}}, npages, page\_shift, ncont, order);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00639}00639         \textcolor{keywordflow}{if} (!*npages) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00640}00640                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}avoid zero region\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00641}00641                 ib\_umem\_release(umem);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00642}00642                 \textcolor{keywordflow}{return} ERR\_PTR(-\/EINVAL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00643}00643         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00644}00644 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00645}00645         \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}npages \%d, ncont \%d, order \%d, page\_shift \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00646}00646                     *npages, *ncont, *order, *page\_shift);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00647}00647 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00648}00648         \textcolor{keywordflow}{return} umem;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00649}00649 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00650}00650 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00651}\mbox{\hyperlink{mlx5__ib__mr_8c_a651217bf90cfadb9725e8cbcc7aea3f3}{00651}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a651217bf90cfadb9725e8cbcc7aea3f3}{mlx5\_ib\_umr\_done}}(\textcolor{keyword}{struct} ib\_cq *\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}, \textcolor{keyword}{struct} ib\_wc *wc)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00652}00652 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00653}00653         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}} *context =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00654}00654                 container\_of(wc-\/>wr\_cqe, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}}, \mbox{\hyperlink{structmlx5__ib__umr__context_a8caf4ae460007c9e7c4524a3a58485e7}{cqe}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00655}00655 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00656}00656         context-\/>\mbox{\hyperlink{structmlx5__ib__umr__context_a22261473a5d8cbc032450ae16f565ae6}{status}} = wc-\/>status;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00657}00657         complete(\&context-\/>\mbox{\hyperlink{structmlx5__ib__umr__context_aeb4961deffe0620c2d8a47d01b464ea9}{done}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00658}00658 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00659}00659 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00660}\mbox{\hyperlink{mlx5__ib__mr_8c_a940e1343a8823bcb6ed308cdf2747470}{00660}} \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a940e1343a8823bcb6ed308cdf2747470}{mlx5\_ib\_init\_umr\_context}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}} *context)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00661}00661 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00662}00662         context-\/>\mbox{\hyperlink{structmlx5__ib__umr__context_a8caf4ae460007c9e7c4524a3a58485e7}{cqe}}.done = \mbox{\hyperlink{mlx5__ib__mr_8c_a651217bf90cfadb9725e8cbcc7aea3f3}{mlx5\_ib\_umr\_done}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00663}00663         context-\/>\mbox{\hyperlink{structmlx5__ib__umr__context_a22261473a5d8cbc032450ae16f565ae6}{status}} = -\/1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00664}00664         init\_completion(\&context-\/>\mbox{\hyperlink{structmlx5__ib__umr__context_aeb4961deffe0620c2d8a47d01b464ea9}{done}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00665}00665 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00666}00666 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00667}\mbox{\hyperlink{mlx5__ib__mr_8c_aa8a6325a1d89f544850b57cb3ff5128f}{00667}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *\mbox{\hyperlink{mlx5__ib__mr_8c_aa8a6325a1d89f544850b57cb3ff5128f}{reg\_umr}}(\textcolor{keyword}{struct} ib\_pd *pd, \textcolor{keyword}{struct} ib\_umem *\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00668}00668                                   u64 virt\_addr, u64 len, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00669}00669                                   \textcolor{keywordtype}{int} page\_shift, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_adacbac137a43128c1e947a684cad2427}{order}}, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00670}00670 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00671}00671         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00672}00672         \textcolor{keyword}{struct }device *ddev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad6e3ba2b9a0e5ae708df08538ef40b45}{ib\_dev}}.dma\_device;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00673}00673         \textcolor{keyword}{struct }\mbox{\hyperlink{structumr__common}{umr\_common}} *umrc = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_adc5e0d08f6c214673a25dc6779f4f6b5}{umrc}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00674}00674         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}} umr\_context;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00675}00675         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} umrwr = \{\};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00676}00676         \textcolor{keyword}{const} \textcolor{keyword}{struct }ib\_send\_wr *bad;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00677}00677         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00678}00678         \textcolor{keyword}{struct }ib\_sge sg;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00679}00679         \textcolor{keywordtype}{int} size;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00680}00680         \_\_be64 *mr\_pas;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00681}00681         dma\_addr\_t dma;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00682}00682         \textcolor{keywordtype}{int} err = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00683}00683         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00684}00684 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00685}00685         \textcolor{keywordflow}{for} (i = 0; i < 1; i++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00686}00686                 mr = \mbox{\hyperlink{mlx5__ib__mr_8c_a212314b32cd8034bd1dd0ca395a15835}{alloc\_cached\_mr}}(dev, order);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00687}00687                 \textcolor{keywordflow}{if} (mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00688}00688                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00689}00689 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00690}00690                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_a2d5cfe74afd398dde37dd578df00d39d}{add\_keys}}(dev, \mbox{\hyperlink{mlx5__ib__mr_8c_a7ebf1c16ecea90b0bb236d3bc728f98e}{order2idx}}(dev, order), 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00691}00691                 \textcolor{keywordflow}{if} (err \&\& err != -\/EAGAIN) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00692}00692                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}add\_keys failed, err \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00693}00693                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00694}00694                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00695}00695         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00696}00696 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00697}00697         \textcolor{keywordflow}{if} (!mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00698}00698                 \textcolor{keywordflow}{return} ERR\_PTR(-\/EAGAIN);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00699}00699 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00700}00700         err = \mbox{\hyperlink{mlx5__ib__mr_8c_a1977b866554bf8d0d0dcabe054f0a725}{dma\_map\_mr\_pas}}(dev, umem, npages, page\_shift, \&size, \&mr\_pas,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00701}00701                              \&dma);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00702}00702         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00703}00703                 \textcolor{keywordflow}{goto} free\_mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00704}00704 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00705}00705         \mbox{\hyperlink{mlx5__ib__mr_8c_a940e1343a8823bcb6ed308cdf2747470}{mlx5\_ib\_init\_umr\_context}}(\&umr\_context);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00706}00706 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00707}00707         umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.wr\_cqe = \&umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a8caf4ae460007c9e7c4524a3a58485e7}{cqe}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00708}00708         \mbox{\hyperlink{mlx5__ib__mr_8c_ae1f32021dd43f017914869675c8fbab4}{prep\_umr\_reg\_wqe}}(pd, \&umrwr, \&sg, dma, npages, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00709}00709                          page\_shift, virt\_addr, len, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00710}00710 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00711}00711         down(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00712}00712         err = ib\_post\_send(umrc-\/>\mbox{\hyperlink{structumr__common_a7002e850b64b9678dece3b6cf09003a4}{qp}}, \&umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}, \&bad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00713}00713         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00714}00714                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}post send failed, err \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00715}00715                 \textcolor{keywordflow}{goto} unmap\_dma;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00716}00716         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00717}00717                 wait\_for\_completion(\&umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_aeb4961deffe0620c2d8a47d01b464ea9}{done}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00718}00718                 \textcolor{keywordflow}{if} (umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a22261473a5d8cbc032450ae16f565ae6}{status}} != IB\_WC\_SUCCESS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00719}00719                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}reg umr failed\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00720}00720                         err = -\/EFAULT;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00721}00721                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00722}00722         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00723}00723 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00724}00724         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a1c5bf7e726bc6fd00047dee8706eb27c}{iova}} = virt\_addr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00725}00725         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a76bdd58ff2c0cf110e6234be91da9ff4}{size}} = len;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00726}00726         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_adc1003b7a05604ad94b034f5faba8e95}{pd}} = \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>\mbox{\hyperlink{structmlx5__ib__pd_aa4f481df5c47264ed9e065614a96ddd2}{pdn}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00727}00727 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00728}00728         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a9d9fd628e03d3d8be1f1963c16de6d9d}{live}} = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00729}00729 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00730}00730 unmap\_dma:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00731}00731         up(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00732}00732         dma\_unmap\_single(ddev, dma, size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00733}00733 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00734}00734         kfree(mr\_pas);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00735}00735 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00736}00736 free\_mr:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00737}00737         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00738}00738                 \mbox{\hyperlink{mlx5__ib__mr_8c_a0cdef076bcacca8388ffebb47063e136}{free\_cached\_mr}}(dev, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00739}00739                 \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00740}00740         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00741}00741 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00742}00742         \textcolor{keywordflow}{return} mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00743}00743 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00744}00744 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00745}00745 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00746}00746 \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib_8h_a0d880ab77f36323c5bdfd522269e2543}{mlx5\_ib\_update\_mtt}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr, u64 start\_page\_index, \textcolor{keywordtype}{int} npages,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00747}00747                        \textcolor{keywordtype}{int} zap)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00748}00748 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00749}00749         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00750}00750         \textcolor{keyword}{struct }device *ddev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad6e3ba2b9a0e5ae708df08538ef40b45}{ib\_dev}}.dma\_device;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00751}00751         \textcolor{keyword}{struct }\mbox{\hyperlink{structumr__common}{umr\_common}} *umrc = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_adc5e0d08f6c214673a25dc6779f4f6b5}{umrc}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00752}00752         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}} umr\_context;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00753}00753         \textcolor{keyword}{struct }ib\_umem *umem = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00754}00754         \textcolor{keywordtype}{int} size;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00755}00755         \_\_be64 *pas;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00756}00756         dma\_addr\_t dma;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00757}00757         \textcolor{keyword}{const} \textcolor{keyword}{struct }ib\_send\_wr *bad;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00758}00758         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} \mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00759}00759         \textcolor{keyword}{struct }ib\_sge sg;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00760}00760         \textcolor{keywordtype}{int} err = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00761}00761         \textcolor{keyword}{const} \textcolor{keywordtype}{int} page\_index\_alignment = \mbox{\hyperlink{device_8h_ac8ed7b0b157b55c32fcc4fa23a5bedb9}{MLX5\_UMR\_MTT\_ALIGNMENT}} / \textcolor{keyword}{sizeof}(u64);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00762}00762         \textcolor{keyword}{const} \textcolor{keywordtype}{int} page\_index\_mask = page\_index\_alignment -\/ 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00763}00763         \textcolor{keywordtype}{size\_t} pages\_mapped = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00764}00764         \textcolor{keywordtype}{size\_t} pages\_to\_map = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00765}00765         \textcolor{keywordtype}{size\_t} pages\_iter = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00766}00766         \textcolor{keywordtype}{int} use\_emergency\_buf = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00767}00767 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00768}00768         \textcolor{comment}{/* UMR copies MTTs in units of MLX5\_UMR\_MTT\_ALIGNMENT bytes,}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00769}00769 \textcolor{comment}{         * so we need to align the offset and length accordingly */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00770}00770         \textcolor{keywordflow}{if} (start\_page\_index \& page\_index\_mask) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00771}00771                 npages += start\_page\_index \& page\_index\_mask;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00772}00772                 start\_page\_index \&= \string~page\_index\_mask;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00773}00773         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00774}00774 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00775}00775         pages\_to\_map = ALIGN(npages, page\_index\_alignment);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00776}00776 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00777}00777         \textcolor{keywordflow}{if} (start\_page\_index + pages\_to\_map > \mbox{\hyperlink{mlx5__ib_8h_a381fe490ff89039ac570a902f0855732}{MLX5\_MAX\_UMR\_PAGES}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00778}00778                 \textcolor{keywordflow}{return} -\/EINVAL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00779}00779 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00780}00780         size = \textcolor{keyword}{sizeof}(u64) * pages\_to\_map;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00781}00781         size = min\_t(\textcolor{keywordtype}{int}, PAGE\_SIZE, size);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00782}00782         \textcolor{comment}{/* We allocate with GFP\_ATOMIC to avoid recursion into page-\/reclaim}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00783}00783 \textcolor{comment}{         * code, when we are called from an invalidation. The pas buffer must}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00784}00784 \textcolor{comment}{         * be 2k-\/aligned for Connect-\/IB. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00785}00785         pas = (\_\_be64 *)get\_zeroed\_page(GFP\_ATOMIC);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00786}00786         \textcolor{keywordflow}{if} (!pas) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00787}00787                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}unable to allocate memory during MTT update, falling back to slower chunked mechanism.\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00788}00788                 pas = mlx5\_ib\_update\_mtt\_emergency\_buffer;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00789}00789                 size = \mbox{\hyperlink{device_8h_a033e6064753079e9276f53e4db9c241b}{MLX5\_UMR\_MTT\_MIN\_CHUNK\_SIZE}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00790}00790                 use\_emergency\_buf = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00791}00791                 mutex\_lock(\&mlx5\_ib\_update\_mtt\_emergency\_buffer\_mutex);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00792}00792                 memset(pas, 0, size);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00793}00793         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00794}00794         pages\_iter = size / \textcolor{keyword}{sizeof}(u64);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00795}00795         dma = dma\_map\_single(ddev, pas, size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00796}00796         \textcolor{keywordflow}{if} (dma\_mapping\_error(ddev, dma)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00797}00797                 \mbox{\hyperlink{mlx5__ib_8h_a70f92b9d27cecd20a7902a42e72544f7}{mlx5\_ib\_err}}(dev, \textcolor{stringliteral}{"{}unable to map DMA during MTT update.\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00798}00798                 err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00799}00799                 \textcolor{keywordflow}{goto} free\_pas;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00800}00800         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00801}00801 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00802}00802         \textcolor{keywordflow}{for} (pages\_mapped = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00803}00803              pages\_mapped < pages\_to\_map \&\& !err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00804}00804              pages\_mapped += pages\_iter, start\_page\_index += pages\_iter) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00805}00805                 dma\_sync\_single\_for\_cpu(ddev, dma, size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00806}00806 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00807}00807                 npages = min\_t(\textcolor{keywordtype}{size\_t},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00808}00808                                pages\_iter,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00809}00809                                ib\_umem\_num\_pages(umem) -\/ start\_page\_index);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00810}00810 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00811}00811                 \textcolor{keywordflow}{if} (!zap) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00812}00812                         \mbox{\hyperlink{mlx5__ib_8h_afbe5e36aecf0ca4446f6f7fadc61cc9e}{\_\_mlx5\_ib\_populate\_pas}}(dev, umem, PAGE\_SHIFT,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00813}00813                                                start\_page\_index, npages, pas,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00814}00814                                                \mbox{\hyperlink{mlx5__ib_8h_aeceb9d669123387f2174caa2b6b3d37d}{MLX5\_IB\_MTT\_PRESENT}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00815}00815                         \textcolor{comment}{/* Clear padding after the pages brought from the}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00816}00816 \textcolor{comment}{                         * umem. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00817}00817                         memset(pas + npages, 0, size -\/ npages * \textcolor{keyword}{sizeof}(u64));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00818}00818                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00819}00819 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00820}00820                 dma\_sync\_single\_for\_device(ddev, dma, size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00821}00821 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00822}00822                 \mbox{\hyperlink{mlx5__ib__mr_8c_a940e1343a8823bcb6ed308cdf2747470}{mlx5\_ib\_init\_umr\_context}}(\&umr\_context);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00823}00823 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00824}00824                 memset(\&wr, 0, \textcolor{keyword}{sizeof}(wr));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00825}00825                 wr.wr.wr\_cqe = \&umr\_context.cqe;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00826}00826 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00827}00827                 sg.addr = dma;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00828}00828                 sg.length = ALIGN(npages * \textcolor{keyword}{sizeof}(u64),}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00829}00829                                 \mbox{\hyperlink{device_8h_ac8ed7b0b157b55c32fcc4fa23a5bedb9}{MLX5\_UMR\_MTT\_ALIGNMENT}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00830}00830                 sg.lkey = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_adc5e0d08f6c214673a25dc6779f4f6b5}{umrc}}.\mbox{\hyperlink{structumr__common_a23b839c3bbe38540720ab84cafdba2b3}{pd}}-\/>local\_dma\_lkey;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00831}00831 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00832}00832                 wr.wr.send\_flags = \mbox{\hyperlink{mlx5__ib_8h_a6ca8f3bde88dae90a6350de496d60d5b}{MLX5\_IB\_SEND\_UMR\_FAIL\_IF\_FREE}} |}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00833}00833                                 \mbox{\hyperlink{mlx5__ib_8h_a76e75c1f9a9f5e8ba9893db2b508857d}{MLX5\_IB\_SEND\_UMR\_UPDATE\_MTT}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00834}00834                 wr.wr.sg\_list = \&sg;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00835}00835                 wr.wr.num\_sge = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00836}00836                 wr.wr.opcode = \mbox{\hyperlink{mlx5__ib_8h_a9c1a097bc875c8f49b91b7548bcd9021}{MLX5\_IB\_WR\_UMR}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00837}00837                 wr.npages = sg.length / \textcolor{keyword}{sizeof}(u64);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00838}00838                 wr.page\_shift = PAGE\_SHIFT;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00839}00839                 wr.mkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00840}00840                 wr.target.offset = start\_page\_index;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00841}00841 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00842}00842                 down(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00843}00843                 err = ib\_post\_send(umrc-\/>\mbox{\hyperlink{structumr__common_a7002e850b64b9678dece3b6cf09003a4}{qp}}, \&wr.wr, \&bad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00844}00844                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00845}00845                         \mbox{\hyperlink{mlx5__ib_8h_a70f92b9d27cecd20a7902a42e72544f7}{mlx5\_ib\_err}}(dev, \textcolor{stringliteral}{"{}UMR post send failed, err \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00846}00846                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00847}00847                         wait\_for\_completion(\&umr\_context.done);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00848}00848                         \textcolor{keywordflow}{if} (umr\_context.status != IB\_WC\_SUCCESS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00849}00849                                 \mbox{\hyperlink{mlx5__ib_8h_a70f92b9d27cecd20a7902a42e72544f7}{mlx5\_ib\_err}}(dev, \textcolor{stringliteral}{"{}UMR completion failed, code \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00850}00850                                             umr\_context.status);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00851}00851                                 err = -\/EFAULT;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00852}00852                         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00853}00853                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00854}00854                 up(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00855}00855         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00856}00856         dma\_unmap\_single(ddev, dma, size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00857}00857 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00858}00858 free\_pas:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00859}00859         \textcolor{keywordflow}{if} (!use\_emergency\_buf)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00860}00860                 free\_page((\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long})pas);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00861}00861         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00862}00862                 mutex\_unlock(\&mlx5\_ib\_update\_mtt\_emergency\_buffer\_mutex);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00863}00863 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00864}00864         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00865}00865 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00866}00866 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00867}00867 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00868}00868 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00869}00869 \textcolor{comment}{ * If ibmr is NULL it will be allocated by reg\_create.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00870}00870 \textcolor{comment}{ * Else, the given ibmr will be used.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00871}00871 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00872}\mbox{\hyperlink{mlx5__ib__mr_8c_a8310c23f42638dc670640f1c9bee31cd}{00872}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *\mbox{\hyperlink{mlx5__ib__mr_8c_a8310c23f42638dc670640f1c9bee31cd}{reg\_create}}(\textcolor{keyword}{struct} ib\_mr *\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}, \textcolor{keyword}{struct} ib\_pd *pd,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00873}00873                                      u64 virt\_addr, u64 length,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00874}00874                                      \textcolor{keyword}{struct} ib\_umem *\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00875}00875                                      \textcolor{keywordtype}{int} page\_shift, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00876}00876 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00877}00877         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00878}00878         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00879}00879         \_\_be64 *pas;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00880}00880         \textcolor{keywordtype}{void} *mkc;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00881}00881         \textcolor{keywordtype}{int} inlen;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00882}00882         u32 *in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00883}00883         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00884}00884         \textcolor{keywordtype}{bool} pg\_cap = !!(\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, pg));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00885}00885 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00886}00886         mr = \mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}} ? \mbox{\hyperlink{mlx5__ib_8h_a0779e0bd8bcdb4f4ef3e2443f472ccb3}{to\_mmr}}(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}) : kzalloc(\textcolor{keyword}{sizeof}(*mr), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00887}00887         \textcolor{keywordflow}{if} (!mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00888}00888                 \textcolor{keywordflow}{return} ERR\_PTR(-\/ENOMEM);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00889}00889 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00890}00890         inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(create\_mkey\_in) +}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00891}00891                 \textcolor{keyword}{sizeof}(*pas) * ((\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} + 1) / 2) * 2;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00892}00892         in = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00893}00893         \textcolor{keywordflow}{if} (!in) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00894}00894                 err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00895}00895                 \textcolor{keywordflow}{goto} err\_1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00896}00896         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00897}00897         pas = (\_\_be64 *)\mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(create\_mkey\_in, in, klm\_pas\_mtt);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00898}00898         \mbox{\hyperlink{mlx5__ib_8h_aa632996b34ed7613321620a079856f8e}{mlx5\_ib\_populate\_pas}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}, page\_shift, pas,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00899}00899                              pg\_cap ? \mbox{\hyperlink{mlx5__ib_8h_aeceb9d669123387f2174caa2b6b3d37d}{MLX5\_IB\_MTT\_PRESENT}} : 0);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00900}00900 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00901}00901         \textcolor{comment}{/* The pg\_access bit allows setting the access flags}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00902}00902 \textcolor{comment}{         * in the page list submitted with the command. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00903}00903         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(create\_mkey\_in, in, pg\_access, !!(pg\_cap));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00904}00904 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00905}00905         mkc = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(create\_mkey\_in, in, memory\_key\_mkey\_entry);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00906}00906         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, \mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}}, \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5afd47a643b123a67e70880f2c19ea987e}{MLX5\_ACCESS\_MODE\_MTT}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00907}00907         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, a, !!(\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}} \& IB\_ACCESS\_REMOTE\_ATOMIC));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00908}00908         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, rw, !!(\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}} \& IB\_ACCESS\_REMOTE\_WRITE));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00909}00909         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, rr, !!(\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}} \& IB\_ACCESS\_REMOTE\_READ));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00910}00910         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, lw, !!(\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}} \& IB\_ACCESS\_LOCAL\_WRITE));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00911}00911         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, lr, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00912}00912 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00913}00913         \mbox{\hyperlink{device_8h_a6e7776ca1e3178584753950058580eb6}{MLX5\_SET64}}(mkc, mkc, start\_addr, virt\_addr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00914}00914         \mbox{\hyperlink{device_8h_a6e7776ca1e3178584753950058580eb6}{MLX5\_SET64}}(mkc, mkc, len, length);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00915}00915         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, pd, \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>pdn);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00916}00916         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, bsf\_octword\_size, 0);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00917}00917         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, translations\_octword\_size,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00918}00918                  \mbox{\hyperlink{mlx5__ib__mr_8c_a39a05430812e582f1965e1c01cfa8498}{get\_octo\_len}}(virt\_addr, length, 1 << page\_shift));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00919}00919         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, log\_page\_size, page\_shift);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00920}00920         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, qpn, 0xffffff);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00921}00921         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(create\_mkey\_in, in, translations\_octword\_actual\_size,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00922}00922                  \mbox{\hyperlink{mlx5__ib__mr_8c_a39a05430812e582f1965e1c01cfa8498}{get\_octo\_len}}(virt\_addr, length, 1 << page\_shift));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00923}00923 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00924}00924         err = \mbox{\hyperlink{driver_8h_aa55afac86fb98fe1a074177838e412bf}{mlx5\_core\_create\_mkey}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}, in, inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00925}00925         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00926}00926                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{stringliteral}{"{}create mkey failed\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00927}00927                 \textcolor{keywordflow}{goto} err\_2;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00928}00928         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00929}00929         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}} = \mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00930}00930         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}} = \mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00931}00931         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a9d9fd628e03d3d8be1f1963c16de6d9d}{live}} = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00932}00932         kvfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00933}00933 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00934}00934         \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{stringliteral}{"{}mkey = 0x\%x\(\backslash\)n"{}}, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00935}00935 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00936}00936         \textcolor{keywordflow}{return} mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00937}00937 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00938}00938 err\_2:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00939}00939         kvfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00940}00940 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00941}00941 err\_1:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00942}00942         \textcolor{keywordflow}{if} (!\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00943}00943                 kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00944}00944 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00945}00945         \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00946}00946 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00947}00947 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00948}\mbox{\hyperlink{mlx5__ib__mr_8c_a123b8c2b5fd45182289117d6b991c4e9}{00948}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mr_8c_a123b8c2b5fd45182289117d6b991c4e9}{set\_mr\_fileds}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00949}00949                           \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}}, u64 length, \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00950}00950 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00951}00951         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} = \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00952}00952         atomic\_add(\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}}, \&\mbox{\hyperlink{structmlx5__ib__mr_acb7157751bb0930b1ba3841180b659ba}{dev}}-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_a60f1b470811c4394d7e3085400214d03}{reg\_pages}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00953}00953         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.lkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00954}00954         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.rkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00955}00955         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.length = length;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00956}00956         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}} = \mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00957}00957 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00958}00958 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00959}\mbox{\hyperlink{mlx5__ib_8h_ab0089021e56311754e298d55b934f5fa}{00959}} \textcolor{keyword}{struct }ib\_mr *\mbox{\hyperlink{mlx5__ib__mr_8c_ab0089021e56311754e298d55b934f5fa}{mlx5\_ib\_reg\_user\_mr}}(\textcolor{keyword}{struct} ib\_pd *pd, u64 start, u64 length,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00960}00960                                   u64 virt\_addr, \textcolor{keywordtype}{int} access\_flags,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00961}00961                                   \textcolor{keyword}{struct} ib\_udata *udata)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00962}00962 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00963}00963         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00964}00964         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00965}00965         \textcolor{keyword}{struct }ib\_umem *umem;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00966}00966         \textcolor{keywordtype}{int} page\_shift;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00967}00967         \textcolor{keywordtype}{int} npages;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00968}00968         \textcolor{keywordtype}{int} ncont;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00969}00969         \textcolor{keywordtype}{int} order;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00970}00970         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00971}00971 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00972}00972         \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}start 0x\%llx, virt\_addr 0x\%llx, length 0x\%llx, access\_flags 0x\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00973}00973                     (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})start, (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})virt\_addr, (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})length, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00974}00974         umem = \mbox{\hyperlink{mlx5__ib__mr_8c_ab9fa77a337f87305728948030e1b1ea6}{mr\_umem\_get}}(pd, start, length, access\_flags, \&npages,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00975}00975                            \&page\_shift, \&ncont, \&order);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00976}00976 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00977}00977         \textcolor{keywordflow}{if} (IS\_ERR(umem))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00978}00978                 \textcolor{keywordflow}{return} (\textcolor{keywordtype}{void} *)umem;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00979}00979 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00980}00980         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mlx5__ib__mr_8c_aeaa95ee1079ca218ffc951f7a14c39ca}{use\_umr}}(order)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00981}00981                 mr = \mbox{\hyperlink{mlx5__ib__mr_8c_aa8a6325a1d89f544850b57cb3ff5128f}{reg\_umr}}(pd, umem, virt\_addr, length, ncont, page\_shift,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00982}00982                              order, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00983}00983                 \textcolor{keywordflow}{if} (PTR\_ERR(mr) == -\/EAGAIN) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00984}00984                         \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}cache empty for order \%d"{}}, order);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00985}00985                         mr = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00986}00986                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00987}00987         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (access\_flags \& IB\_ACCESS\_ON\_DEMAND) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00988}00988                 err = -\/EINVAL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00989}00989                 pr\_err(\textcolor{stringliteral}{"{}Got MR registration for ODP MR > 512MB, not supported for Connect-\/IB"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00990}00990                 \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00991}00991         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00992}00992 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00993}00993         \textcolor{keywordflow}{if} (!mr) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00994}00994                 mutex\_lock(\&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_a43c8568e133ee81f02f2a29da155ea97}{slow\_path\_mutex}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00995}00995                 mr = \mbox{\hyperlink{mlx5__ib__mr_8c_a8310c23f42638dc670640f1c9bee31cd}{reg\_create}}(NULL, pd, virt\_addr, length, umem, ncont,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00996}00996                                 page\_shift, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00997}00997                 mutex\_unlock(\&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_a43c8568e133ee81f02f2a29da155ea97}{slow\_path\_mutex}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00998}00998         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l00999}00999 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01000}01000         \textcolor{keywordflow}{if} (IS\_ERR(mr)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01001}01001                 err = PTR\_ERR(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01002}01002                 \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01003}01003         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01004}01004 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01005}01005         \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}mkey 0x\%x\(\backslash\)n"{}}, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01006}01006 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01007}01007         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}} = umem;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01008}01008         \mbox{\hyperlink{mlx5__ib__mr_8c_a123b8c2b5fd45182289117d6b991c4e9}{set\_mr\_fileds}}(dev, mr, npages, length, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01009}01009 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01010}01010 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01011}01011         update\_odp\_mr(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01012}01012 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01013}01013 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01014}01014         \textcolor{keywordflow}{return} \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01015}01015 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01016}01016 error:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01017}01017         ib\_umem\_release(umem);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01018}01018         \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01019}01019 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01020}01020 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01021}\mbox{\hyperlink{mlx5__ib__mr_8c_a3dd7e072ea2b5e70f3a6161a3969fb56}{01021}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a3dd7e072ea2b5e70f3a6161a3969fb56}{unreg\_umr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01022}01022 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01023}01023         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01024}01024         \textcolor{keyword}{struct }\mbox{\hyperlink{structumr__common}{umr\_common}} *umrc = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_adc5e0d08f6c214673a25dc6779f4f6b5}{umrc}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01025}01025         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}} umr\_context;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01026}01026         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} umrwr = \{\};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01027}01027         \textcolor{keyword}{const} \textcolor{keyword}{struct }ib\_send\_wr *bad;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01028}01028         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01029}01029 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01030}01030         \textcolor{keywordflow}{if} (mdev-\/>\mbox{\hyperlink{structmlx5__core__dev_aaee056f22d7ec1c4298ffb20189ec7e5}{state}} == \mbox{\hyperlink{driver_8h_aa42b19437cec785545106d8c76e3d9dda09cf6fffb12218a75a5f45b789ce5c62}{MLX5\_DEVICE\_STATE\_INTERNAL\_ERROR}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01031}01031                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01032}01032 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01033}01033         \mbox{\hyperlink{mlx5__ib__mr_8c_a940e1343a8823bcb6ed308cdf2747470}{mlx5\_ib\_init\_umr\_context}}(\&umr\_context);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01034}01034 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01035}01035         umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.wr\_cqe = \&umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a8caf4ae460007c9e7c4524a3a58485e7}{cqe}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01036}01036         \mbox{\hyperlink{mlx5__ib__mr_8c_aadb110a930466c34dcc139d70a6268c8}{prep\_umr\_unreg\_wqe}}(dev, \&umrwr, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01037}01037 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01038}01038         down(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01039}01039         err = ib\_post\_send(umrc-\/>\mbox{\hyperlink{structumr__common_a7002e850b64b9678dece3b6cf09003a4}{qp}}, \&umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}, \&bad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01040}01040         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01041}01041                 up(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01042}01042                 \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}err \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01043}01043                 \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01044}01044         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01045}01045                 wait\_for\_completion(\&umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_aeb4961deffe0620c2d8a47d01b464ea9}{done}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01046}01046                 up(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01047}01047         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01048}01048         \textcolor{keywordflow}{if} (umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a22261473a5d8cbc032450ae16f565ae6}{status}} != IB\_WC\_SUCCESS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01049}01049                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}unreg umr failed\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01050}01050                 err = -\/EFAULT;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01051}01051                 \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01052}01052         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01053}01053         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01054}01054 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01055}01055 error:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01056}01056         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01057}01057 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01058}01058 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01059}\mbox{\hyperlink{mlx5__ib__mr_8c_acb2d0cf68e1634507b01f8261f2722bc}{01059}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_acb2d0cf68e1634507b01f8261f2722bc}{rereg\_umr}}(\textcolor{keyword}{struct} ib\_pd *pd, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr, u64 virt\_addr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01060}01060                      u64 length, \textcolor{keywordtype}{int} npages, \textcolor{keywordtype}{int} page\_shift, \textcolor{keywordtype}{int} order,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01061}01061                      \textcolor{keywordtype}{int} access\_flags, \textcolor{keywordtype}{int} flags)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01062}01062 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01063}01063         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01064}01064         \textcolor{keyword}{struct }device *ddev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad6e3ba2b9a0e5ae708df08538ef40b45}{ib\_dev}}.dma\_device;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01065}01065         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__umr__context}{mlx5\_ib\_umr\_context}} umr\_context;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01066}01066         \textcolor{keyword}{const} \textcolor{keyword}{struct }ib\_send\_wr *bad;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01067}01067         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__umr__wr}{mlx5\_umr\_wr}} umrwr = \{\};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01068}01068         \textcolor{keyword}{struct }ib\_sge sg;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01069}01069         \textcolor{keyword}{struct }\mbox{\hyperlink{structumr__common}{umr\_common}} *umrc = \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_adc5e0d08f6c214673a25dc6779f4f6b5}{umrc}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01070}01070         dma\_addr\_t dma = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01071}01071         \_\_be64 *mr\_pas = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01072}01072         \textcolor{keywordtype}{int} size;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01073}01073         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01074}01074 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01075}01075         \mbox{\hyperlink{mlx5__ib__mr_8c_a940e1343a8823bcb6ed308cdf2747470}{mlx5\_ib\_init\_umr\_context}}(\&umr\_context);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01076}01076 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01077}01077         umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.wr\_cqe = \&umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a8caf4ae460007c9e7c4524a3a58485e7}{cqe}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01078}01078         umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.send\_flags = \mbox{\hyperlink{mlx5__ib_8h_a6ca8f3bde88dae90a6350de496d60d5b}{MLX5\_IB\_SEND\_UMR\_FAIL\_IF\_FREE}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01079}01079 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01080}01080         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_TRANS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01081}01081                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_a1977b866554bf8d0d0dcabe054f0a725}{dma\_map\_mr\_pas}}(dev, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}, npages, page\_shift, \&size,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01082}01082                                      \&mr\_pas, \&dma);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01083}01083                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01084}01084                         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01085}01085 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01086}01086                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_a3af88ab83e0f31595ebd43f691c0a7dc}{target}}.\mbox{\hyperlink{structmlx5__umr__wr_ab35f6129de107163322f03f1dd4988ab}{virt\_addr}} = virt\_addr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01087}01087                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_aad836ba7db4caba32523f8ff43be95a7}{length}} = length;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01088}01088                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.send\_flags |= \mbox{\hyperlink{mlx5__ib_8h_aca2375c27b5eda0fcfd7ef602bccf7d8}{MLX5\_IB\_SEND\_UMR\_UPDATE\_TRANSLATION}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01089}01089         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01090}01090 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01091}01091         \mbox{\hyperlink{mlx5__ib__mr_8c_af0c1b2e91ca64fb31b0ab62aae1ebc88}{prep\_umr\_wqe\_common}}(\mbox{\hyperlink{structumr__common_a23b839c3bbe38540720ab84cafdba2b3}{pd}}, \&umrwr, \&sg, dma, npages, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01092}01092                             page\_shift);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01093}01093 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01094}01094         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_PD) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01095}01095                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_aa0f54d3492ea10e693ef457b45d17482}{pd}} = \mbox{\hyperlink{structumr__common_a23b839c3bbe38540720ab84cafdba2b3}{pd}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01096}01096                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.send\_flags |= \mbox{\hyperlink{mlx5__ib_8h_acddb31e0510fcb01a0eab65d7bf0b418}{MLX5\_IB\_SEND\_UMR\_UPDATE\_PD}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01097}01097         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01098}01098 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01099}01099         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_ACCESS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01100}01100                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_a97f6d3c268adc88f896037a5cc368aea}{access\_flags}} = access\_flags;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01101}01101                 umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}.send\_flags |= \mbox{\hyperlink{mlx5__ib_8h_a91b6c3c597a84f50434ae81a0f95d593}{MLX5\_IB\_SEND\_UMR\_UPDATE\_ACCESS}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01102}01102         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01103}01103 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01104}01104         \textcolor{comment}{/* post send request to UMR QP */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01105}01105         down(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01106}01106         err = ib\_post\_send(umrc-\/>\mbox{\hyperlink{structumr__common_a7002e850b64b9678dece3b6cf09003a4}{qp}}, \&umrwr.\mbox{\hyperlink{structmlx5__umr__wr_ac7130233e84fc7e3db8d3e21182546b8}{wr}}, \&bad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01107}01107 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01108}01108         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01109}01109                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}post send failed, err \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01110}01110         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01111}01111                 wait\_for\_completion(\&umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_aeb4961deffe0620c2d8a47d01b464ea9}{done}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01112}01112                 \textcolor{keywordflow}{if} (umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a22261473a5d8cbc032450ae16f565ae6}{status}} != IB\_WC\_SUCCESS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01113}01113                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}reg umr failed (\%u)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01114}01114                                      umr\_context.\mbox{\hyperlink{structmlx5__ib__umr__context_a22261473a5d8cbc032450ae16f565ae6}{status}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01115}01115                         err = -\/EFAULT;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01116}01116                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01117}01117         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01118}01118 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01119}01119         up(\&umrc-\/>\mbox{\hyperlink{structumr__common_a3137df15fcf03e2bf4722884cde4c812}{sem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01120}01120         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_TRANS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01121}01121                 dma\_unmap\_single(ddev, dma, size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01122}01122                 kfree(mr\_pas);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01123}01123         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01124}01124         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01125}01125 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01126}01126 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01127}\mbox{\hyperlink{mlx5__ib_8h_abb1e93d15a9f8eca33e105894a3ffa9a}{01127}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_af8651ccabc72d810a1c98ca493bee906}{mlx5\_ib\_rereg\_user\_mr}}(\textcolor{keyword}{struct} ib\_mr *ib\_mr, \textcolor{keywordtype}{int} flags, u64 start,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01128}01128                           u64 length, u64 virt\_addr, \textcolor{keywordtype}{int} new\_access\_flags,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01129}01129                           \textcolor{keyword}{struct} ib\_pd *new\_pd, \textcolor{keyword}{struct} ib\_udata *udata)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01130}01130 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01131}01131         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ib\_mr-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01132}01132         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr = \mbox{\hyperlink{mlx5__ib_8h_a0779e0bd8bcdb4f4ef3e2443f472ccb3}{to\_mmr}}(ib\_mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01133}01133         \textcolor{keyword}{struct }ib\_pd *pd = (flags \& IB\_MR\_REREG\_PD) ? new\_pd : ib\_mr-\/>pd;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01134}01134         \textcolor{keywordtype}{int} access\_flags = flags \& IB\_MR\_REREG\_ACCESS ?}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01135}01135                             new\_access\_flags :}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01136}01136                             mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01137}01137         u64 addr = (flags \& IB\_MR\_REREG\_TRANS) ? virt\_addr : mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}-\/>address;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01138}01138         u64 len = (flags \& IB\_MR\_REREG\_TRANS) ? length : mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}-\/>length;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01139}01139         \textcolor{keywordtype}{int} page\_shift = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01140}01140         \textcolor{keywordtype}{int} npages = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01141}01141         \textcolor{keywordtype}{int} ncont = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01142}01142         \textcolor{keywordtype}{int} order = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01143}01143         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01144}01144 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01145}01145         \mbox{\hyperlink{mlx5__ib_8h_ad0c148e0ae3bd0d552c0f392c473271f}{mlx5\_ib\_dbg}}(dev, \textcolor{stringliteral}{"{}start 0x\%llx, virt\_addr 0x\%llx, length 0x\%llx, access\_flags 0x\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01146}01146                     (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})start, (\textcolor{keywordtype}{long} long)virt\_addr, (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})length, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01147}01147 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01148}01148         \textcolor{keywordflow}{if} (flags != IB\_MR\_REREG\_PD) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01149}01149                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01150}01150 \textcolor{comment}{                 * Replace umem. This needs to be done whether or not UMR is}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01151}01151 \textcolor{comment}{                 * used.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01152}01152 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01153}01153                 flags |= IB\_MR\_REREG\_TRANS;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01154}01154                 ib\_umem\_release(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01155}01155                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}} = \mbox{\hyperlink{mlx5__ib__mr_8c_ab9fa77a337f87305728948030e1b1ea6}{mr\_umem\_get}}(pd, addr, len, access\_flags, \&npages,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01156}01156                                        \&page\_shift, \&ncont, \&order);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01157}01157                 \textcolor{keywordflow}{if} (IS\_ERR(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}})) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01158}01158                         err = PTR\_ERR(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01159}01159                         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}} = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01160}01160                         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01161}01161                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01162}01162         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01163}01163 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01164}01164         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_TRANS \&\& !\mbox{\hyperlink{mlx5__ib__mr_8c_aa6b029c299fb3c59ea3a322307b5971a}{use\_umr\_mtt\_update}}(mr, addr, len)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01165}01165                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01166}01166 \textcolor{comment}{                 * UMR can't be used -\/ MKey needs to be replaced.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01167}01167 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01168}01168                 \textcolor{keywordflow}{if} (mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_affdb4556e3946c5fcf73eb427e269588}{umred}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01169}01169                         err = \mbox{\hyperlink{mlx5__ib__mr_8c_a3dd7e072ea2b5e70f3a6161a3969fb56}{unreg\_umr}}(dev, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01170}01170                         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01171}01171                                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}Failed to unregister MR\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01172}01172                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01173}01173                         err = \mbox{\hyperlink{mlx5__ib__mr_8c_ab6652542d5195ad81a8620d7a62a184d}{destroy\_mkey}}(dev, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01174}01174                         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01175}01175                                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}Failed to destroy MKey\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01176}01176                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01177}01177                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01178}01178                         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01179}01179 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01180}01180                 mr = \mbox{\hyperlink{mlx5__ib__mr_8c_a8310c23f42638dc670640f1c9bee31cd}{reg\_create}}(ib\_mr, pd, addr, len, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}}, ncont,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01181}01181                                 page\_shift, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01182}01182 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01183}01183                 \textcolor{keywordflow}{if} (IS\_ERR(mr))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01184}01184                         \textcolor{keywordflow}{return} PTR\_ERR(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01185}01185 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01186}01186                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_affdb4556e3946c5fcf73eb427e269588}{umred}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01187}01187         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01188}01188                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01189}01189 \textcolor{comment}{                 * Send a UMR WQE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01190}01190 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01191}01191                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_acb2d0cf68e1634507b01f8261f2722bc}{rereg\_umr}}(pd, mr, addr, len, npages, page\_shift,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01192}01192                                 order, access\_flags, flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01193}01193                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01194}01194                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}Failed to rereg UMR\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01195}01195                         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01196}01196                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01197}01197         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01198}01198 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01199}01199         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_PD) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01200}01200                 ib\_mr-\/>pd = pd;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01201}01201                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_adc1003b7a05604ad94b034f5faba8e95}{pd}} = \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>\mbox{\hyperlink{structmlx5__ib__pd_aa4f481df5c47264ed9e065614a96ddd2}{pdn}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01202}01202         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01203}01203 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01204}01204         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_ACCESS)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01205}01205                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a927fed211cb0dfc229ae99153fb738b8}{access\_flags}} = access\_flags;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01206}01206 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01207}01207         \textcolor{keywordflow}{if} (flags \& IB\_MR\_REREG\_TRANS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01208}01208                 atomic\_sub(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}}, \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_a60f1b470811c4394d7e3085400214d03}{reg\_pages}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01209}01209                 \mbox{\hyperlink{mlx5__ib__mr_8c_a123b8c2b5fd45182289117d6b991c4e9}{set\_mr\_fileds}}(dev, mr, npages, len, access\_flags);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01210}01210                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a1c5bf7e726bc6fd00047dee8706eb27c}{iova}} = addr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01211}01211                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a76bdd58ff2c0cf110e6234be91da9ff4}{size}} = len;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01212}01212         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01213}01213 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01214}01214         update\_odp\_mr(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01215}01215 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01216}01216 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01217}01217         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01218}01218 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01219}01219 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01220}01220 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01221}\mbox{\hyperlink{mlx5__ib__mr_8c_aaf7c86669e5055a9c265757759330686}{01221}} \mbox{\hyperlink{mlx5__ib__mr_8c_aaf7c86669e5055a9c265757759330686}{mlx5\_alloc\_priv\_descs}}(\textcolor{keyword}{struct} ib\_device *device,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01222}01222                       \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01223}01223                       \textcolor{keywordtype}{int} ndescs,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01224}01224                       \textcolor{keywordtype}{int} desc\_size)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01225}01225 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01226}01226         \textcolor{keywordtype}{int} size = ndescs * desc\_size;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01227}01227         \textcolor{keywordtype}{int} add\_size;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01228}01228         \textcolor{keywordtype}{int} ret;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01229}01229 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01230}01230         add\_size = max\_t(\textcolor{keywordtype}{int}, \mbox{\hyperlink{mlx5__ib__mr_8c_add5931494b7184a4abdcc06549462528}{MLX5\_UMR\_ALIGN}} -\/ 1, 0);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01231}01231 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01232}01232         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4eca7b37be7a965046decc2d3f1fe943}{descs\_alloc}} = kzalloc(size + add\_size, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01233}01233         \textcolor{keywordflow}{if} (!mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4eca7b37be7a965046decc2d3f1fe943}{descs\_alloc}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01234}01234                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01235}01235 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01236}01236         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}} = PTR\_ALIGN(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4eca7b37be7a965046decc2d3f1fe943}{descs\_alloc}}, \mbox{\hyperlink{mlx5__ib__mr_8c_add5931494b7184a4abdcc06549462528}{MLX5\_UMR\_ALIGN}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01237}01237 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01238}01238         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a190945a4dbb0a9335d6d1ee79859adcd}{desc\_map}} = dma\_map\_single(device-\/>dma\_device, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01239}01239                                       size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01240}01240         \textcolor{keywordflow}{if} (dma\_mapping\_error(device-\/>dma\_device, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a190945a4dbb0a9335d6d1ee79859adcd}{desc\_map}})) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01241}01241                 ret = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01242}01242                 \textcolor{keywordflow}{goto} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01243}01243         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01244}01244 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01245}01245         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01246}01246 err:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01247}01247         kfree(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4eca7b37be7a965046decc2d3f1fe943}{descs\_alloc}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01248}01248 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01249}01249         \textcolor{keywordflow}{return} ret;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01250}01250 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01251}01251 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01252}01252 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01253}\mbox{\hyperlink{mlx5__ib__mr_8c_a8cd9547158e3b3eab287668d684a58d8}{01253}} \mbox{\hyperlink{mlx5__ib__mr_8c_a8cd9547158e3b3eab287668d684a58d8}{mlx5\_free\_priv\_descs}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01254}01254 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01255}01255         \textcolor{keywordflow}{if} (mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01256}01256                 \textcolor{keyword}{struct }ib\_device *device = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.device;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01257}01257                 \textcolor{keywordtype}{int} size = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}} * mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ae80d7f7ee3e39063c2b0358640ab5bf9}{desc\_size}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01258}01258 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01259}01259                 dma\_unmap\_single(device-\/>dma\_device, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a190945a4dbb0a9335d6d1ee79859adcd}{desc\_map}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01260}01260                                  size, DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01261}01261                 kfree(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4eca7b37be7a965046decc2d3f1fe943}{descs\_alloc}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01262}01262                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}} = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01263}01263         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01264}01264 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01265}01265 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01266}\mbox{\hyperlink{mlx5__ib__mr_8c_a4868a585f618cea1d66243862fcd4747}{01266}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a4868a585f618cea1d66243862fcd4747}{clean\_mr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01267}01267 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01268}01268         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01269}01269         \textcolor{keywordtype}{int} umred = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_affdb4556e3946c5fcf73eb427e269588}{umred}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01270}01270         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01271}01271 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01272}01272         \textcolor{keywordflow}{if} (mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01273}01273                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{driver_8h_aaa1c2d4ee1a79171669b394fbb77f5ce}{mlx5\_core\_destroy\_psv}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01274}01274                                           mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a288769a5576509ad0964eb54cb119f1d}{psv\_memory}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}}))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01275}01275                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}failed to destroy mem psv \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01276}01276                                      mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a288769a5576509ad0964eb54cb119f1d}{psv\_memory}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01277}01277                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{driver_8h_aaa1c2d4ee1a79171669b394fbb77f5ce}{mlx5\_core\_destroy\_psv}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01278}01278                                           mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a8feae58ca1bc8fd37013db76b4eba2a6}{psv\_wire}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}}))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01279}01279                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}failed to destroy wire psv \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01280}01280                                      mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a8feae58ca1bc8fd37013db76b4eba2a6}{psv\_wire}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01281}01281                 kfree(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01282}01282                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}} = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01283}01283         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01284}01284 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01285}01285         \mbox{\hyperlink{mlx5__ib__mr_8c_a8cd9547158e3b3eab287668d684a58d8}{mlx5\_free\_priv\_descs}}(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01286}01286 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01287}01287         \textcolor{keywordflow}{if} (!umred) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01288}01288                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_ab6652542d5195ad81a8620d7a62a184d}{destroy\_mkey}}(dev, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01289}01289                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01290}01290                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}failed to destroy mkey 0x\%x (\%d)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01291}01291                                      mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01292}01292                         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01293}01293                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01294}01294         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01295}01295                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_a3dd7e072ea2b5e70f3a6161a3969fb56}{unreg\_umr}}(dev, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01296}01296                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01297}01297                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}failed unregister\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01298}01298                         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01299}01299                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01300}01300                 \mbox{\hyperlink{mlx5__ib__mr_8c_a0cdef076bcacca8388ffebb47063e136}{free\_cached\_mr}}(dev, mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01301}01301         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01302}01302 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01303}01303         \textcolor{keywordflow}{if} (!umred)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01304}01304                 kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01305}01305 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01306}01306         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01307}01307 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01308}01308 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01309}\mbox{\hyperlink{mlx5__ib_8h_abde81e061625b41c3703b44e6563b235}{01309}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_abde81e061625b41c3703b44e6563b235}{mlx5\_ib\_dereg\_mr}}(\textcolor{keyword}{struct} ib\_mr *ibmr, \textcolor{keyword}{struct} ib\_udata *udata)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01310}01310 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01311}01311         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibmr-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01312}01312         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr = \mbox{\hyperlink{mlx5__ib_8h_a0779e0bd8bcdb4f4ef3e2443f472ccb3}{to\_mmr}}(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01313}01313         \textcolor{keywordtype}{int} \mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}} = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a2c3e977397a27898d3f43cf0026b8fc4}{npages}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01314}01314         \textcolor{keyword}{struct }ib\_umem *umem = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01315}01315 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01316}01316 \textcolor{preprocessor}{\#ifdef CONFIG\_INFINIBAND\_ON\_DEMAND\_PAGING}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01317}01317         \textcolor{keywordflow}{if} (umem \&\& umem-\/>odp\_data) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01318}01318                 \textcolor{comment}{/* Prevent new page faults from succeeding */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01319}01319                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a9d9fd628e03d3d8be1f1963c16de6d9d}{live}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01320}01320                 \textcolor{comment}{/* Wait for all running page-\/fault handlers to finish. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01321}01321                 synchronize\_srcu(\&dev-\/>mr\_srcu);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01322}01322                 \textcolor{comment}{/* Destroy all page mappings */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01323}01323                 mlx5\_ib\_invalidate\_range(umem, ib\_umem\_start(umem),}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01324}01324                                          ib\_umem\_end(umem));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01325}01325                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01326}01326 \textcolor{comment}{                 * We kill the umem before the MR for ODP,}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01327}01327 \textcolor{comment}{                 * so that there will not be any invalidations in}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01328}01328 \textcolor{comment}{                 * flight, looking at the *mr struct.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01329}01329 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01330}01330                 ib\_umem\_release(umem);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01331}01331                 atomic\_sub(npages, \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_a60f1b470811c4394d7e3085400214d03}{reg\_pages}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01332}01332 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01333}01333                 \textcolor{comment}{/* Avoid double-\/freeing the umem. */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01334}01334                 umem = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01335}01335         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01336}01336 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01337}01337 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01338}01338         \mbox{\hyperlink{mlx5__ib__mr_8c_a4868a585f618cea1d66243862fcd4747}{clean\_mr}}(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01339}01339 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01340}01340         \textcolor{keywordflow}{if} (umem) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01341}01341                 ib\_umem\_release(umem);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01342}01342                 atomic\_sub(npages, \&dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a2642b287846069d077eec2d44e137703}{priv}}.\mbox{\hyperlink{structmlx5__priv_a60f1b470811c4394d7e3085400214d03}{reg\_pages}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01343}01343         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01344}01344 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01345}01345         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01346}01346 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01347}01347 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01348}\mbox{\hyperlink{mlx5__ib_8h_a3415f33b1aad2c906cde911ca49987f9}{01348}} \textcolor{keyword}{struct }ib\_mr *\mbox{\hyperlink{mlx5__ib__mr_8c_a3415f33b1aad2c906cde911ca49987f9}{mlx5\_ib\_alloc\_mr}}(\textcolor{keyword}{struct} ib\_pd *pd,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01349}01349                                \textcolor{keyword}{enum} ib\_mr\_type mr\_type,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01350}01350                                u32 max\_num\_sg, \textcolor{keyword}{struct} ib\_udata *udata)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01351}01351 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01352}01352         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01353}01353         \textcolor{keywordtype}{int} inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(create\_mkey\_in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01354}01354         \textcolor{keywordtype}{int} ndescs = ALIGN(max\_num\_sg, 4);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01355}01355         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01356}01356         \textcolor{keywordtype}{void} *mkc;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01357}01357         u32 *in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01358}01358         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01359}01359 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01360}01360         mr = kzalloc(\textcolor{keyword}{sizeof}(*mr), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01361}01361         \textcolor{keywordflow}{if} (!mr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01362}01362                 \textcolor{keywordflow}{return} ERR\_PTR(-\/ENOMEM);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01363}01363 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01364}01364         in = kzalloc(inlen, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01365}01365         \textcolor{keywordflow}{if} (!in) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01366}01366                 err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01367}01367                 \textcolor{keywordflow}{goto} err\_free;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01368}01368         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01369}01369 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01370}01370         mkc = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(create\_mkey\_in, in, memory\_key\_mkey\_entry);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01371}01371         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, free, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01372}01372         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, translations\_octword\_size, \mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01373}01373         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, qpn, 0xffffff);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01374}01374         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, pd, \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>pdn);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01375}01375 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01376}01376         \textcolor{keywordflow}{if} (mr\_type == IB\_MR\_TYPE\_MEM\_REG) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01377}01377                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}} = \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5afd47a643b123a67e70880f2c19ea987e}{MLX5\_ACCESS\_MODE\_MTT}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01378}01378                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, log\_page\_size, PAGE\_SHIFT);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01379}01379                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_aaf7c86669e5055a9c265757759330686}{mlx5\_alloc\_priv\_descs}}(pd-\/>device, mr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01380}01380                                             \mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}}, \textcolor{keyword}{sizeof}(u64));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01381}01381                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01382}01382                         \textcolor{keywordflow}{goto} err\_free\_in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01383}01383 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01384}01384                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ae80d7f7ee3e39063c2b0358640ab5bf9}{desc\_size}} = \textcolor{keyword}{sizeof}(u64);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01385}01385                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}} = \mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01386}01386         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (mr\_type == IB\_MR\_TYPE\_SG\_GAPS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01387}01387                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}} = \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5aa8615cdb0e87f52484227e083cc1645d}{MLX5\_ACCESS\_MODE\_KLM}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01388}01388 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01389}01389                 err = \mbox{\hyperlink{mlx5__ib__mr_8c_aaf7c86669e5055a9c265757759330686}{mlx5\_alloc\_priv\_descs}}(pd-\/>device, mr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01390}01390                                             \mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}}, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__klm}{mlx5\_klm}}));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01391}01391                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01392}01392                         \textcolor{keywordflow}{goto} err\_free\_in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01393}01393                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ae80d7f7ee3e39063c2b0358640ab5bf9}{desc\_size}} = \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__klm}{mlx5\_klm}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01394}01394                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}} = ndescs;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01395}01395         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (mr\_type == IB\_MR\_TYPE\_INTEGRITY) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01396}01396                 u32 psv\_index[2];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01397}01397 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01398}01398                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, bsf\_en, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01399}01399                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, bsf\_octword\_size, \mbox{\hyperlink{device_8h_ab04a0655cd1e3bcac5e8f48c18df1a57aa2521b5125252e07320ff4080581f110}{MLX5\_MKEY\_BSF\_OCTO\_SIZE}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01400}01400                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}} = kzalloc(\textcolor{keyword}{sizeof}(*mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01401}01401                 \textcolor{keywordflow}{if} (!mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01402}01402                         err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01403}01403                         \textcolor{keywordflow}{goto} err\_free\_in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01404}01404                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01405}01405 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01406}01406                 \textcolor{comment}{/* create mem \& wire PSVs */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01407}01407                 err = \mbox{\hyperlink{driver_8h_a315988ca574805767c2d9c6e1272f775}{mlx5\_core\_create\_psv}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>pdn,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01408}01408                                            2, psv\_index);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01409}01409                 \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01410}01410                         \textcolor{keywordflow}{goto} err\_free\_sig;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01411}01411 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01412}01412                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}} = \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5aa8615cdb0e87f52484227e083cc1645d}{MLX5\_ACCESS\_MODE\_KLM}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01413}01413                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a288769a5576509ad0964eb54cb119f1d}{psv\_memory}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}} = psv\_index[0];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01414}01414                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a8feae58ca1bc8fd37013db76b4eba2a6}{psv\_wire}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}} = psv\_index[1];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01415}01415 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01416}01416                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a351fff428dca545ea79f69a2b4b98823}{sig\_status\_checked}} = \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01417}01417                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_aa0cdbd324783a4e03eaec85b30a5ddce}{sig\_err\_exists}} = \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01418}01418                 \textcolor{comment}{/* Next UMR, Arm SIGERR */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01419}01419                 ++mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_af3dc4572d5c58807e736407af6c2a461}{sigerr\_count}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01420}01420         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01421}01421                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}Invalid mr type \%d\(\backslash\)n"{}}, mr\_type);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01422}01422                 err = -\/EINVAL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01423}01423                 \textcolor{keywordflow}{goto} err\_free\_in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01424}01424         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01425}01425 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01426}01426         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, access\_mode, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01427}01427         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, umr\_en, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01428}01428 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01429}01429         err = \mbox{\hyperlink{driver_8h_aa55afac86fb98fe1a074177838e412bf}{mlx5\_core\_create\_mkey}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}, in, inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01430}01430         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01431}01431                 \textcolor{keywordflow}{goto} err\_destroy\_psv;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01432}01432 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01433}01433         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.lkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01434}01434         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.rkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a5d3e8f490c309f3422001bb5751b5360}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01435}01435         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aaa0ecdabf3c4421ea9b1080c13b61163}{umem}} = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01436}01436         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01437}01437 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01438}01438         \textcolor{keywordflow}{return} \&mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01439}01439 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01440}01440 err\_destroy\_psv:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01441}01441         \textcolor{keywordflow}{if} (mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01442}01442                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{driver_8h_aaa1c2d4ee1a79171669b394fbb77f5ce}{mlx5\_core\_destroy\_psv}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01443}01443                                           mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a288769a5576509ad0964eb54cb119f1d}{psv\_memory}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}}))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01444}01444                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}failed to destroy mem psv \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01445}01445                                      mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a288769a5576509ad0964eb54cb119f1d}{psv\_memory}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01446}01446                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{driver_8h_aaa1c2d4ee1a79171669b394fbb77f5ce}{mlx5\_core\_destroy\_psv}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01447}01447                                           mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a8feae58ca1bc8fd37013db76b4eba2a6}{psv\_wire}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}}))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01448}01448                         \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}failed to destroy wire psv \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01449}01449                                      mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a8feae58ca1bc8fd37013db76b4eba2a6}{psv\_wire}}.\mbox{\hyperlink{structmlx5__core__psv_a78117d0e8dc0c4a2a2c02ed7c5abfdd9}{psv\_idx}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01450}01450         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01451}01451         \mbox{\hyperlink{mlx5__ib__mr_8c_a8cd9547158e3b3eab287668d684a58d8}{mlx5\_free\_priv\_descs}}(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01452}01452 err\_free\_sig:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01453}01453         kfree(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01454}01454 err\_free\_in:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01455}01455         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01456}01456 err\_free:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01457}01457         kfree(mr);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01458}01458         \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01459}01459 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01460}01460 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01461}\mbox{\hyperlink{mlx5__ib_8h_a2d7c68603f4d205ea09025408313264e}{01461}} \textcolor{keyword}{struct }ib\_mw *\mbox{\hyperlink{mlx5__ib__mr_8c_a2d7c68603f4d205ea09025408313264e}{mlx5\_ib\_alloc\_mw}}(\textcolor{keyword}{struct} ib\_pd *pd, \textcolor{keyword}{enum} ib\_mw\_type type,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01462}01462                                \textcolor{keyword}{struct} ib\_udata *udata)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01463}01463 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01464}01464         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(pd-\/>device);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01465}01465         \textcolor{keywordtype}{int} inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(create\_mkey\_in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01466}01466         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mw}{mlx5\_ib\_mw}} *mw = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01467}01467         u32 *in = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01468}01468         \textcolor{keywordtype}{void} *mkc;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01469}01469         \textcolor{keywordtype}{int} ndescs;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01470}01470         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01471}01471         \textcolor{keyword}{struct }\mbox{\hyperlink{mlx5__ib__mr_8c_a2d7c68603f4d205ea09025408313264e}{mlx5\_ib\_alloc\_mw}} req = \{\};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01472}01472         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01473}01473                 \_\_u32   comp\_mask;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01474}01474                 \_\_u32   response\_length;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01475}01475         \} resp = \{\};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01476}01476 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01477}01477         err = ib\_copy\_from\_udata(\&req, udata, min(udata-\/>inlen, \textcolor{keyword}{sizeof}(req)));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01478}01478         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01479}01479                 \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01480}01480 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01481}01481         \textcolor{keywordflow}{if} (req.comp\_mask || req.reserved1 || req.reserved2)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01482}01482                 \textcolor{keywordflow}{return} ERR\_PTR(-\/EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01483}01483 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01484}01484         \textcolor{keywordflow}{if} (udata-\/>inlen > \textcolor{keyword}{sizeof}(req) \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01485}01485             !ib\_is\_udata\_cleared(udata, \textcolor{keyword}{sizeof}(req),}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01486}01486                                  udata-\/>inlen -\/ \textcolor{keyword}{sizeof}(req)))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01487}01487                 \textcolor{keywordflow}{return} ERR\_PTR(-\/EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01488}01488 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01489}01489         ndescs = req.num\_klms ? roundup(req.num\_klms, 4) : roundup(1, 4);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01490}01490 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01491}01491         mw = kzalloc(\textcolor{keyword}{sizeof}(*mw), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01492}01492         in = kzalloc(inlen, GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01493}01493         \textcolor{keywordflow}{if} (!mw || !in) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01494}01494                 err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01495}01495                 \textcolor{keywordflow}{goto} free;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01496}01496         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01497}01497 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01498}01498         mkc = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(create\_mkey\_in, in, memory\_key\_mkey\_entry);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01499}01499 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01500}01500         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, free, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01501}01501         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, translations\_octword\_size, ndescs);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01502}01502         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, pd, \mbox{\hyperlink{mlx5__ib_8h_a0f8c8cb96d93978c0ba31c33963569c8}{to\_mpd}}(pd)-\/>pdn);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01503}01503         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, umr\_en, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01504}01504         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, lr, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01505}01505         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, access\_mode, \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5aa8615cdb0e87f52484227e083cc1645d}{MLX5\_ACCESS\_MODE\_KLM}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01506}01506         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, en\_rinval, !!((type == IB\_MW\_TYPE\_2)));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01507}01507         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mkc, mkc, qpn, 0xffffff);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01508}01508 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01509}01509         err = \mbox{\hyperlink{driver_8h_aa55afac86fb98fe1a074177838e412bf}{mlx5\_core\_create\_mkey}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&mw-\/>\mbox{\hyperlink{structmlx5__ib__mw_ad519c9f21b63878d8b1298caa50755fb}{mmkey}}, in, inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01510}01510         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01511}01511                 \textcolor{keywordflow}{goto} free;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01512}01512 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01513}01513         mw-\/>\mbox{\hyperlink{structmlx5__ib__mw_ac3301987551eb766d76cdff5ec2cee58}{ibmw}}.rkey = mw-\/>\mbox{\hyperlink{structmlx5__ib__mw_ad519c9f21b63878d8b1298caa50755fb}{mmkey}}.\mbox{\hyperlink{structmlx5__core__mkey_a35815af7a03d7540ee9fa07fcb74548c}{key}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01514}01514 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01515}01515         resp.response\_length = min(offsetof(typeof(resp), response\_length) +}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01516}01516                                    \textcolor{keyword}{sizeof}(resp.response\_length), udata-\/>outlen);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01517}01517         \textcolor{keywordflow}{if} (resp.response\_length) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01518}01518                 err = ib\_copy\_to\_udata(udata, \&resp, resp.response\_length);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01519}01519                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01520}01520                         \mbox{\hyperlink{driver_8h_a1bb1877ebc3a53b0563d915e4a061178}{mlx5\_core\_destroy\_mkey}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, \&mw-\/>\mbox{\hyperlink{structmlx5__ib__mw_ad519c9f21b63878d8b1298caa50755fb}{mmkey}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01521}01521                         \textcolor{keywordflow}{goto} free;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01522}01522                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01523}01523         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01524}01524 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01525}01525         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01526}01526         \textcolor{keywordflow}{return} \&mw-\/>\mbox{\hyperlink{structmlx5__ib__mw_ac3301987551eb766d76cdff5ec2cee58}{ibmw}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01527}01527 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01528}01528 free:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01529}01529         kfree(mw);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01530}01530         kfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01531}01531         \textcolor{keywordflow}{return} ERR\_PTR(err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01532}01532 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01533}01533 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01534}\mbox{\hyperlink{mlx5__ib_8h_a9cdab064fd8e1b6dab237ddd7bcc1455}{01534}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_a9cdab064fd8e1b6dab237ddd7bcc1455}{mlx5\_ib\_dealloc\_mw}}(\textcolor{keyword}{struct} ib\_mw *mw)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01535}01535 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01536}01536         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mw}{mlx5\_ib\_mw}} *mmw = \mbox{\hyperlink{mlx5__ib_8h_a28f06c3a7eb0dfbf3607c96ddabf7618}{to\_mmw}}(mw);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01537}01537         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01538}01538 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01539}01539         err =  \mbox{\hyperlink{driver_8h_a1bb1877ebc3a53b0563d915e4a061178}{mlx5\_core\_destroy\_mkey}}((\mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(mw-\/>device))-\/>mdev,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01540}01540                                       \&mmw-\/>\mbox{\hyperlink{structmlx5__ib__mw_ad519c9f21b63878d8b1298caa50755fb}{mmkey}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01541}01541         \textcolor{keywordflow}{if} (!err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01542}01542                 kfree(mmw);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01543}01543         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01544}01544 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01545}01545 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01546}\mbox{\hyperlink{mlx5__ib_8h_ae9feacf78f7f18e27ae2a728ffb6e3eb}{01546}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_ae9feacf78f7f18e27ae2a728ffb6e3eb}{mlx5\_ib\_check\_mr\_status}}(\textcolor{keyword}{struct} ib\_mr *ibmr, u32 check\_mask,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01547}01547                             \textcolor{keyword}{struct} ib\_mr\_status *mr\_status)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01548}01548 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01549}01549         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mmr = \mbox{\hyperlink{mlx5__ib_8h_a0779e0bd8bcdb4f4ef3e2443f472ccb3}{to\_mmr}}(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01550}01550         \textcolor{keywordtype}{int} ret = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01551}01551 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01552}01552         \textcolor{keywordflow}{if} (check\_mask \& \string~IB\_MR\_CHECK\_SIG\_STATUS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01553}01553                 pr\_err(\textcolor{stringliteral}{"{}Invalid status check mask\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01554}01554                 ret = -\/EINVAL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01555}01555                 \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01556}01556         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01557}01557 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01558}01558         mr\_status-\/>fail\_status = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01559}01559         \textcolor{keywordflow}{if} (check\_mask \& IB\_MR\_CHECK\_SIG\_STATUS) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01560}01560                 \textcolor{keywordflow}{if} (!mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01561}01561                         ret = -\/EINVAL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01562}01562                         pr\_err(\textcolor{stringliteral}{"{}signature status check requested on a non-\/signature enabled MR\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01563}01563                         \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01564}01564                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01565}01565 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01566}01566                 mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_a351fff428dca545ea79f69a2b4b98823}{sig\_status\_checked}} = \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01567}01567                 \textcolor{keywordflow}{if} (!mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_aa0cdbd324783a4e03eaec85b30a5ddce}{sig\_err\_exists}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01568}01568                         \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01569}01569 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01570}01570                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}-\/>lkey == mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_af81ab56d8e51c03c295054a1f272eadf}{err\_item}}.key)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01571}01571                         memcpy(\&mr\_status-\/>sig\_err, \&mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_af81ab56d8e51c03c295054a1f272eadf}{err\_item}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01572}01572                                \textcolor{keyword}{sizeof}(mr\_status-\/>sig\_err));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01573}01573                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01574}01574                         mr\_status-\/>sig\_err.err\_type = IB\_SIG\_BAD\_GUARD;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01575}01575                         mr\_status-\/>sig\_err.sig\_err\_offset = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01576}01576                         mr\_status-\/>sig\_err.key = mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_af81ab56d8e51c03c295054a1f272eadf}{err\_item}}.key;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01577}01577                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01578}01578 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01579}01579                 mmr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aef14dd5d1c3128819d5d270bedfce0ff}{sig}}-\/>\mbox{\hyperlink{structmlx5__core__sig__ctx_aa0cdbd324783a4e03eaec85b30a5ddce}{sig\_err\_exists}} = \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01580}01580                 mr\_status-\/>fail\_status |= IB\_MR\_CHECK\_SIG\_STATUS;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01581}01581         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01582}01582 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01583}01583 done:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01584}01584         \textcolor{keywordflow}{return} ret;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01585}01585 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01586}01586 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01587}01587 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01588}\mbox{\hyperlink{mlx5__ib__mr_8c_a71b1a901a4b690372ff3c4c0f0b36efe}{01588}} \mbox{\hyperlink{mlx5__ib__mr_8c_a71b1a901a4b690372ff3c4c0f0b36efe}{mlx5\_ib\_sg\_to\_klms}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01589}01589                    \textcolor{keyword}{struct} scatterlist *sgl,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01590}01590                    \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{short} sg\_nents,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01591}01591                    \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} *sg\_offset\_p)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01592}01592 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01593}01593         \textcolor{keyword}{struct }scatterlist *sg = sgl;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01594}01594         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__klm}{mlx5\_klm}} *klms = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01595}01595         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} sg\_offset = sg\_offset\_p ? *sg\_offset\_p : 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01596}01596         u32 lkey = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.pd-\/>local\_dma\_lkey;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01597}01597         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01598}01598 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01599}01599         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.iova = sg\_dma\_address(sg) + sg\_offset;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01600}01600         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.length = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01601}01601         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}} = sg\_nents;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01602}01602 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01603}01603         for\_each\_sg(sgl, sg, sg\_nents, i) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01604}01604                 \textcolor{keywordflow}{if} (unlikely(i > mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}}))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01605}01605                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01606}01606                 klms[i].\mbox{\hyperlink{structmlx5__klm_a06a637526cbf3d5616e68c96f87a48e1}{va}} = cpu\_to\_be64(sg\_dma\_address(sg) + sg\_offset);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01607}01607                 klms[i].\mbox{\hyperlink{structmlx5__klm_a65fcd6a9d5a33948d6b1f7bc8b228a1f}{bcount}} = cpu\_to\_be32(sg\_dma\_len(sg) -\/ sg\_offset);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01608}01608                 klms[i].\mbox{\hyperlink{structmlx5__klm_a2c236d7b24153921e2c1b507e7bc375c}{key}} = cpu\_to\_be32(lkey);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01609}01609                 mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}.length += sg\_dma\_len(sg);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01610}01610 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01611}01611                 sg\_offset = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01612}01612         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01613}01613 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01614}01614         \textcolor{keywordflow}{if} (sg\_offset\_p)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01615}01615                 *sg\_offset\_p = sg\_offset;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01616}01616 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01617}01617         \textcolor{keywordflow}{return} i;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01618}01618 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01619}01619 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01620}\mbox{\hyperlink{mlx5__ib__mr_8c_af6d576a87c8570903bb9a420b48a99f6}{01620}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_af6d576a87c8570903bb9a420b48a99f6}{mlx5\_set\_page}}(\textcolor{keyword}{struct} ib\_mr *ibmr, u64 addr)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01621}01621 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01622}01622         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr = \mbox{\hyperlink{mlx5__ib_8h_a0779e0bd8bcdb4f4ef3e2443f472ccb3}{to\_mmr}}(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01623}01623         \_\_be64 *\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01624}01624 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01625}01625         \textcolor{keywordflow}{if} (unlikely(mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}} == mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}}))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01626}01626                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01627}01627 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01628}01628         \mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}} = mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01629}01629         \mbox{\hyperlink{structmlx5__ib__mr_aa9cb4cc734c196d235ab01abd9be7a65}{descs}}[mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}}++] = cpu\_to\_be64(addr | \mbox{\hyperlink{device_8h_adb49720dc49f7d4e4cf9adbf2948e409ae5a803ab12ff642b6b3db9e66a29f0e0}{MLX5\_EN\_RD}} | \mbox{\hyperlink{device_8h_adb49720dc49f7d4e4cf9adbf2948e409a069279faac9081fc6d7725adf65b2210}{MLX5\_EN\_WR}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01630}01630 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01631}01631         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01632}01632 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01633}01633 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01634}\mbox{\hyperlink{mlx5__ib_8h_af31eb37d1dca282fe33d5de8cf296945}{01634}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mr_8c_af31eb37d1dca282fe33d5de8cf296945}{mlx5\_ib\_map\_mr\_sg}}(\textcolor{keyword}{struct} ib\_mr *\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}, \textcolor{keyword}{struct} scatterlist *sg, \textcolor{keywordtype}{int} sg\_nents,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01635}01635                       \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} *sg\_offset)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01636}01636 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01637}01637         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__mr}{mlx5\_ib\_mr}} *mr = \mbox{\hyperlink{mlx5__ib_8h_a0779e0bd8bcdb4f4ef3e2443f472ccb3}{to\_mmr}}(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01638}01638         \textcolor{keywordtype}{int} n;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01639}01639 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01640}01640         mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ade44adbdf8610c0755553b078249eb44}{ndescs}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01641}01641 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01642}01642         ib\_dma\_sync\_single\_for\_cpu(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}-\/>device, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a190945a4dbb0a9335d6d1ee79859adcd}{desc\_map}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01643}01643                                    mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ae80d7f7ee3e39063c2b0358640ab5bf9}{desc\_size}} * mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01644}01644                                    DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01645}01645 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01646}01646         \textcolor{keywordflow}{if} (mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a4a5c67d7859039792c4675c74805e239}{access\_mode}} == \mbox{\hyperlink{mlx5__ifc_8h_a82f2c6e4d47f62f6b65c5887eb096fd5aa8615cdb0e87f52484227e083cc1645d}{MLX5\_ACCESS\_MODE\_KLM}})}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01647}01647                 n = \mbox{\hyperlink{mlx5__ib__mr_8c_a71b1a901a4b690372ff3c4c0f0b36efe}{mlx5\_ib\_sg\_to\_klms}}(mr, sg, sg\_nents, sg\_offset);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01648}01648         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01649}01649                 n = ib\_sg\_to\_pages(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}, sg, sg\_nents, sg\_offset,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01650}01650                                 \mbox{\hyperlink{mlx5__ib__mr_8c_af6d576a87c8570903bb9a420b48a99f6}{mlx5\_set\_page}});}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01651}01651 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01652}01652         ib\_dma\_sync\_single\_for\_device(\mbox{\hyperlink{structmlx5__ib__mr_a55497114e4027fc7eda052fdabcd5454}{ibmr}}-\/>device, mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a190945a4dbb0a9335d6d1ee79859adcd}{desc\_map}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01653}01653                                       mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_ae80d7f7ee3e39063c2b0358640ab5bf9}{desc\_size}} * mr-\/>\mbox{\hyperlink{structmlx5__ib__mr_a8c8bb889386b835f8b54f3ab90c09c09}{max\_descs}},}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01654}01654                                       DMA\_TO\_DEVICE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01655}01655 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01656}01656         \textcolor{keywordflow}{return} n;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mr_8c_source_l01657}01657 \}}

\end{DoxyCode}
