Comments (4)
oh, I think this would address #35 I filed.
from mtcp.
instead of implementing vmxnet3 in igb_uio/igb_uio.c, I found a easier solution, which is to patch SetInterfaceInfo() in mtcp/src/io_module to get MAC address from ports_eth_addr where rte_eth_macaddr_get populated, instead of relying on ioctl to get MAC address from the netdev dpdk* interface, I think this is more portable and solving the pain to support each adapter in igb_uio/igb_uio.c, rough patch as below:
diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c
index ad3e01d..83e0893 100644
--- a/mtcp/src/io_module.c
+++ b/mtcp/src/io_module.c
@@ -63,6 +63,22 @@ GetNumQueues()
return queue_cnt;
}
/*----------------------------------------------------------------------------*/
+
+static int GetPortIndex(char *dev_name)
+{
+ char *p = dev_name;
+ long val = -1;
+ while (*p) { // While there are more characters to process...
+ if (isdigit(*p)) { // Upon finding a digit, ...
+ val = strtol(p, &p, 10); // Read a number, ...
+ } else {
+ p++;
+ }
+ }
+ return (int)val;
+}
+
+
int
SetInterfaceInfo(char* dev_name_list)
{
@@ -243,9 +259,10 @@ SetInterfaceInfo(char* dev_name_list)
CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin;
}
- if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0 ) {
+ if(strstr(iter_if->ifa_name, "dpdk") != NULL) {
+ ret = GetPortIndex(iter_if->ifa_name);
for (j = 0; j < ETH_ALEN; j ++) {
- CONFIG.eths[eidx].haddr[j] = ifr.ifr_addr.sa_data[j];
+ CONFIG.eths[eidx].haddr[j] = ports_eth_addr[ret].addr_bytes[j];
}
}
from mtcp.
Thanks. I haven't done any work on vmxnet driver yet. Can you please describe in more detail how this patch can be used to run applications in the VM? As in... what kind of network configuration (mtcp conf file details etc.) would be needed to get mTCP applications operational?
from mtcp.
when running mTCP in ESXi VM environment, the dpdk<#> interface have MAC address of "00:00:00:00:00:00", packet originated from mTCP VM will be dropped by physical switches in our lab enviornment due to the MAC address of "00:00:00:00:00:00". the reason of "00:00:00:00:00:00" is because mTCP DPDK igb_uio/igb_uio.c or igb_uio.h did not implement the case for vmxnet3, but IGB and IXGBE only, I had thought about implement vmxnet3 case in igb_uio/igb_uio.c or igb_uio.h, but I came up above patch to avoid to add vmxnet specific code in following place:
1, in mTCP DPDK igb_uio/igb_uio.c igbuio_pci_probe like code below (switch case for vmxnet3):
adapter->type = retrieve_dev_specs(id);
/* recover device-specific mac address */
switch (adapter->type) {
case IXGBE:
hw_i = &adapter->hw._ixgbe_hw;
hw_i->back = adapter;
hw_i->hw_addr = ioremap(pci_resource_start(dev, 0),
pci_resource_len(dev, 0));
if (!hw_i->hw_addr) {
err = -EIO;
goto fail_ioremap;
}
break;
case IGB:
hw_e = &adapter->hw._e1000_hw;
hw_e->back = adapter;
hw_e->hw_addr = ioremap(pci_resource_start(dev, 0),
pci_resource_len(dev, 0));
if (!hw_e->hw_addr) {
err = -EIO;
goto fail_ioremap;
}
break;
}
or in lib/librte_eal/linuxapp/igb_uio/igb_uio.h <<retrieve_dev_addr>> to get MAC address for vmxnet3 for the linux netdev interface dpdk<#> (switch case for vmxnet3)
/**
* A device specific function that retrieves mac address from each NIC interface
*/
void
retrieve_dev_addr(struct net_device *netdev, struct net_adapter *adapter)
{
struct ixgbe_hw *hw_i;
struct e1000_hw *hw_e;
//struct vmxnet3_hw *hw_x;
u32 rar_high;
u32 rar_low;
u16 i;
switch (adapter->type) {
case IXGBE:
hw_i = &adapter->hw._ixgbe_hw;
rar_high = IXGBE_READ_REG(hw_i, IXGBE_RAH(0));
rar_low = IXGBE_READ_REG(hw_i, IXGBE_RAL(0));
for (i = 0; i < 4; i++)
netdev->dev_addr[i] = (u8)(rar_low >> (i*8));
for (i = 0; i < 2; i++)
netdev->dev_addr[i+4] = (u8)(rar_high >> (i*8));
break;
case IGB:
hw_e = &adapter->hw._e1000_hw;
rar_high = E1000_READ_REG(hw_e, E1000_RAH(0));
rar_low = E1000_READ_REG(hw_e, E1000_RAL(0));
for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++)
netdev->dev_addr[i] = (u8)(rar_low >> (i*8));
for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++)
netdev->dev_addr[i+4] = (u8)(rar_high >> (i*8));
break;
}
let me know if you are not clear
from mtcp.
Related Issues (20)
- Socket reader and writer in different threads
- Please remove dpdk-iface-kmod HOT 1
- Simple ping-pong mTCP app - slow ping (0.016 sec on a direct 10G connection) - mTCP not production-ready
- CentOS Linux release 7.8.2003 (Core) error: unknown field βndo_change_mtuβ specified in initializer
- Dell R220 Centos 7.8 mTCP DPDK 18.05 ERROR: This system does not support "AES".
- [ MPCreate: 173] Can't allocate memory for mempool! HOT 5
- Is mtcp over DPDK compatible with Linux Kernel 5.9? I got some errors at dpdk-iface.h HOT 1
- error running "epwget" example app, got error "No Ethernet port!"
- Run both the client and server on the same ubuntu system, is it possible?
- mTCP for Mellanox Bluefield SmartNIC HOT 3
- How to send requests to epserver
- DHCP lease time bug
- mtcp make issue HOT 2
- Macronix MX98715 packet driver returns always MAC address 00:00:00:00:00:00 ?
- A bug by static variables in RunMainLoop()
- mTCP make issue HOT 1
- Make issue with mtcp
- Lots of disconnect fail / errors HOT 1
- No route to x.x.x.x when running `perf` example HOT 1
- Strange DHCP issue with PowerLine Adapters?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mtcp.