📄 ee_mcast.c,v
字号:
head 1.2;access;symbols;locks dls:1.2; strict;comment @ * @;1.2date 97.09.21.19.25.55; author dls; state Dist;branches;next 1.1;1.1date 94.09.24.01.00.41; author dls; state Works;branches;next ;desc@@1.2log@pre-3e code@text@/* ee_mcast.c - ee_mcadd, ee_mcdel, ee_mcset */#include <conf.h>#include <kernel.h>#include <network.h>#include <i386.h>#include <ee.h>/*------------------------------------------------------------------------ * ee_mcadd - add multicast addresses for Intel EtherExpress16 *------------------------------------------------------------------------ */intee_mcadd(ped, mca)struct etdev *ped;Eaddr mca;{ STATWORD ps; int i;#ifdef MULTICAST disable(ps); for (i=0; i<ped->ed_mcc; ++i) if (blkequ(mca, ped->ed_mca[i])) { restore(ps); return OK; /* already there */ } blkcopy(ped->ed_mca[i], mca, EP_ALEN); ped->ed_mcc++; restore(ps); while (enq(ped->ed_outq, EE_SETMULTI, -1) < 0) { /* queue full; retry later */ sleep10(1); } ee_wstrt(ped); return OK;#else /* MULTICAST */ return SYSERR;#endif /* MULTICAST */}/*------------------------------------------------------------------------ * ee_mcdel - delete multicast addresses for Intel EtherExpress16 *------------------------------------------------------------------------ */intee_mcdel(ped, mca)struct etdev *ped;Eaddr mca;{ STATWORD ps; int i;#ifdef MULTICAST disable(ps); for (i=0; i<ped->ed_mcc; ++i) if (blkequ(mca, ped->ed_mca[i], EP_ALEN)) break; if (i == ped->ed_mcc) { restore(ps); return OK; } i++; for (; i<ped->ed_mcc; ++i) blkcopy(ped->ed_mca[i-1], ped->ed_mca[i], EP_ALEN); ped->ed_mcc--; restore(ps); while (enq(ped->ed_outq, EE_SETMULTI, -1) < 0) { /* queue full; retry later */ sleep10(1); } ee_wstrt(ped); return OK;#else /* MULTICAST */ return SYSERR;#endif /* MULTICAST */}mcdump(ped)struct etdev *ped;{ int i, j; kprintf("mcc %d\n", ped->ed_mcc); for (i=0; i<ped->ed_mcc; ++i) { kprintf("%d) ", i); for (j=0; j<EP_ALEN-1; ++j) kprintf("%02x:", ped->ed_mca[i][j]); kprintf("%02x\n", ped->ed_mca[i][j]); }}@1.1log@Initial revision@text@d1 1a1 1/* ee_mcast.c - ee_mcast */d6 2d9 32a40 1Eaddr template = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 };d43 1a43 1 * ee_mcast - generate & set an IP multicast hardware addressd46 4a49 5int ee_mcast(op, dev, hwa, ipa)int op;int dev;Eaddr hwa;IPaddr ipa;d51 20a70 13 blkcopy(hwa, template, EP_ALEN); /* add in low-order 23 bits of IP multicast address */ hwa[3] = (ipa >> 16) & 0x7; hwa[4] = (ipa >> 8); hwa[5] = ipa; switch (op) { case NI_MADD: return control(dev, EPC_MADD, hwa); break; case NI_MDEL: return control(dev, EPC_MDEL, hwa); break;d72 1d74 17@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -