wctc4xxp: Constrain RTP payload to 500 bytes.

This is a limitation of the DTE firmware that normally would result in dropped
packets on the firmware. If the driver knows it is going to be dropped it should
drop it.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
Shaun Ruffell 2014-06-04 11:37:08 -05:00 committed by Russ Meyerriecks
parent 2010bc6433
commit 6e10dbdfb6

View File

@ -2292,6 +2292,7 @@ wctc4xxp_write(struct file *file, const char __user *frame,
u32 samples;
unsigned long flags;
const unsigned long MAX_SAMPLES_IN_FLIGHT = 640;
const unsigned long MAX_RTP_PAYLOAD = 500;
BUG_ON(!cpvt);
BUG_ON(!wc);
@ -2309,11 +2310,10 @@ wctc4xxp_write(struct file *file, const char __user *frame,
return -EINVAL;
}
if (unlikely(count > SFRAME_SIZE - sizeof(struct rtp_packet))) {
if (count > MAX_RTP_PAYLOAD) {
DTE_DEBUG(DTE_DEBUG_GENERAL,
"Cannot transcode packet of %Zu bytes. This exceeds the " \
"maximum size of %Zu bytes.\n", count,
SFRAME_SIZE - sizeof(struct rtp_packet));
"Cannot transcode packet of %Zu bytes. This exceeds the maximum size of %lu bytes.\n",
count, MAX_RTP_PAYLOAD);
return -EINVAL;
}