Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/qlnx/qlnxe/qlnx_os.c
| Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
| static int qlnx_set_allmulti(qlnx_host_t *ha, int enabled); | static int qlnx_set_allmulti(qlnx_host_t *ha, int enabled); | ||||
| static int qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data); | static int qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data); | ||||
| static int qlnx_media_change(if_t ifp); | static int qlnx_media_change(if_t ifp); | ||||
| static void qlnx_media_status(if_t ifp, struct ifmediareq *ifmr); | static void qlnx_media_status(if_t ifp, struct ifmediareq *ifmr); | ||||
| static void qlnx_stop(qlnx_host_t *ha); | static void qlnx_stop(qlnx_host_t *ha); | ||||
| static int qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, | static int qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, | ||||
| struct mbuf **m_headp); | struct mbuf **m_headp); | ||||
| static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); | static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); | ||||
| static void qlnx_get_mac_addr(qlnx_host_t *ha); | |||||
| static uint32_t qlnx_get_optics(qlnx_host_t *ha, | static uint32_t qlnx_get_optics(qlnx_host_t *ha, | ||||
| struct qlnx_link_output *if_link); | struct qlnx_link_output *if_link); | ||||
| static int qlnx_transmit(if_t ifp, struct mbuf *mp); | static int qlnx_transmit(if_t ifp, struct mbuf *mp); | ||||
| static int qlnx_transmit_locked(if_t ifp, struct qlnx_fastpath *fp, | static int qlnx_transmit_locked(if_t ifp, struct qlnx_fastpath *fp, | ||||
| struct mbuf *mp); | struct mbuf *mp); | ||||
| static void qlnx_qflush(if_t ifp); | static void qlnx_qflush(if_t ifp); | ||||
| static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); | static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); | ||||
| ▲ Show 20 Lines • Show All 2,205 Lines • ▼ Show 20 Lines | if_setbaudrate(ifp, IF_Gbps(100)); | ||||
| if_setsendqlen(ifp, qlnx_get_ifq_snd_maxlen(ha)); | if_setsendqlen(ifp, qlnx_get_ifq_snd_maxlen(ha)); | ||||
| if_setsendqready(ifp); | if_setsendqready(ifp); | ||||
| if_setgetcounterfn(ifp, qlnx_get_counter); | if_setgetcounterfn(ifp, qlnx_get_counter); | ||||
| ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; | ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; | ||||
| memcpy(ha->primary_mac, qlnx_get_mac_addr(ha), ETH_ALEN); | qlnx_get_mac_addr(ha); | ||||
| if (!ha->primary_mac[0] && !ha->primary_mac[1] && | if (!ha->primary_mac[0] && !ha->primary_mac[1] && | ||||
kbowling: There is an ether_gen_addr that could replace the generator here | |||||
zleiAuthorUnsubmitted Not Done Inline ActionsYeah, indeed. zlei: Yeah, indeed. | |||||
| !ha->primary_mac[2] && !ha->primary_mac[3] && | !ha->primary_mac[2] && !ha->primary_mac[3] && | ||||
| !ha->primary_mac[4] && !ha->primary_mac[5]) { | !ha->primary_mac[4] && !ha->primary_mac[5]) { | ||||
| uint32_t rnd; | uint32_t rnd; | ||||
| rnd = arc4random(); | rnd = arc4random(); | ||||
| ha->primary_mac[0] = 0x00; | ha->primary_mac[0] = 0x00; | ||||
| ha->primary_mac[1] = 0x0e; | ha->primary_mac[1] = 0x0e; | ||||
| ▲ Show 20 Lines • Show All 1,431 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static int | static int | ||||
| qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha) | qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha) | ||||
| { | { | ||||
| return(TX_RING_SIZE - 1); | return(TX_RING_SIZE - 1); | ||||
| } | } | ||||
| uint8_t * | static void | ||||
| qlnx_get_mac_addr(qlnx_host_t *ha) | qlnx_get_mac_addr(qlnx_host_t *ha) | ||||
| { | { | ||||
| struct ecore_hwfn *p_hwfn; | struct ecore_hwfn *p_hwfn; | ||||
| unsigned char mac[ETHER_ADDR_LEN]; | unsigned char mac[ETHER_ADDR_LEN]; | ||||
| uint8_t p_is_forced; | uint8_t p_is_forced; | ||||
| p_hwfn = &ha->cdev.hwfns[0]; | p_hwfn = &ha->cdev.hwfns[0]; | ||||
| if (qlnx_vf_device(ha) != 0) | if (qlnx_vf_device(ha) != 0) { | ||||
| return (p_hwfn->hw_info.hw_mac_addr); | memcpy(ha->primary_mac, p_hwfn->hw_info.hw_mac_addr, ETH_ALEN); | ||||
| return; | |||||
| } | |||||
| ecore_vf_read_bulletin(p_hwfn, &p_is_forced); | ecore_vf_read_bulletin(p_hwfn, &p_is_forced); | ||||
| if (ecore_vf_bulletin_get_forced_mac(p_hwfn, mac, &p_is_forced) == | if (ecore_vf_bulletin_get_forced_mac(p_hwfn, mac, &p_is_forced) == | ||||
| true) { | true) { | ||||
| device_printf(ha->pci_dev, "%s: p_is_forced = %d" | device_printf(ha->pci_dev, "%s: p_is_forced = %d" | ||||
| " mac_addr = %02x:%02x:%02x:%02x:%02x:%02x\n", __func__, | " mac_addr = %02x:%02x:%02x:%02x:%02x:%02x\n", __func__, | ||||
| p_is_forced, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | p_is_forced, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | ||||
| memcpy(ha->primary_mac, mac, ETH_ALEN); | memcpy(ha->primary_mac, mac, ETH_ALEN); | ||||
| } | } | ||||
| return (ha->primary_mac); | |||||
| } | } | ||||
| static uint32_t | static uint32_t | ||||
| qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link) | qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link) | ||||
| { | { | ||||
| uint32_t ifm_type = 0; | uint32_t ifm_type = 0; | ||||
| switch (if_link->media_type) { | switch (if_link->media_type) { | ||||
| ▲ Show 20 Lines • Show All 4,552 Lines • Show Last 20 Lines | |||||
There is an ether_gen_addr that could replace the generator here