174
175 /* tunable, set to 1 to not allow link-local address */
176 int ibcm_ip6_linklocal_addr_ok = 0;
177
178 struct ibcm_path_cache_stat_s {
179 int hits;
180 int misses;
181 int adds;
182 int already_in_cache;
183 int bad_path_for_cache;
184 int purges;
185 int timeouts;
186 } ibcm_path_cache_stats;
187
188 /*ARGSUSED*/
189 static void
190 ibcm_path_cache_timeout_cb(void *arg)
191 {
192 clock_t timeout_in_hz;
193
194 timeout_in_hz = drv_usectohz(ibcm_path_cache_timeout * 1000000);
195 mutex_enter(&ibcm_path_cache_mutex);
196 ibcm_path_cache_invalidate = 1; /* invalidate cache on next check */
197 if (ibcm_path_cache_timeout_id)
198 ibcm_path_cache_timeout_id = timeout(ibcm_path_cache_timeout_cb,
199 NULL, timeout_in_hz);
200 /* else we're in _fini */
201 mutex_exit(&ibcm_path_cache_mutex);
202 }
203
204 void
205 ibcm_path_cache_init(void)
206 {
207 clock_t timeout_in_hz;
208 int cache_size = ibcm_path_cache_size_init;
209 ibcm_path_cache_t *path_cachep;
210
211 timeout_in_hz = drv_usectohz(ibcm_path_cache_timeout * 1000000);
212 path_cachep = kmem_zalloc(cache_size * sizeof (*path_cachep), KM_SLEEP);
213 mutex_init(&ibcm_path_cache_mutex, NULL, MUTEX_DEFAULT, NULL);
214 mutex_enter(&ibcm_path_cache_mutex);
215 ibcm_path_cache_size = cache_size;
216 ibcm_path_cachep = path_cachep;
217 ibcm_path_cache_timeout_id = timeout(ibcm_path_cache_timeout_cb,
218 NULL, timeout_in_hz);
219 mutex_exit(&ibcm_path_cache_mutex);
220 }
221
222 void
223 ibcm_path_cache_fini(void)
224 {
225 timeout_id_t tmp_timeout_id;
226 int cache_size;
227 ibcm_path_cache_t *path_cachep;
228
229 mutex_enter(&ibcm_path_cache_mutex);
230 if (ibcm_path_cache_timeout_id) {
231 tmp_timeout_id = ibcm_path_cache_timeout_id;
|
174
175 /* tunable, set to 1 to not allow link-local address */
176 int ibcm_ip6_linklocal_addr_ok = 0;
177
178 struct ibcm_path_cache_stat_s {
179 int hits;
180 int misses;
181 int adds;
182 int already_in_cache;
183 int bad_path_for_cache;
184 int purges;
185 int timeouts;
186 } ibcm_path_cache_stats;
187
188 /*ARGSUSED*/
189 static void
190 ibcm_path_cache_timeout_cb(void *arg)
191 {
192 clock_t timeout_in_hz;
193
194 timeout_in_hz = drv_sectohz(ibcm_path_cache_timeout);
195 mutex_enter(&ibcm_path_cache_mutex);
196 ibcm_path_cache_invalidate = 1; /* invalidate cache on next check */
197 if (ibcm_path_cache_timeout_id)
198 ibcm_path_cache_timeout_id = timeout(ibcm_path_cache_timeout_cb,
199 NULL, timeout_in_hz);
200 /* else we're in _fini */
201 mutex_exit(&ibcm_path_cache_mutex);
202 }
203
204 void
205 ibcm_path_cache_init(void)
206 {
207 clock_t timeout_in_hz;
208 int cache_size = ibcm_path_cache_size_init;
209 ibcm_path_cache_t *path_cachep;
210
211 timeout_in_hz = drv_sectohz(ibcm_path_cache_timeout);
212 path_cachep = kmem_zalloc(cache_size * sizeof (*path_cachep), KM_SLEEP);
213 mutex_init(&ibcm_path_cache_mutex, NULL, MUTEX_DEFAULT, NULL);
214 mutex_enter(&ibcm_path_cache_mutex);
215 ibcm_path_cache_size = cache_size;
216 ibcm_path_cachep = path_cachep;
217 ibcm_path_cache_timeout_id = timeout(ibcm_path_cache_timeout_cb,
218 NULL, timeout_in_hz);
219 mutex_exit(&ibcm_path_cache_mutex);
220 }
221
222 void
223 ibcm_path_cache_fini(void)
224 {
225 timeout_id_t tmp_timeout_id;
226 int cache_size;
227 ibcm_path_cache_t *path_cachep;
228
229 mutex_enter(&ibcm_path_cache_mutex);
230 if (ibcm_path_cache_timeout_id) {
231 tmp_timeout_id = ibcm_path_cache_timeout_id;
|