net: usb: cdc-ncm: check for filtering capability
If the decice does not support filtering, filtering must not be used and all packets delivered for the upper layers to sort. Signed-off-by: Oliver Neukum <oneukum@suse.com> Link: https://patch.msgid.link/20250717120649.2090929-1-oneukum@suse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>pull/1309/head
parent
72b4612af3
commit
61c3e8940f
|
|
@ -892,6 +892,10 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->func_desc)
|
||||||
|
ctx->filtering_supported = !!(ctx->func_desc->bmNetworkCapabilities
|
||||||
|
& USB_CDC_NCM_NCAP_ETH_FILTER);
|
||||||
|
|
||||||
iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
|
iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
|
||||||
|
|
||||||
/* Device-specific flags */
|
/* Device-specific flags */
|
||||||
|
|
@ -1898,6 +1902,14 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cdc_ncm_update_filter(struct usbnet *dev)
|
||||||
|
{
|
||||||
|
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
|
||||||
|
|
||||||
|
if (ctx->filtering_supported)
|
||||||
|
usbnet_cdc_update_filter(dev);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct driver_info cdc_ncm_info = {
|
static const struct driver_info cdc_ncm_info = {
|
||||||
.description = "CDC NCM (NO ZLP)",
|
.description = "CDC NCM (NO ZLP)",
|
||||||
.flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
|
.flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
|
||||||
|
|
@ -1908,7 +1920,7 @@ static const struct driver_info cdc_ncm_info = {
|
||||||
.status = cdc_ncm_status,
|
.status = cdc_ncm_status,
|
||||||
.rx_fixup = cdc_ncm_rx_fixup,
|
.rx_fixup = cdc_ncm_rx_fixup,
|
||||||
.tx_fixup = cdc_ncm_tx_fixup,
|
.tx_fixup = cdc_ncm_tx_fixup,
|
||||||
.set_rx_mode = usbnet_cdc_update_filter,
|
.set_rx_mode = cdc_ncm_update_filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Same as cdc_ncm_info, but with FLAG_SEND_ZLP */
|
/* Same as cdc_ncm_info, but with FLAG_SEND_ZLP */
|
||||||
|
|
@ -1922,7 +1934,7 @@ static const struct driver_info cdc_ncm_zlp_info = {
|
||||||
.status = cdc_ncm_status,
|
.status = cdc_ncm_status,
|
||||||
.rx_fixup = cdc_ncm_rx_fixup,
|
.rx_fixup = cdc_ncm_rx_fixup,
|
||||||
.tx_fixup = cdc_ncm_tx_fixup,
|
.tx_fixup = cdc_ncm_tx_fixup,
|
||||||
.set_rx_mode = usbnet_cdc_update_filter,
|
.set_rx_mode = cdc_ncm_update_filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Same as cdc_ncm_info, but with FLAG_SEND_ZLP */
|
/* Same as cdc_ncm_info, but with FLAG_SEND_ZLP */
|
||||||
|
|
@ -1964,7 +1976,7 @@ static const struct driver_info wwan_info = {
|
||||||
.status = cdc_ncm_status,
|
.status = cdc_ncm_status,
|
||||||
.rx_fixup = cdc_ncm_rx_fixup,
|
.rx_fixup = cdc_ncm_rx_fixup,
|
||||||
.tx_fixup = cdc_ncm_tx_fixup,
|
.tx_fixup = cdc_ncm_tx_fixup,
|
||||||
.set_rx_mode = usbnet_cdc_update_filter,
|
.set_rx_mode = cdc_ncm_update_filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Same as wwan_info, but with FLAG_NOARP */
|
/* Same as wwan_info, but with FLAG_NOARP */
|
||||||
|
|
@ -1978,7 +1990,7 @@ static const struct driver_info wwan_noarp_info = {
|
||||||
.status = cdc_ncm_status,
|
.status = cdc_ncm_status,
|
||||||
.rx_fixup = cdc_ncm_rx_fixup,
|
.rx_fixup = cdc_ncm_rx_fixup,
|
||||||
.tx_fixup = cdc_ncm_tx_fixup,
|
.tx_fixup = cdc_ncm_tx_fixup,
|
||||||
.set_rx_mode = usbnet_cdc_update_filter,
|
.set_rx_mode = cdc_ncm_update_filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct usb_device_id cdc_devs[] = {
|
static const struct usb_device_id cdc_devs[] = {
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ struct cdc_ncm_ctx {
|
||||||
u32 timer_interval;
|
u32 timer_interval;
|
||||||
u32 max_ndp_size;
|
u32 max_ndp_size;
|
||||||
u8 is_ndp16;
|
u8 is_ndp16;
|
||||||
|
u8 filtering_supported;
|
||||||
union {
|
union {
|
||||||
struct usb_cdc_ncm_ndp16 *delayed_ndp16;
|
struct usb_cdc_ncm_ndp16 *delayed_ndp16;
|
||||||
struct usb_cdc_ncm_ndp32 *delayed_ndp32;
|
struct usb_cdc_ncm_ndp32 *delayed_ndp32;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue