usr/src/uts/common/io/dld/dld_str.c
changeset 12748 40c62600acd3
parent 11021 c5323cd5fa92
child 12816 2ad74dc35297
equal deleted inserted replaced
12747:7e3cc6e624d4 12748:40c62600acd3
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 /*
    21 /*
    22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    23  * Use is subject to license terms.
       
    24  */
    23  */
    25 
    24 
    26 /*
    25 /*
    27  * Data-Link Driver
    26  * Data-Link Driver
    28  */
    27  */
    36 #include	<sys/cpuvar.h>
    35 #include	<sys/cpuvar.h>
    37 #include	<sys/callb.h>
    36 #include	<sys/callb.h>
    38 #include	<sys/list.h>
    37 #include	<sys/list.h>
    39 #include	<sys/mac_client.h>
    38 #include	<sys/mac_client.h>
    40 #include	<sys/mac_client_priv.h>
    39 #include	<sys/mac_client_priv.h>
       
    40 #include	<sys/mac_flow.h>
    41 
    41 
    42 static int	str_constructor(void *, void *, int);
    42 static int	str_constructor(void *, void *, int);
    43 static void	str_destructor(void *, void *);
    43 static void	str_destructor(void *, void *);
    44 static mblk_t	*str_unitdata_ind(dld_str_t *, mblk_t *, boolean_t);
    44 static mblk_t	*str_unitdata_ind(dld_str_t *, mblk_t *, boolean_t);
    45 static void	str_notify_promisc_on_phys(dld_str_t *);
    45 static void	str_notify_promisc_on_phys(dld_str_t *);
  1717 	dlip->dl_notification = DL_NOTE_FASTPATH_FLUSH;
  1717 	dlip->dl_notification = DL_NOTE_FASTPATH_FLUSH;
  1718 
  1718 
  1719 	qreply(dsp->ds_wq, mp);
  1719 	qreply(dsp->ds_wq, mp);
  1720 }
  1720 }
  1721 
  1721 
       
  1722 static void
       
  1723 str_notify_allowed_ips(dld_str_t *dsp)
       
  1724 {
       
  1725 	mblk_t		*mp;
       
  1726 	dl_notify_ind_t	*dlip;
       
  1727 	size_t		mp_size;
       
  1728 	mac_protect_t	mrp;
       
  1729 
       
  1730 	if (!(dsp->ds_notifications & DL_NOTE_ALLOWED_IPS))
       
  1731 		return;
       
  1732 
       
  1733 	mp_size = sizeof (mac_protect_t) + sizeof (dl_notify_ind_t);
       
  1734 	if ((mp = mexchange(dsp->ds_wq, NULL, mp_size, M_PROTO, 0)) == NULL)
       
  1735 		return;
       
  1736 
       
  1737 	mac_protect_get(dsp->ds_mh, &mrp);
       
  1738 	bzero(mp->b_rptr, mp_size);
       
  1739 	dlip = (dl_notify_ind_t *)mp->b_rptr;
       
  1740 	dlip->dl_primitive = DL_NOTIFY_IND;
       
  1741 	dlip->dl_notification = DL_NOTE_ALLOWED_IPS;
       
  1742 	dlip->dl_data = 0;
       
  1743 	dlip->dl_addr_offset = sizeof (dl_notify_ind_t);
       
  1744 	dlip->dl_addr_length = sizeof (mac_protect_t);
       
  1745 	bcopy(&mrp, mp->b_rptr + sizeof (dl_notify_ind_t),
       
  1746 	    sizeof (mac_protect_t));
       
  1747 
       
  1748 	qreply(dsp->ds_wq, mp);
       
  1749 }
       
  1750 
  1722 /*
  1751 /*
  1723  * MAC notification callback.
  1752  * MAC notification callback.
  1724  */
  1753  */
  1725 void
  1754 void
  1726 str_notify(void *arg, mac_notify_type_t type)
  1755 str_notify(void *arg, mac_notify_type_t type)
  1845 		str_notify_fastpath_flush(dsp);
  1874 		str_notify_fastpath_flush(dsp);
  1846 		break;
  1875 		break;
  1847 
  1876 
  1848 	/* Unused notifications */
  1877 	/* Unused notifications */
  1849 	case MAC_NOTE_MARGIN:
  1878 	case MAC_NOTE_MARGIN:
       
  1879 		break;
       
  1880 
       
  1881 	case MAC_NOTE_ALLOWED_IPS:
       
  1882 		str_notify_allowed_ips(dsp);
  1850 		break;
  1883 		break;
  1851 
  1884 
  1852 	default:
  1885 	default:
  1853 		ASSERT(B_FALSE);
  1886 		ASSERT(B_FALSE);
  1854 		break;
  1887 		break;