Lines Matching refs:comm

13 void spl2sw_rx_descs_flush(struct spl2sw_common *comm)  in spl2sw_rx_descs_flush()  argument
20 rx_desc = comm->rx_desc[i]; in spl2sw_rx_descs_flush()
21 rx_skbinfo = comm->rx_skb_info[i]; in spl2sw_rx_descs_flush()
22 for (j = 0; j < comm->rx_desc_num[i]; j++) { in spl2sw_rx_descs_flush()
24 rx_desc[j].cmd2 = (j == comm->rx_desc_num[i] - 1) ? in spl2sw_rx_descs_flush()
25 RXD_EOR | comm->rx_desc_buff_size : in spl2sw_rx_descs_flush()
26 comm->rx_desc_buff_size; in spl2sw_rx_descs_flush()
33 void spl2sw_tx_descs_clean(struct spl2sw_common *comm) in spl2sw_tx_descs_clean() argument
37 if (!comm->tx_desc) in spl2sw_tx_descs_clean()
41 comm->tx_desc[i].cmd1 = 0; in spl2sw_tx_descs_clean()
43 comm->tx_desc[i].cmd2 = 0; in spl2sw_tx_descs_clean()
44 comm->tx_desc[i].addr1 = 0; in spl2sw_tx_descs_clean()
45 comm->tx_desc[i].addr2 = 0; in spl2sw_tx_descs_clean()
47 if (comm->tx_temp_skb_info[i].mapping) { in spl2sw_tx_descs_clean()
48 dma_unmap_single(&comm->pdev->dev, comm->tx_temp_skb_info[i].mapping, in spl2sw_tx_descs_clean()
49 comm->tx_temp_skb_info[i].skb->len, DMA_TO_DEVICE); in spl2sw_tx_descs_clean()
50 comm->tx_temp_skb_info[i].mapping = 0; in spl2sw_tx_descs_clean()
53 if (comm->tx_temp_skb_info[i].skb) { in spl2sw_tx_descs_clean()
54 dev_kfree_skb_any(comm->tx_temp_skb_info[i].skb); in spl2sw_tx_descs_clean()
55 comm->tx_temp_skb_info[i].skb = NULL; in spl2sw_tx_descs_clean()
60 void spl2sw_rx_descs_clean(struct spl2sw_common *comm) in spl2sw_rx_descs_clean() argument
67 if (!comm->rx_skb_info[i]) in spl2sw_rx_descs_clean()
70 rx_desc = comm->rx_desc[i]; in spl2sw_rx_descs_clean()
71 rx_skbinfo = comm->rx_skb_info[i]; in spl2sw_rx_descs_clean()
72 for (j = 0; j < comm->rx_desc_num[i]; j++) { in spl2sw_rx_descs_clean()
79 dma_unmap_single(&comm->pdev->dev, rx_skbinfo[j].mapping, in spl2sw_rx_descs_clean()
80 comm->rx_desc_buff_size, DMA_FROM_DEVICE); in spl2sw_rx_descs_clean()
88 comm->rx_skb_info[i] = NULL; in spl2sw_rx_descs_clean()
92 void spl2sw_descs_clean(struct spl2sw_common *comm) in spl2sw_descs_clean() argument
94 spl2sw_rx_descs_clean(comm); in spl2sw_descs_clean()
95 spl2sw_tx_descs_clean(comm); in spl2sw_descs_clean()
98 void spl2sw_descs_free(struct spl2sw_common *comm) in spl2sw_descs_free() argument
102 spl2sw_descs_clean(comm); in spl2sw_descs_free()
103 comm->tx_desc = NULL; in spl2sw_descs_free()
105 comm->rx_desc[i] = NULL; in spl2sw_descs_free()
108 if (comm->desc_base) { in spl2sw_descs_free()
109 dma_free_coherent(&comm->pdev->dev, comm->desc_size, comm->desc_base, in spl2sw_descs_free()
110 comm->desc_dma); in spl2sw_descs_free()
111 comm->desc_base = NULL; in spl2sw_descs_free()
112 comm->desc_dma = 0; in spl2sw_descs_free()
113 comm->desc_size = 0; in spl2sw_descs_free()
117 void spl2sw_tx_descs_init(struct spl2sw_common *comm) in spl2sw_tx_descs_init() argument
119 memset(comm->tx_desc, '\0', sizeof(struct spl2sw_mac_desc) * in spl2sw_tx_descs_init()
123 int spl2sw_rx_descs_init(struct spl2sw_common *comm) in spl2sw_rx_descs_init() argument
132 comm->rx_skb_info[i] = kcalloc(comm->rx_desc_num[i], sizeof(*rx_skbinfo), in spl2sw_rx_descs_init()
134 if (!comm->rx_skb_info[i]) in spl2sw_rx_descs_init()
137 rx_skbinfo = comm->rx_skb_info[i]; in spl2sw_rx_descs_init()
138 rx_desc = comm->rx_desc[i]; in spl2sw_rx_descs_init()
139 for (j = 0; j < comm->rx_desc_num[i]; j++) { in spl2sw_rx_descs_init()
140 skb = netdev_alloc_skb(NULL, comm->rx_desc_buff_size); in spl2sw_rx_descs_init()
145 mapping = dma_map_single(&comm->pdev->dev, skb->data, in spl2sw_rx_descs_init()
146 comm->rx_desc_buff_size, in spl2sw_rx_descs_init()
148 if (dma_mapping_error(&comm->pdev->dev, mapping)) in spl2sw_rx_descs_init()
154 rx_desc[j].cmd2 = (j == comm->rx_desc_num[i] - 1) ? in spl2sw_rx_descs_init()
155 RXD_EOR | comm->rx_desc_buff_size : in spl2sw_rx_descs_init()
156 comm->rx_desc_buff_size; in spl2sw_rx_descs_init()
165 spl2sw_rx_descs_clean(comm); in spl2sw_rx_descs_init()
169 int spl2sw_descs_alloc(struct spl2sw_common *comm) in spl2sw_descs_alloc() argument
177 desc_size += comm->rx_desc_num[i] * sizeof(struct spl2sw_mac_desc); in spl2sw_descs_alloc()
179 comm->desc_base = dma_alloc_coherent(&comm->pdev->dev, desc_size, &comm->desc_dma, in spl2sw_descs_alloc()
181 if (!comm->desc_base) in spl2sw_descs_alloc()
184 comm->desc_size = desc_size; in spl2sw_descs_alloc()
187 comm->tx_desc = comm->desc_base; in spl2sw_descs_alloc()
190 comm->rx_desc[0] = &comm->tx_desc[TX_DESC_NUM + MAC_GUARD_DESC_NUM]; in spl2sw_descs_alloc()
192 comm->rx_desc[i] = comm->rx_desc[i - 1] + comm->rx_desc_num[i - 1]; in spl2sw_descs_alloc()
197 int spl2sw_descs_init(struct spl2sw_common *comm) in spl2sw_descs_init() argument
202 comm->rx_desc_num[0] = RX_QUEUE0_DESC_NUM; in spl2sw_descs_init()
203 comm->rx_desc_num[1] = RX_QUEUE1_DESC_NUM; in spl2sw_descs_init()
206 comm->rx_desc[i] = NULL; in spl2sw_descs_init()
207 comm->rx_skb_info[i] = NULL; in spl2sw_descs_init()
208 comm->rx_pos[i] = 0; in spl2sw_descs_init()
210 comm->rx_desc_buff_size = MAC_RX_LEN_MAX; in spl2sw_descs_init()
213 comm->tx_done_pos = 0; in spl2sw_descs_init()
214 comm->tx_desc = NULL; in spl2sw_descs_init()
215 comm->tx_pos = 0; in spl2sw_descs_init()
216 comm->tx_desc_full = 0; in spl2sw_descs_init()
218 comm->tx_temp_skb_info[i].skb = NULL; in spl2sw_descs_init()
221 ret = spl2sw_descs_alloc(comm); in spl2sw_descs_init()
225 spl2sw_tx_descs_init(comm); in spl2sw_descs_init()
227 return spl2sw_rx_descs_init(comm); in spl2sw_descs_init()