dev.c - protocol selection - why two for's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

i am trying to understand _why_ there are two "for-loops" in dev.c when
determining protocol to handle packet processing to.

namely (2.4.20):

         pt_prev = NULL;
1438         for (ptype = ptype_all; ptype; ptype = ptype->next) {
1439                 if (!ptype->dev || ptype->dev == skb->dev) {
1440                         if (pt_prev) {
1441                                 if (!pt_prev->data) {
1442                                         ret =
deliver_to_old_ones(pt_prev, skb, 0);
1443                                 } else {
1444                                         atomic_inc(&skb->users);
1445                                         ret = pt_prev->func(skb,
skb->dev, pt_prev);
1446                                 }
1447                         }
1448                         pt_prev = ptype;
1449                 }
1450         }


and


1464         for (ptype=ptype_base[ntohs(type)&15];ptype;ptype=ptype->next)
{
1465                 if (ptype->type == type &&
1466                     (!ptype->dev || ptype->dev == skb->dev)) {
1467                         if (pt_prev) {
1468                                 if (!pt_prev->data) {
1469                                         ret =
deliver_to_old_ones(pt_prev, skb, 0);
1470                                 } else {
1471                                         atomic_inc(&skb->users);
1472                                         ret = pt_prev->func(skb,
skb->dev, pt_prev);
1473                                 }
1474                         }
1475                         pt_prev = ptype;
1476                 }
1477         }


i think that this ntohs(type)&15 is the key , isn't it?

thank you for any explanation.

adam

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux