Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firewire: core: provide isoc header buffer size outside card driver

For single-channel isochronous contexts, the header storage size is
hard-coded to PAGE_SIZE. which is inconvenient for protocol
implementations requiring more space.

This commit refactors the code to obtain the header storage size outside
the 1394 OHCI driver.

Link: https://lore.kernel.org/r/20260117142823.440811-8-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

+20 -15
+2 -2
drivers/firewire/core-card.c
··· 704 704 return -ENODEV; 705 705 } 706 706 707 - static struct fw_iso_context *dummy_allocate_iso_context(struct fw_card *card, 708 - int type, int channel, size_t header_size) 707 + static struct fw_iso_context *dummy_allocate_iso_context(struct fw_card *card, int type, 708 + int channel, size_t header_size, size_t header_storage_size) 709 709 { 710 710 return ERR_PTR(-ENODEV); 711 711 }
+5 -3
drivers/firewire/core-iso.c
··· 138 138 } 139 139 140 140 struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int type, int channel, 141 - int speed, size_t header_size, union fw_iso_callback callback, void *callback_data) 141 + int speed, size_t header_size, size_t header_storage_size, 142 + union fw_iso_callback callback, void *callback_data) 142 143 { 143 144 struct fw_iso_context *ctx; 144 145 145 - ctx = card->driver->allocate_iso_context(card, 146 - type, channel, header_size); 146 + ctx = card->driver->allocate_iso_context(card, type, channel, header_size, 147 + header_storage_size); 147 148 if (IS_ERR(ctx)) 148 149 return ctx; 149 150 ··· 154 153 ctx->speed = speed; 155 154 ctx->flags = 0; 156 155 ctx->header_size = header_size; 156 + ctx->header_storage_size = header_storage_size; 157 157 ctx->callback = callback; 158 158 ctx->callback_data = callback_data; 159 159
+3 -3
drivers/firewire/core.h
··· 100 100 void (*write_csr)(struct fw_card *card, int csr_offset, u32 value); 101 101 102 102 struct fw_iso_context * 103 - (*allocate_iso_context)(struct fw_card *card, 104 - int type, int channel, size_t header_size); 103 + (*allocate_iso_context)(struct fw_card *card, int type, int channel, size_t header_size, 104 + size_t header_storage_size); 105 105 void (*free_iso_context)(struct fw_iso_context *ctx); 106 106 107 107 int (*start_iso)(struct fw_iso_context *ctx, ··· 178 178 { 179 179 union fw_iso_callback cb = { .mc = callback }; 180 180 181 - return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, 0, 0, 0, cb, 181 + return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, 0, 0, 0, 0, cb, 182 182 callback_data); 183 183 } 184 184
+5 -5
drivers/firewire/ohci.c
··· 2755 2755 { 2756 2756 u32 *ctx_hdr; 2757 2757 2758 - if (ctx->sc.header_length + ctx->base.header_size > PAGE_SIZE) { 2758 + if (ctx->sc.header_length + ctx->base.header_size > ctx->base.header_storage_size) { 2759 2759 if (ctx->base.flags & FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS) 2760 2760 return; 2761 2761 flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW); ··· 2924 2924 2925 2925 sync_it_packet_for_cpu(context, d); 2926 2926 2927 - if (ctx->sc.header_length + 4 > PAGE_SIZE) { 2927 + if (ctx->sc.header_length + 4 > ctx->base.header_storage_size) { 2928 2928 if (ctx->base.flags & FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS) 2929 2929 return 1; 2930 2930 flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW); ··· 2954 2954 ohci->mc_channels = channels; 2955 2955 } 2956 2956 2957 - static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, 2958 - int type, int channel, size_t header_size) 2957 + static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, int type, int channel, 2958 + size_t header_size, size_t header_storage_size) 2959 2959 { 2960 2960 struct fw_ohci *ohci = fw_ohci(card); 2961 2961 void *header __free(kvfree) = NULL; ··· 3016 3016 3017 3017 if (type != FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { 3018 3018 ctx->sc.header_length = 0; 3019 - header = kvmalloc(PAGE_SIZE, GFP_KERNEL); 3019 + header = kvmalloc(header_storage_size, GFP_KERNEL); 3020 3020 if (!header) { 3021 3021 ret = -ENOMEM; 3022 3022 goto out;
+5 -2
include/linux/firewire.h
··· 558 558 int speed; 559 559 int flags; 560 560 size_t header_size; 561 + size_t header_storage_size; 561 562 union fw_iso_callback callback; 562 563 void *callback_data; 563 564 }; 564 565 565 566 struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int type, int channel, 566 - int speed, size_t header_size, union fw_iso_callback callback, void *callback_data); 567 + int speed, size_t header_size, size_t header_storage_size, 568 + union fw_iso_callback callback, void *callback_data); 567 569 int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels); 568 570 int fw_iso_context_queue(struct fw_iso_context *ctx, 569 571 struct fw_iso_packet *packet, ··· 580 578 { 581 579 union fw_iso_callback cb = { .sc = callback }; 582 580 583 - return __fw_iso_context_create(card, type, channel, speed, header_size, cb, callback_data); 581 + return __fw_iso_context_create(card, type, channel, speed, header_size, PAGE_SIZE, cb, 582 + callback_data); 584 583 } 585 584 586 585 /**