Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/exanic/exanic-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ static int exanic_map_tx_feedback(struct exanic *exanic,
for (off = 0; off < map_size; off += PAGE_SIZE)
{
err = vm_insert_page(vma, vma->vm_start + off,
virt_to_page(exanic->tx_feedback_virt + off));
exanic_virt_to_page(exanic->tx_feedback_virt + off));
if (err)
{
phys_addr = virt_to_phys(exanic->tx_feedback_virt + off);
Expand Down Expand Up @@ -488,7 +488,7 @@ static int exanic_map_rx_region(struct exanic *exanic, struct vm_area_struct *vm
for (off = 0; off < map_size; off += PAGE_SIZE)
{
err = vm_insert_page(vma, vma->vm_start + off,
virt_to_page(rx_region_virt + off));
exanic_virt_to_page(rx_region_virt + off));
if (err)
{
phys_addr = virt_to_phys(rx_region_virt + off);
Expand Down
9 changes: 6 additions & 3 deletions modules/exanic/exanic-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ bool exanic_rx_in_use(struct exanic *exanic, unsigned port_num)
if (exanic->port[port_num].rx_region_virt)
{
/* Check if the region is mapped */
if (page_count(virt_to_page(exanic->port[port_num].rx_region_virt)) > 1)
if (page_count(exanic_virt_to_page(
exanic->port[port_num].rx_region_virt)) > 1)
return true;
}

Expand All @@ -158,7 +159,8 @@ int exanic_count_tx_feedback_users(struct exanic *exanic)
{
for (i = 0; i < EXANIC_TX_FEEDBACK_NUM_PAGES; i++)
/* subtract 1 since we have a mapping */
count += page_count(virt_to_page(exanic->tx_feedback_virt + i * PAGE_SIZE)) - 1;
count += page_count(exanic_virt_to_page(
exanic->tx_feedback_virt + i * PAGE_SIZE)) - 1;

return count;
}
Expand All @@ -178,7 +180,8 @@ int exanic_count_rx_users(struct exanic *exanic)
{
if (exanic->port[i].rx_region_virt)
/* subtract 1 since we have a mapping */
count += page_count(virt_to_page(exanic->port[i].rx_region_virt)) - 1;
count += page_count(exanic_virt_to_page(
exanic->port[i].rx_region_virt)) - 1;

for (buf = 0; buf < exanic->max_filter_buffers; buf++)
count += exanic->port[i].filter_buffers[buf].refcount;
Expand Down
8 changes: 8 additions & 0 deletions modules/exanic/exanic.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef _EXANIC_H_
#define _EXANIC_H_

#include <linux/mm.h>

#include "../../include/exanic_version.h"

#define DRV_VERSION EXANIC_VERSION_TEXT
Expand Down Expand Up @@ -69,6 +71,12 @@ struct exanic_ate_regdump
/* exanic.c */
struct exanic;

/* dma_alloc_coherent() may return an address in vmalloc space. */
static inline struct page *exanic_virt_to_page(const void *addr)
{
return is_vmalloc_addr(addr) ? vmalloc_to_page(addr) : virt_to_page(addr);
}

struct exanic *exanic_find_by_minor(unsigned minor);

void exanic_netdev_get_id_and_port(struct net_device *ndev,
Expand Down