View | Details | Raw Unified | Return to bug 209475 | Differences between
and this patch

Collapse All | Expand All

(-)pf.c.fni (-5 / +20 lines)
Lines 804-813 Link Here
804
	V_pf_state_key_z = uma_zcreate("pf state keys",
804
	V_pf_state_key_z = uma_zcreate("pf state keys",
805
	    sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL,
805
	    sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL,
806
	    UMA_ALIGN_PTR, 0);
806
	    UMA_ALIGN_PTR, 0);
807
	V_pf_keyhash = malloc(pf_hashsize * sizeof(struct pf_keyhash),
807
	if ((V_pf_keyhash = mallocarray(pf_hashsize, sizeof(struct pf_keyhash),
808
	    M_PFHASH, M_NOWAIT | M_ZERO)) == NULL){
809
	    V_pf_keyhash = mallocarray(PF_HASHSIZ, sizeof(struct pf_keyhash),
808
	    M_PFHASH, M_WAITOK | M_ZERO);
810
	    M_PFHASH, M_WAITOK | M_ZERO);
809
	V_pf_idhash = malloc(pf_hashsize * sizeof(struct pf_idhash),
811
            printf("pf_initialize: invalid states hashtable size(%lu)\n",
812
            pf_hashsize);
813
        }
814
	if ((V_pf_idhash = mallocarray(pf_hashsize, sizeof(struct pf_idhash),
815
	    M_PFHASH, M_NOWAIT | M_ZERO)) == NULL){
816
	    V_pf_idhash = mallocarray(PF_HASHSIZ, sizeof(struct pf_idhash),
810
	    M_PFHASH, M_WAITOK | M_ZERO);
817
	    M_PFHASH, M_WAITOK | M_ZERO);
818
            printf("pf_initialize: invalid states hashtable size(%lu)\n",
819
            pf_hashsize);
820
        }
811
	pf_hashmask = pf_hashsize - 1;
821
	pf_hashmask = pf_hashsize - 1;
812
	for (i = 0, kh = V_pf_keyhash, ih = V_pf_idhash; i <= pf_hashmask;
822
	for (i = 0, kh = V_pf_keyhash, ih = V_pf_idhash; i <= pf_hashmask;
813
	    i++, kh++, ih++) {
823
	    i++, kh++, ih++) {
Lines 822-830 Link Here
822
	V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z;
832
	V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z;
823
	uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT);
833
	uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT);
824
	uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached");
834
	uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached");
825
	V_pf_srchash = malloc(pf_srchashsize * sizeof(struct pf_srchash),
835
	if ((V_pf_srchash = mallocarray(pf_srchashsize, 
826
	  M_PFHASH, M_WAITOK|M_ZERO);
836
            sizeof(struct pf_srchash), M_PFHASH, M_NOWAIT | M_ZERO)) == NULL){
827
	pf_srchashmask = pf_srchashsize - 1;
837
	    V_pf_srchash = mallocarray((PF_HASHSIZ / 4), 
838
            sizeof(struct pf_srchash), M_PFHASH, M_WAITOK | M_ZERO);
839
            printf("pf_initialize: invalid source nodes hashtable size(%lu)\n",
840
            pf_srchashsize);
841
        }
842
        pf_srchashmask = pf_srchashsize - 1;
828
	for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++)
843
	for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++)
829
		mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF);
844
		mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF);
830
845

Return to bug 209475