Skip to content

Commit

Permalink
Increase eth buffer size to 16k for virtual switch (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored and lguohan committed Mar 21, 2019
1 parent 79fb388 commit e2f50e8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vslib/src/sai_vs_hostintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,8 @@ int promisc(const char *dev)
return err;
}

#define ETH_JUMBO_FRAME_SIZE (9000)
#define ETH_FRAME_BUFFER_SIZE (0x4000)
#define CONTROL_MESSAGE_BUFFER_SIZE (0x1000)
#define IEEE_8021Q_ETHER_TYPE (0x8100)
#define MAC_ADDRESS_SIZE (6)
#define VLAN_TAG_SIZE (4)
Expand All @@ -803,7 +804,7 @@ void veth2tap_fun(std::shared_ptr<hostif_info_t> info)
{
SWSS_LOG_ENTER();

unsigned char buffer[0x4000];
unsigned char buffer[ETH_FRAME_BUFFER_SIZE];

while (info->run_thread)
{
Expand All @@ -819,7 +820,7 @@ void veth2tap_fun(std::shared_ptr<hostif_info_t> info)
iov[0].iov_base = buffer; // buffer for message
iov[0].iov_len = sizeof(buffer);

char control[0x1000]; // buffer for control messages
char control[CONTROL_MESSAGE_BUFFER_SIZE]; // buffer for control messages

msg.msg_name = &src_addr;
msg.msg_namelen = sizeof(src_addr);
Expand All @@ -838,7 +839,7 @@ void veth2tap_fun(std::shared_ptr<hostif_info_t> info)
continue;
}

if (size < (ssize_t)sizeof(ethhdr) || size > ETH_JUMBO_FRAME_SIZE)
if (size < (ssize_t)sizeof(ethhdr))
{
SWSS_LOG_ERROR("invalid ethernet frame length: %zu", msg.msg_controllen);
continue;
Expand Down Expand Up @@ -905,7 +906,7 @@ void tap2veth_fun(std::shared_ptr<hostif_info_t> info)
{
SWSS_LOG_ENTER();

unsigned char buffer[0x4000];
unsigned char buffer[ETH_FRAME_BUFFER_SIZE];

while (info->run_thread)
{
Expand Down

0 comments on commit e2f50e8

Please sign in to comment.