• Home
  • Raw
  • Download

Lines Matching refs:pmc

83 static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *pmc);
87 static int sf_setstate(struct ifmcaddr6 *pmc);
88 static void sf_markstate(struct ifmcaddr6 *pmc);
89 static void ip6_mc_clear_src(struct ifmcaddr6 *pmc);
118 #define for_each_pmc_rcu(np, pmc) \ argument
119 for (pmc = rcu_dereference(np->ipv6_mc_list); \
120 pmc != NULL; \
121 pmc = rcu_dereference(pmc->next))
317 struct ipv6_mc_socklist *pmc; in ip6_mc_source() local
342 for_each_pmc_rcu(inet6, pmc) { in ip6_mc_source()
343 if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface) in ip6_mc_source()
345 if (ipv6_addr_equal(&pmc->addr, group)) in ip6_mc_source()
348 if (!pmc) { /* must have a prior join */ in ip6_mc_source()
353 if (pmc->sflist) { in ip6_mc_source()
354 if (pmc->sfmode != omode) { in ip6_mc_source()
358 } else if (pmc->sfmode != omode) { in ip6_mc_source()
361 ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0); in ip6_mc_source()
362 pmc->sfmode = omode; in ip6_mc_source()
365 write_lock(&pmc->sflock); in ip6_mc_source()
368 psl = pmc->sflist; in ip6_mc_source()
420 pmc->sflist = psl = newpsl; in ip6_mc_source()
437 write_unlock(&pmc->sflock); in ip6_mc_source()
448 struct ipv6_mc_socklist *pmc; in ip6_mc_msfilter() local
479 for_each_pmc_rcu(inet6, pmc) { in ip6_mc_msfilter()
480 if (pmc->ifindex != gsf->gf_interface) in ip6_mc_msfilter()
482 if (ipv6_addr_equal(&pmc->addr, group)) in ip6_mc_msfilter()
485 if (!pmc) { /* must have a prior join */ in ip6_mc_msfilter()
514 write_lock(&pmc->sflock); in ip6_mc_msfilter()
515 psl = pmc->sflist; in ip6_mc_msfilter()
517 (void) ip6_mc_del_src(idev, group, pmc->sfmode, in ip6_mc_msfilter()
521 (void) ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0); in ip6_mc_msfilter()
522 pmc->sflist = newpsl; in ip6_mc_msfilter()
523 pmc->sfmode = gsf->gf_fmode; in ip6_mc_msfilter()
524 write_unlock(&pmc->sflock); in ip6_mc_msfilter()
539 struct ipv6_mc_socklist *pmc; in ip6_mc_msfget() local
564 for_each_pmc_rcu(inet6, pmc) { in ip6_mc_msfget()
565 if (pmc->ifindex != gsf->gf_interface) in ip6_mc_msfget()
567 if (ipv6_addr_equal(group, &pmc->addr)) in ip6_mc_msfget()
570 if (!pmc) /* must have a prior join */ in ip6_mc_msfget()
572 gsf->gf_fmode = pmc->sfmode; in ip6_mc_msfget()
573 psl = pmc->sflist; in ip6_mc_msfget()
710 struct ifmcaddr6 *pmc; in mld_add_delrec() local
718 pmc = kzalloc(sizeof(*pmc), GFP_ATOMIC); in mld_add_delrec()
719 if (!pmc) in mld_add_delrec()
723 spin_lock_init(&pmc->mca_lock); in mld_add_delrec()
724 pmc->idev = im->idev; in mld_add_delrec()
726 pmc->mca_addr = im->mca_addr; in mld_add_delrec()
727 pmc->mca_crcount = idev->mc_qrv; in mld_add_delrec()
728 pmc->mca_sfmode = im->mca_sfmode; in mld_add_delrec()
729 if (pmc->mca_sfmode == MCAST_INCLUDE) { in mld_add_delrec()
732 pmc->mca_tomb = im->mca_tomb; in mld_add_delrec()
733 pmc->mca_sources = im->mca_sources; in mld_add_delrec()
735 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) in mld_add_delrec()
736 psf->sf_crcount = pmc->mca_crcount; in mld_add_delrec()
741 pmc->next = idev->mc_tomb; in mld_add_delrec()
742 idev->mc_tomb = pmc; in mld_add_delrec()
748 struct ifmcaddr6 *pmc, *pmc_prev; in mld_del_delrec() local
753 for (pmc = idev->mc_tomb; pmc; pmc = pmc->next) { in mld_del_delrec()
754 if (ipv6_addr_equal(&pmc->mca_addr, pmca)) in mld_del_delrec()
756 pmc_prev = pmc; in mld_del_delrec()
758 if (pmc) { in mld_del_delrec()
760 pmc_prev->next = pmc->next; in mld_del_delrec()
762 idev->mc_tomb = pmc->next; in mld_del_delrec()
766 if (pmc) { in mld_del_delrec()
767 for (psf = pmc->mca_tomb; psf; psf = psf_next) { in mld_del_delrec()
771 in6_dev_put(pmc->idev); in mld_del_delrec()
772 kfree(pmc); in mld_del_delrec()
778 struct ifmcaddr6 *pmc, *nextpmc; in mld_clear_delrec() local
781 pmc = idev->mc_tomb; in mld_clear_delrec()
785 for (; pmc; pmc = nextpmc) { in mld_clear_delrec()
786 nextpmc = pmc->next; in mld_clear_delrec()
787 ip6_mc_clear_src(pmc); in mld_clear_delrec()
788 in6_dev_put(pmc->idev); in mld_clear_delrec()
789 kfree(pmc); in mld_clear_delrec()
794 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { in mld_clear_delrec()
797 spin_lock_bh(&pmc->mca_lock); in mld_clear_delrec()
798 psf = pmc->mca_tomb; in mld_clear_delrec()
799 pmc->mca_tomb = NULL; in mld_clear_delrec()
800 spin_unlock_bh(&pmc->mca_lock); in mld_clear_delrec()
1070 static bool mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, in mld_xmarksources() argument
1077 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { in mld_xmarksources()
1083 pmc->mca_sfcount[MCAST_EXCLUDE] != in mld_xmarksources()
1092 pmc->mca_flags &= ~MAF_GSQUERY; in mld_xmarksources()
1098 static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, in mld_marksources() argument
1104 if (pmc->mca_sfmode == MCAST_EXCLUDE) in mld_marksources()
1105 return mld_xmarksources(pmc, nsrcs, srcs); in mld_marksources()
1110 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { in mld_marksources()
1122 pmc->mca_flags &= ~MAF_GSQUERY; in mld_marksources()
1125 pmc->mca_flags |= MAF_GSQUERY; in mld_marksources()
1470 static bool is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type, in is_in() argument
1478 if (!((pmc->mca_flags & MAF_GSQUERY) && !psf->sf_gsresp)) { in is_in()
1479 if (pmc->mca_sfmode == MCAST_INCLUDE) in is_in()
1486 return pmc->mca_sfcount[MCAST_EXCLUDE] == in is_in()
1497 if (pmc->mca_sfcount[MCAST_EXCLUDE] == 0 || in is_in()
1500 return pmc->mca_sfcount[MCAST_EXCLUDE] == in is_in()
1505 return (pmc->mca_sfmode == MCAST_INCLUDE) ^ sdeleted; in is_in()
1507 if (pmc->mca_sfmode == MCAST_INCLUDE) in is_in()
1515 mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted) in mld_scount() argument
1520 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { in mld_scount()
1521 if (!is_in(pmc, psf, type, gdeleted, sdeleted)) in mld_scount()
1667 static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) in grec_size() argument
1669 return sizeof(struct mld2_grec) + 16 * mld_scount(pmc,type,gdel,sdel); in grec_size()
1672 static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, in add_grhead() argument
1679 skb = mld_newpack(pmc->idev, mtu); in add_grhead()
1687 pgr->grec_mca = pmc->mca_addr; /* structure copy */ in add_grhead()
1696 static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, in add_grec() argument
1699 struct inet6_dev *idev = pmc->idev; in add_grec()
1707 if (pmc->mca_flags & MAF_NOREPORT) in add_grec()
1721 psf_list = sdeleted ? &pmc->mca_tomb : &pmc->mca_sources; in add_grec()
1731 AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { in add_grec()
1744 if (!is_in(pmc, psf, type, gdeleted, sdeleted)) { in add_grec()
1766 skb = add_grhead(skb, pmc, type, &pgr, mtu); in add_grec()
1794 if (pmc->mca_crcount || isquery || crsend) { in add_grec()
1800 skb = add_grhead(skb, pmc, type, &pgr, mtu); in add_grec()
1807 pmc->mca_flags &= ~MAF_GSQUERY; /* clear query state */ in add_grec()
1811 static void mld_send_report(struct inet6_dev *idev, struct ifmcaddr6 *pmc) in mld_send_report() argument
1817 if (!pmc) { in mld_send_report()
1818 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { in mld_send_report()
1819 if (pmc->mca_flags & MAF_NOREPORT) in mld_send_report()
1821 spin_lock_bh(&pmc->mca_lock); in mld_send_report()
1822 if (pmc->mca_sfcount[MCAST_EXCLUDE]) in mld_send_report()
1826 skb = add_grec(skb, pmc, type, 0, 0, 0); in mld_send_report()
1827 spin_unlock_bh(&pmc->mca_lock); in mld_send_report()
1830 spin_lock_bh(&pmc->mca_lock); in mld_send_report()
1831 if (pmc->mca_sfcount[MCAST_EXCLUDE]) in mld_send_report()
1835 skb = add_grec(skb, pmc, type, 0, 0, 0); in mld_send_report()
1836 spin_unlock_bh(&pmc->mca_lock); in mld_send_report()
1866 struct ifmcaddr6 *pmc, *pmc_prev, *pmc_next; in mld_send_cr() local
1875 for (pmc = idev->mc_tomb; pmc; pmc = pmc_next) { in mld_send_cr()
1876 pmc_next = pmc->next; in mld_send_cr()
1877 if (pmc->mca_sfmode == MCAST_INCLUDE) { in mld_send_cr()
1880 skb = add_grec(skb, pmc, type, 1, 0, 0); in mld_send_cr()
1881 skb = add_grec(skb, pmc, dtype, 1, 1, 0); in mld_send_cr()
1883 if (pmc->mca_crcount) { in mld_send_cr()
1884 if (pmc->mca_sfmode == MCAST_EXCLUDE) { in mld_send_cr()
1886 skb = add_grec(skb, pmc, type, 1, 0, 0); in mld_send_cr()
1888 pmc->mca_crcount--; in mld_send_cr()
1889 if (pmc->mca_crcount == 0) { in mld_send_cr()
1890 mld_clear_zeros(&pmc->mca_tomb); in mld_send_cr()
1891 mld_clear_zeros(&pmc->mca_sources); in mld_send_cr()
1894 if (pmc->mca_crcount == 0 && !pmc->mca_tomb && in mld_send_cr()
1895 !pmc->mca_sources) { in mld_send_cr()
1900 in6_dev_put(pmc->idev); in mld_send_cr()
1901 kfree(pmc); in mld_send_cr()
1903 pmc_prev = pmc; in mld_send_cr()
1908 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { in mld_send_cr()
1909 spin_lock_bh(&pmc->mca_lock); in mld_send_cr()
1910 if (pmc->mca_sfcount[MCAST_EXCLUDE]) { in mld_send_cr()
1917 skb = add_grec(skb, pmc, type, 0, 0, 0); in mld_send_cr()
1918 skb = add_grec(skb, pmc, dtype, 0, 1, 0); /* deleted sources */ in mld_send_cr()
1921 if (pmc->mca_crcount) { in mld_send_cr()
1922 if (pmc->mca_sfmode == MCAST_EXCLUDE) in mld_send_cr()
1926 skb = add_grec(skb, pmc, type, 0, 0, 0); in mld_send_cr()
1927 pmc->mca_crcount--; in mld_send_cr()
1929 spin_unlock_bh(&pmc->mca_lock); in mld_send_cr()
2036 struct ifmcaddr6 *pmc; in mld_send_initial_cr() local
2044 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { in mld_send_initial_cr()
2045 spin_lock_bh(&pmc->mca_lock); in mld_send_initial_cr()
2046 if (pmc->mca_sfcount[MCAST_EXCLUDE]) in mld_send_initial_cr()
2050 skb = add_grec(skb, pmc, type, 0, 0, 1); in mld_send_initial_cr()
2051 spin_unlock_bh(&pmc->mca_lock); in mld_send_initial_cr()
2082 static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, in ip6_mc_del1_src() argument
2089 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { in ip6_mc_del1_src()
2100 struct inet6_dev *idev = pmc->idev; in ip6_mc_del1_src()
2106 pmc->mca_sources = psf->sf_next; in ip6_mc_del1_src()
2107 if (psf->sf_oldin && !(pmc->mca_flags & MAF_NOREPORT) && in ip6_mc_del1_src()
2110 psf->sf_next = pmc->mca_tomb; in ip6_mc_del1_src()
2111 pmc->mca_tomb = psf; in ip6_mc_del1_src()
2123 struct ifmcaddr6 *pmc; in ip6_mc_del_src() local
2130 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { in ip6_mc_del_src()
2131 if (ipv6_addr_equal(pmca, &pmc->mca_addr)) in ip6_mc_del_src()
2134 if (!pmc) { in ip6_mc_del_src()
2139 spin_lock_bh(&pmc->mca_lock); in ip6_mc_del_src()
2140 sf_markstate(pmc); in ip6_mc_del_src()
2142 if (!pmc->mca_sfcount[sfmode]) { in ip6_mc_del_src()
2143 spin_unlock_bh(&pmc->mca_lock); in ip6_mc_del_src()
2147 pmc->mca_sfcount[sfmode]--; in ip6_mc_del_src()
2151 int rv = ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); in ip6_mc_del_src()
2157 if (pmc->mca_sfmode == MCAST_EXCLUDE && in ip6_mc_del_src()
2158 pmc->mca_sfcount[MCAST_EXCLUDE] == 0 && in ip6_mc_del_src()
2159 pmc->mca_sfcount[MCAST_INCLUDE]) { in ip6_mc_del_src()
2163 pmc->mca_sfmode = MCAST_INCLUDE; in ip6_mc_del_src()
2164 pmc->mca_crcount = idev->mc_qrv; in ip6_mc_del_src()
2165 idev->mc_ifc_count = pmc->mca_crcount; in ip6_mc_del_src()
2166 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) in ip6_mc_del_src()
2168 mld_ifc_event(pmc->idev); in ip6_mc_del_src()
2169 } else if (sf_setstate(pmc) || changerec) in ip6_mc_del_src()
2170 mld_ifc_event(pmc->idev); in ip6_mc_del_src()
2171 spin_unlock_bh(&pmc->mca_lock); in ip6_mc_del_src()
2179 static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode, in ip6_mc_add1_src() argument
2185 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { in ip6_mc_add1_src()
2199 pmc->mca_sources = psf; in ip6_mc_add1_src()
2205 static void sf_markstate(struct ifmcaddr6 *pmc) in sf_markstate() argument
2208 int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE]; in sf_markstate()
2210 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) in sf_markstate()
2211 if (pmc->mca_sfcount[MCAST_EXCLUDE]) { in sf_markstate()
2219 static int sf_setstate(struct ifmcaddr6 *pmc) in sf_setstate() argument
2222 int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE]; in sf_setstate()
2223 int qrv = pmc->idev->mc_qrv; in sf_setstate()
2227 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { in sf_setstate()
2228 if (pmc->mca_sfcount[MCAST_EXCLUDE]) { in sf_setstate()
2237 for (dpsf = pmc->mca_tomb; dpsf; in sf_setstate()
2248 pmc->mca_tomb = dpsf->sf_next; in sf_setstate()
2260 for (dpsf = pmc->mca_tomb; dpsf; dpsf = dpsf->sf_next) in sf_setstate()
2270 dpsf->sf_next = pmc->mca_tomb; in sf_setstate()
2271 pmc->mca_tomb = dpsf; in sf_setstate()
2287 struct ifmcaddr6 *pmc; in ip6_mc_add_src() local
2294 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { in ip6_mc_add_src()
2295 if (ipv6_addr_equal(pmca, &pmc->mca_addr)) in ip6_mc_add_src()
2298 if (!pmc) { in ip6_mc_add_src()
2303 spin_lock_bh(&pmc->mca_lock); in ip6_mc_add_src()
2305 sf_markstate(pmc); in ip6_mc_add_src()
2306 isexclude = pmc->mca_sfmode == MCAST_EXCLUDE; in ip6_mc_add_src()
2308 pmc->mca_sfcount[sfmode]++; in ip6_mc_add_src()
2311 err = ip6_mc_add1_src(pmc, sfmode, &psfsrc[i]); in ip6_mc_add_src()
2319 pmc->mca_sfcount[sfmode]--; in ip6_mc_add_src()
2321 ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]); in ip6_mc_add_src()
2322 } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { in ip6_mc_add_src()
2326 if (pmc->mca_sfcount[MCAST_EXCLUDE]) in ip6_mc_add_src()
2327 pmc->mca_sfmode = MCAST_EXCLUDE; in ip6_mc_add_src()
2328 else if (pmc->mca_sfcount[MCAST_INCLUDE]) in ip6_mc_add_src()
2329 pmc->mca_sfmode = MCAST_INCLUDE; in ip6_mc_add_src()
2332 pmc->mca_crcount = idev->mc_qrv; in ip6_mc_add_src()
2333 idev->mc_ifc_count = pmc->mca_crcount; in ip6_mc_add_src()
2334 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) in ip6_mc_add_src()
2337 } else if (sf_setstate(pmc)) in ip6_mc_add_src()
2339 spin_unlock_bh(&pmc->mca_lock); in ip6_mc_add_src()
2344 static void ip6_mc_clear_src(struct ifmcaddr6 *pmc) in ip6_mc_clear_src() argument
2348 for (psf = pmc->mca_tomb; psf; psf = nextpsf) { in ip6_mc_clear_src()
2352 pmc->mca_tomb = NULL; in ip6_mc_clear_src()
2353 for (psf = pmc->mca_sources; psf; psf = nextpsf) { in ip6_mc_clear_src()
2357 pmc->mca_sources = NULL; in ip6_mc_clear_src()
2358 pmc->mca_sfmode = MCAST_EXCLUDE; in ip6_mc_clear_src()
2359 pmc->mca_sfcount[MCAST_INCLUDE] = 0; in ip6_mc_clear_src()
2360 pmc->mca_sfcount[MCAST_EXCLUDE] = 1; in ip6_mc_clear_src()