Skip to content

Commit e2f50e8

Browse files
kcudniklguohan
authored andcommitted
Increase eth buffer size to 16k for virtual switch (#435)
1 parent 79fb388 commit e2f50e8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vslib/src/sai_vs_hostintf.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,8 @@ int promisc(const char *dev)
794794
return err;
795795
}
796796

797-
#define ETH_JUMBO_FRAME_SIZE (9000)
797+
#define ETH_FRAME_BUFFER_SIZE (0x4000)
798+
#define CONTROL_MESSAGE_BUFFER_SIZE (0x1000)
798799
#define IEEE_8021Q_ETHER_TYPE (0x8100)
799800
#define MAC_ADDRESS_SIZE (6)
800801
#define VLAN_TAG_SIZE (4)
@@ -803,7 +804,7 @@ void veth2tap_fun(std::shared_ptr<hostif_info_t> info)
803804
{
804805
SWSS_LOG_ENTER();
805806

806-
unsigned char buffer[0x4000];
807+
unsigned char buffer[ETH_FRAME_BUFFER_SIZE];
807808

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

822-
char control[0x1000]; // buffer for control messages
823+
char control[CONTROL_MESSAGE_BUFFER_SIZE]; // buffer for control messages
823824

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

841-
if (size < (ssize_t)sizeof(ethhdr) || size > ETH_JUMBO_FRAME_SIZE)
842+
if (size < (ssize_t)sizeof(ethhdr))
842843
{
843844
SWSS_LOG_ERROR("invalid ethernet frame length: %zu", msg.msg_controllen);
844845
continue;
@@ -905,7 +906,7 @@ void tap2veth_fun(std::shared_ptr<hostif_info_t> info)
905906
{
906907
SWSS_LOG_ENTER();
907908

908-
unsigned char buffer[0x4000];
909+
unsigned char buffer[ETH_FRAME_BUFFER_SIZE];
909910

910911
while (info->run_thread)
911912
{

0 commit comments

Comments
 (0)