devices/e100-2.6.20-ethercat.c
changeset 1229 51d447754109
parent 1228 6d9c686f922e
child 1230 0f3878668790
equal deleted inserted replaced
1228:6d9c686f922e 1229:51d447754109
  1943 			(*work_done)++;
  1943 			(*work_done)++;
  1944 	}
  1944 	}
  1945 
  1945 
  1946 	if (nic->ecdev) {
  1946 	if (nic->ecdev) {
  1947 		// make receive frame descriptior usable again
  1947 		// make receive frame descriptior usable again
  1948 		rfd->status = 0x0000;
  1948 		memcpy(skb->data, &nic->blank_rfd, sizeof(struct rfd));
  1949 		rfd->command = cpu_to_le16(cb_el);
  1949 		rx->dma_addr = pci_map_single(nic->pdev, skb->data,
  1950 		rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,
       
  1951 				RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
  1950 				RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
       
  1951 		if(pci_dma_mapping_error(rx->dma_addr)) {
       
  1952 			rx->dma_addr = 0;
       
  1953 		}
       
  1954 
       
  1955 		/* Link the RFD to end of RFA by linking previous RFD to
       
  1956 		 * this one, and clearing EL bit of previous.  */
       
  1957 		if(rx->prev->skb) {
       
  1958 			struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
       
  1959 			put_unaligned(cpu_to_le32(rx->dma_addr),
       
  1960 					(u32 *)&prev_rfd->link);
       
  1961 			wmb();
       
  1962 			prev_rfd->command &= ~cpu_to_le16(cb_el);
       
  1963 			pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
       
  1964 					sizeof(struct rfd), PCI_DMA_TODEVICE);
       
  1965 		}
  1952 	} else {
  1966 	} else {
  1953 		rx->skb = NULL;
  1967 		rx->skb = NULL;
  1954 	}
  1968 	}
  1955 
  1969 
  1956 	return 0;
  1970 	return 0;