Skip to content

Commit e277f43

Browse files
committed
feat(baremetal NIC): initial push for baremetal NIC
Only works on Intel 82599 family based NICs
1 parent 0cdf0a4 commit e277f43

File tree

18 files changed

+3074
-37
lines changed

18 files changed

+3074
-37
lines changed

src/IOBuf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
#include <algorithm>
99
#include <cassert>
10+
#include <cstring>
1011
#include <forward_list>
1112
#include <memory>
1213
#include <vector>
13-
#include <cstring>
1414

1515
#include <boost/iterator/iterator_facade.hpp>
1616

@@ -64,6 +64,7 @@ class IOBuf {
6464
}
6565

6666
void TrimEnd(size_t amount) { length_ -= amount; }
67+
void SetLength(size_t amount) { length_ = amount; }
6768

6869
bool IsChained() const { return Next() != this; }
6970

src/native/GeneralPurposeAllocator.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@
1616

1717
namespace ebbrt {
1818

19+
// handler used in Pci.cc code to handle faults on multicores when mapping
20+
// device
21+
class MulticorePciFaultHandler : public ebbrt::VMemAllocator::PageFaultHandler {
22+
ebbrt::Pfn vpage_;
23+
ebbrt::Pfn ppage_;
24+
size_t size_;
25+
26+
public:
27+
void SetMap(ebbrt::Pfn va, ebbrt::Pfn pa, size_t s) {
28+
vpage_ = va;
29+
ppage_ = pa;
30+
size_ = s;
31+
}
32+
33+
void HandleFault(ebbrt::idt::ExceptionFrame* ef,
34+
uintptr_t faulted_address) override {
35+
ebbrt::vmem::MapMemory(vpage_, ppage_, size_);
36+
}
37+
};
38+
1939
// page fault handler for mapping in physical pages
2040
// to virtual pages on all cores
2141
class LargeRegionFaultHandler : public ebbrt::VMemAllocator::PageFaultHandler {

0 commit comments

Comments
 (0)