static void ibmveth_set_multicast_list(struct net_device *netdev) { struct ibmveth_adapter *adapter = netdev_priv(netdev); unsigned long lpar_rc; if((netdev->flags & IFF_PROMISC) || (netdev->mc_count > adapter->mcastFilterSize)) { lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastEnableRecv | IbmVethMcastDisableFiltering, 0); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld when " "entering promisc mode\n", lpar_rc); } } else { struct dev_mc_list *mclist = netdev->mc_list; int i; /* clear the filter table & disable filtering */ lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastEnableRecv | IbmVethMcastDisableFiltering | IbmVethMcastClearFilterTable, 0); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld when " "attempting to clear filter table\n", lpar_rc); } /* add the addresses to the filter table */ for(i = 0; i < netdev->mc_count; ++i, mclist = mclist->next) { /* add the multicast address to the filter table */ unsigned long mcast_addr = 0; memcpy(((char *)&mcast_addr)+2, mclist->dmi_addr, 6); lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastAddFilter, mcast_addr); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld " "when adding an entry to the filter " "table\n", lpar_rc); } } /* re-enable filtering */ lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastEnableFiltering, 0); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld when " "enabling filtering\n", lpar_rc); } } }
static void ibmveth_set_multicast_list(struct net_device *netdev) { struct ibmveth_adapter *adapter = netdev_priv(netdev); unsigned long lpar_rc; if ((netdev->flags & IFF_PROMISC) || (netdev_mc_count(netdev) > adapter->mcastFilterSize)) { lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastEnableRecv | IbmVethMcastDisableFiltering, 0); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld when " "entering promisc mode\n", lpar_rc); } } else { struct netdev_hw_addr *ha; /* clear the filter table & disable filtering */ lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastEnableRecv | IbmVethMcastDisableFiltering | IbmVethMcastClearFilterTable, 0); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld when " "attempting to clear filter table\n", lpar_rc); } /* add the addresses to the filter table */ netdev_for_each_mc_addr(ha, netdev) { /* add the multicast address to the filter table */ u64 mcast_addr; mcast_addr = ibmveth_encode_mac_addr(ha->addr); lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastAddFilter, mcast_addr); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld " "when adding an entry to the filter " "table\n", lpar_rc); } } /* re-enable filtering */ lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, IbmVethMcastEnableFiltering, 0); if (lpar_rc != H_SUCCESS) { netdev_err(netdev, "h_multicast_ctrl rc=%ld when " "enabling filtering\n", lpar_rc); } }