845 ixa->ixa_conn_id = oldixa->ixa_conn_id;
846 connp->conn_ixa = ixa;
847 return (oldixa);
848 }
849
850 /*
851 * Return a ip_xmit_attr_t to use with a conn_t that is based on but
852 * separate from conn_ixa.
853 *
854 * This "safe" copy has the pointers set to NULL
855 * (since the pointers might be changed by another thread using
856 * conn_ixa). The caller needs to check for NULL pointers to see
857 * if ip_set_destination needs to be called to re-establish the pointers.
858 */
859 ip_xmit_attr_t *
860 conn_get_ixa_exclusive(conn_t *connp)
861 {
862 ip_xmit_attr_t *oldixa;
863 ip_xmit_attr_t *ixa;
864
865 ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP | KM_NORMALPRI);
866 if (ixa == NULL)
867 return (NULL);
868
869 mutex_enter(&connp->conn_lock);
870
871 oldixa = connp->conn_ixa;
872 IXA_REFHOLD(oldixa);
873
874 ixa_safe_copy(oldixa, ixa);
875 mutex_exit(&connp->conn_lock);
876 IXA_REFRELE(oldixa);
877 return (ixa);
878 }
879
880 void
881 ixa_safe_copy(ip_xmit_attr_t *src, ip_xmit_attr_t *ixa)
882 {
883 bcopy(src, ixa, sizeof (*ixa));
884 ixa->ixa_refcnt = 1;
885 /*
|
845 ixa->ixa_conn_id = oldixa->ixa_conn_id;
846 connp->conn_ixa = ixa;
847 return (oldixa);
848 }
849
850 /*
851 * Return a ip_xmit_attr_t to use with a conn_t that is based on but
852 * separate from conn_ixa.
853 *
854 * This "safe" copy has the pointers set to NULL
855 * (since the pointers might be changed by another thread using
856 * conn_ixa). The caller needs to check for NULL pointers to see
857 * if ip_set_destination needs to be called to re-establish the pointers.
858 */
859 ip_xmit_attr_t *
860 conn_get_ixa_exclusive(conn_t *connp)
861 {
862 ip_xmit_attr_t *oldixa;
863 ip_xmit_attr_t *ixa;
864
865 ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP_LAZY);
866 if (ixa == NULL)
867 return (NULL);
868
869 mutex_enter(&connp->conn_lock);
870
871 oldixa = connp->conn_ixa;
872 IXA_REFHOLD(oldixa);
873
874 ixa_safe_copy(oldixa, ixa);
875 mutex_exit(&connp->conn_lock);
876 IXA_REFRELE(oldixa);
877 return (ixa);
878 }
879
880 void
881 ixa_safe_copy(ip_xmit_attr_t *src, ip_xmit_attr_t *ixa)
882 {
883 bcopy(src, ixa, sizeof (*ixa));
884 ixa->ixa_refcnt = 1;
885 /*
|