Print this page
dccp: getting kernel segfaults, back out recent added features


 243         dccps->dccps_propinfo_tbl = kmem_alloc(arrsz, KM_SLEEP);
 244         if (dccps->dccps_propinfo_tbl == NULL) {
 245                 kmem_free(dccps, sizeof (*dccps));
 246                 return (NULL);
 247         }
 248         bcopy(dccp_propinfo_tbl, dccps->dccps_propinfo_tbl, arrsz);
 249 
 250         /* Allocate per netstack cpu stats */
 251         mutex_enter(&cpu_lock);
 252         dccps->dccps_sc_cnt = MAX(ncpus, boot_ncpus);
 253         mutex_exit(&cpu_lock);
 254 
 255         dccps->dccps_sc = kmem_zalloc(max_ncpus * sizeof (dccp_stats_cpu_t *),
 256             KM_SLEEP);
 257         for (i = 0; i < dccps->dccps_sc_cnt; i++) {
 258                 dccps->dccps_sc[i] = kmem_zalloc(sizeof (dccp_stats_cpu_t),
 259                     KM_SLEEP);
 260         }
 261 
 262         /* Kernel statistics */
 263         dccps->dccps_kstat = dccp_kstat2_init(stackid);
 264         dccps->dccps_mibkp = dccp_kstat_init(stackid);
 265 
 266         /* Driver major number */
 267         major = mod_name_to_major(INET_NAME);
 268         error = ldi_ident_from_major(major, &dccps->dccps_ldi_ident);
 269         ASSERT(error == 0);
 270 
 271         return (dccps);
 272 }
 273 
 274 /*
 275  * Destroy this DCCP netstack instance.
 276  */
 277 static void
 278 dccp_stack_fini(netstackid_t stackid, void *arg)
 279 {
 280         dccp_stack_t    *dccps = (dccp_stack_t *)arg;
 281         int             i;
 282 
 283         /* Free cpu stats */
 284         for (i = 0; i < dccps->dccps_sc_cnt; i++) {


 286         }
 287         kmem_free(dccps->dccps_sc, max_ncpus * sizeof (dccp_stats_cpu_t *));
 288 
 289         /* Free tunable properties */
 290         kmem_free(dccps->dccps_propinfo_tbl,
 291             dccp_propinfo_count * sizeof (mod_prop_info_t));
 292         dccps->dccps_propinfo_tbl = NULL;
 293 
 294         /* Free bind fanout */
 295         for (i = 0; i < dccps->dccps_bind_fanout_size; i++) {
 296                 ASSERT(dccps->dccps_bind_fanout[i].df_dccp == NULL);
 297                 mutex_destroy(&dccps->dccps_bind_fanout[i].df_lock);
 298         }
 299         kmem_free(dccps->dccps_bind_fanout, dccps->dccps_bind_fanout_size *
 300             sizeof (dccp_df_t));
 301         dccps->dccps_bind_fanout = NULL;
 302 
 303         /* Kernel statistics */
 304         dccp_kstat_fini(stackid, dccps->dccps_mibkp);
 305         dccps->dccps_mibkp = NULL;


 306 
 307         ldi_ident_release(dccps->dccps_ldi_ident);
 308 
 309         kmem_free(dccps, sizeof (*dccps));
 310 }
 311 
 312 /* /dev/dccp */
 313 static int
 314 dccp_openv4(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
 315 {
 316         cmn_err(CE_NOTE, "dccp.c: dccp_openv4\n");
 317 
 318         return (dccp_open(q, devp, flag, sflag, credp, B_FALSE));
 319 }
 320 
 321 /* /dev/dccp6 */
 322 static int
 323 dccp_openv6(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
 324 {
 325         cmn_err(CE_NOTE, "dccp.c: dccp_openv6\n");




 243         dccps->dccps_propinfo_tbl = kmem_alloc(arrsz, KM_SLEEP);
 244         if (dccps->dccps_propinfo_tbl == NULL) {
 245                 kmem_free(dccps, sizeof (*dccps));
 246                 return (NULL);
 247         }
 248         bcopy(dccp_propinfo_tbl, dccps->dccps_propinfo_tbl, arrsz);
 249 
 250         /* Allocate per netstack cpu stats */
 251         mutex_enter(&cpu_lock);
 252         dccps->dccps_sc_cnt = MAX(ncpus, boot_ncpus);
 253         mutex_exit(&cpu_lock);
 254 
 255         dccps->dccps_sc = kmem_zalloc(max_ncpus * sizeof (dccp_stats_cpu_t *),
 256             KM_SLEEP);
 257         for (i = 0; i < dccps->dccps_sc_cnt; i++) {
 258                 dccps->dccps_sc[i] = kmem_zalloc(sizeof (dccp_stats_cpu_t),
 259                     KM_SLEEP);
 260         }
 261 
 262         /* Kernel statistics */
 263         //dccps->dccps_kstat = dccp_kstat2_init(stackid);
 264         //dccps->dccps_mibkp = dccp_kstat_init(stackid);
 265 
 266         /* Driver major number */
 267         major = mod_name_to_major(INET_NAME);
 268         error = ldi_ident_from_major(major, &dccps->dccps_ldi_ident);
 269         ASSERT(error == 0);
 270 
 271         return (dccps);
 272 }
 273 
 274 /*
 275  * Destroy this DCCP netstack instance.
 276  */
 277 static void
 278 dccp_stack_fini(netstackid_t stackid, void *arg)
 279 {
 280         dccp_stack_t    *dccps = (dccp_stack_t *)arg;
 281         int             i;
 282 
 283         /* Free cpu stats */
 284         for (i = 0; i < dccps->dccps_sc_cnt; i++) {


 286         }
 287         kmem_free(dccps->dccps_sc, max_ncpus * sizeof (dccp_stats_cpu_t *));
 288 
 289         /* Free tunable properties */
 290         kmem_free(dccps->dccps_propinfo_tbl,
 291             dccp_propinfo_count * sizeof (mod_prop_info_t));
 292         dccps->dccps_propinfo_tbl = NULL;
 293 
 294         /* Free bind fanout */
 295         for (i = 0; i < dccps->dccps_bind_fanout_size; i++) {
 296                 ASSERT(dccps->dccps_bind_fanout[i].df_dccp == NULL);
 297                 mutex_destroy(&dccps->dccps_bind_fanout[i].df_lock);
 298         }
 299         kmem_free(dccps->dccps_bind_fanout, dccps->dccps_bind_fanout_size *
 300             sizeof (dccp_df_t));
 301         dccps->dccps_bind_fanout = NULL;
 302 
 303         /* Kernel statistics */
 304         dccp_kstat_fini(stackid, dccps->dccps_mibkp);
 305         dccps->dccps_mibkp = NULL;
 306         dccp_kstat2_fini(stackid, dccps->dccps_kstat);
 307         dccps->dccps_kstat = NULL;
 308 
 309         ldi_ident_release(dccps->dccps_ldi_ident);
 310 
 311         kmem_free(dccps, sizeof (*dccps));
 312 }
 313 
 314 /* /dev/dccp */
 315 static int
 316 dccp_openv4(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
 317 {
 318         cmn_err(CE_NOTE, "dccp.c: dccp_openv4\n");
 319 
 320         return (dccp_open(q, devp, flag, sflag, credp, B_FALSE));
 321 }
 322 
 323 /* /dev/dccp6 */
 324 static int
 325 dccp_openv6(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
 326 {
 327         cmn_err(CE_NOTE, "dccp.c: dccp_openv6\n");