328 avl_add(&mux->omux_devices, odd);
329 mutex_exit(&mux->omux_lock);
330 }
331
332 void
333 overlay_mux_remove_dev(overlay_mux_t *mux, overlay_dev_t *odd)
334 {
335 mutex_enter(&mux->omux_lock);
336 avl_remove(&mux->omux_devices, odd);
337 mutex_exit(&mux->omux_lock);
338 }
339
340 int
341 overlay_mux_tx(overlay_mux_t *mux, struct msghdr *hdr, mblk_t *mp)
342 {
343 int ret;
344
345 /*
346 * It'd be nice to be able to use MSG_MBLK_QUICKRELE, unfortunately,
347 * that isn't actually supported by UDP at this time.
348 */
349 ret = ksocket_sendmblk(mux->omux_ksock, hdr, 0, &mp, kcred);
350 if (ret != 0)
351 freemsg(mp);
352
353 return (ret);
354 }
|
328 avl_add(&mux->omux_devices, odd);
329 mutex_exit(&mux->omux_lock);
330 }
331
332 void
333 overlay_mux_remove_dev(overlay_mux_t *mux, overlay_dev_t *odd)
334 {
335 mutex_enter(&mux->omux_lock);
336 avl_remove(&mux->omux_devices, odd);
337 mutex_exit(&mux->omux_lock);
338 }
339
340 int
341 overlay_mux_tx(overlay_mux_t *mux, struct msghdr *hdr, mblk_t *mp)
342 {
343 int ret;
344
345 /*
346 * It'd be nice to be able to use MSG_MBLK_QUICKRELE, unfortunately,
347 * that isn't actually supported by UDP at this time.
348 *
349 * Send with MSG_DONTWAIT to indicate clogged UDP sockets upstack.
350 */
351 ret = ksocket_sendmblk(mux->omux_ksock, hdr, MSG_DONTWAIT, &mp, kcred);
352 /*
353 * NOTE: ksocket_sendmblk() may send partial packets downstack,
354 * returning what's not sent in &mp (i.e. mp pre-call might be a
355 * b_cont of mp post-call). We can't hold up this message (it's a
356 * datagram), so we drop, and let the caller cope.
357 */
358 if (ret != 0)
359 freemsg(mp);
360
361 return (ret);
362 }
|