Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/liquidio/lio_ioctl.c
Show First 20 Lines • Show All 485 Lines • ▼ Show 20 Lines | if (if_getamcount(ifp) > LIO_MAX_MULTICAST_ADDR) | ||||
f |= LIO_IFFLAG_ALLMULTI; | f |= LIO_IFFLAG_ALLMULTI; | ||||
} | } | ||||
if (if_getflags(ifp) & IFF_BROADCAST) | if (if_getflags(ifp) & IFF_BROADCAST) | ||||
f |= LIO_IFFLAG_BROADCAST; | f |= LIO_IFFLAG_BROADCAST; | ||||
return (f); | return (f); | ||||
} | } | ||||
static u_int | |||||
lio_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) | |||||
{ | |||||
uint64_t *mc = arg; | |||||
if (cnt == LIO_MAX_MULTICAST_ADDR) | |||||
return (0); | |||||
mc += cnt; | |||||
*mc = 0; | |||||
memcpy(((uint8_t *)mc) + 2, LLADDR(sdl), ETHER_ADDR_LEN); | |||||
/* no need to swap bytes */ | |||||
return (1); | |||||
} | |||||
/* @param ifp network device */ | /* @param ifp network device */ | ||||
static int | static int | ||||
lio_set_mcast_list(struct ifnet *ifp) | lio_set_mcast_list(struct ifnet *ifp) | ||||
{ | { | ||||
struct lio *lio = if_getsoftc(ifp); | struct lio *lio = if_getsoftc(ifp); | ||||
struct octeon_device *oct = lio->oct_dev; | struct octeon_device *oct = lio->oct_dev; | ||||
struct lio_ctrl_pkt nctrl; | struct lio_ctrl_pkt nctrl; | ||||
struct ifmultiaddr *ifma; | int mc_count; | ||||
uint64_t *mc; | |||||
int mc_count = 0; | |||||
int ret; | int ret; | ||||
bzero(&nctrl, sizeof(struct lio_ctrl_pkt)); | bzero(&nctrl, sizeof(struct lio_ctrl_pkt)); | ||||
/* Create a ctrl pkt command to be sent to core app. */ | /* Create a ctrl pkt command to be sent to core app. */ | ||||
nctrl.ncmd.cmd64 = 0; | nctrl.ncmd.cmd64 = 0; | ||||
nctrl.ncmd.s.cmd = LIO_CMD_SET_MULTI_LIST; | nctrl.ncmd.s.cmd = LIO_CMD_SET_MULTI_LIST; | ||||
nctrl.ncmd.s.param1 = lio_get_new_flags(ifp); | nctrl.ncmd.s.param1 = lio_get_new_flags(ifp); | ||||
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; | nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; | ||||
nctrl.lio = lio; | nctrl.lio = lio; | ||||
nctrl.cb_fn = lio_ctrl_cmd_completion; | nctrl.cb_fn = lio_ctrl_cmd_completion; | ||||
/* copy all the addresses into the udd */ | /* copy all the addresses into the udd */ | ||||
mc = &nctrl.udd[0]; | mc_count = if_foreach_llmaddr(ifp, lio_copy_maddr, &nctrl.udd[0]); | ||||
/* to protect access to if_multiaddrs */ | |||||
if_maddr_rlock(ifp); | |||||
CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { | |||||
if (ifma->ifma_addr->sa_family != AF_LINK) | |||||
continue; | |||||
*mc = 0; | |||||
memcpy(((uint8_t *)mc) + 2, | |||||
LLADDR((struct sockaddr_dl *)ifma->ifma_addr), | |||||
ETHER_ADDR_LEN); | |||||
/* no need to swap bytes */ | |||||
mc_count++; | |||||
if (++mc > &nctrl.udd[LIO_MAX_MULTICAST_ADDR]) | |||||
break; | |||||
} | |||||
if_maddr_runlock(ifp); | |||||
/* | /* | ||||
* Apparently, any activity in this call from the kernel has to | * Apparently, any activity in this call from the kernel has to | ||||
* be atomic. So we won't wait for response. | * be atomic. So we won't wait for response. | ||||
*/ | */ | ||||
nctrl.wait_time = 0; | nctrl.wait_time = 0; | ||||
nctrl.ncmd.s.param2 = mc_count; | nctrl.ncmd.s.param2 = mc_count; | ||||
nctrl.ncmd.s.more = mc_count; | nctrl.ncmd.s.more = mc_count; | ||||
Show All 9 Lines |