Message ID | 20221122214413.3446006-5-horatiu.vultur@microchip.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: lan966x: Extend xdp support | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next, async |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 12 of 12 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 22 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Tue, Nov 22, 2022 at 10:44:10PM +0100, Horatiu Vultur wrote: > By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able > to reuse pages on the TX side, when the XDP action XDP_TX it is required > to update the memory model to PAGE_POOL. > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > --- > .../net/ethernet/microchip/lan966x/lan966x_fdma.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > index 384ed34197d58..483d1470c8362 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx) > .max_len = rx->max_mtu - > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), > }; > + struct lan966x_port *port; port can be scoped only for the loop below? > + int i; > > rx->page_pool = page_pool_create(&pp_params); > + > + for (i = 0; i < lan966x->num_phys_ports; ++i) { Quoting Alex from some other thread: "Since we're on -std=gnu11 for a bunch of releases already, all new loops are expected to go with the iterator declarations inside them." TBH I wasn't aware of that personally :) > + if (!lan966x->ports[i]) > + continue; > + > + port = lan966x->ports[i]; > + > + xdp_rxq_info_unreg_mem_model(&port->xdp_rxq); > + xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL, > + rx->page_pool); > + } > + > return PTR_ERR_OR_ZERO(rx->page_pool); > } > > -- > 2.38.0 >
The 11/22/2022 23:01, Maciej Fijalkowski wrote: > > On Tue, Nov 22, 2022 at 10:44:10PM +0100, Horatiu Vultur wrote: > > By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able > > to reuse pages on the TX side, when the XDP action XDP_TX it is required > > to update the memory model to PAGE_POOL. > > > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > > --- > > .../net/ethernet/microchip/lan966x/lan966x_fdma.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > > index 384ed34197d58..483d1470c8362 100644 > > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > > @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx) > > .max_len = rx->max_mtu - > > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), > > }; > > + struct lan966x_port *port; > > port can be scoped only for the loop below? Yes, I will change this. > > > + int i; > > > > rx->page_pool = page_pool_create(&pp_params); > > + > > + for (i = 0; i < lan966x->num_phys_ports; ++i) { > > Quoting Alex from some other thread: > > "Since we're on -std=gnu11 for a bunch of releases already, all new > loops are expected to go with the iterator declarations inside them." > > TBH I wasn't aware of that personally :) Me neither, I will update this and all the other lops introduced in this series. > > > + if (!lan966x->ports[i]) > > + continue; > > + > > + port = lan966x->ports[i]; > > + > > + xdp_rxq_info_unreg_mem_model(&port->xdp_rxq); > > + xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL, > > + rx->page_pool); > > + } > > + > > return PTR_ERR_OR_ZERO(rx->page_pool); > > } > > > > -- > > 2.38.0 > >
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c index 384ed34197d58..483d1470c8362 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx) .max_len = rx->max_mtu - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), }; + struct lan966x_port *port; + int i; rx->page_pool = page_pool_create(&pp_params); + + for (i = 0; i < lan966x->num_phys_ports; ++i) { + if (!lan966x->ports[i]) + continue; + + port = lan966x->ports[i]; + + xdp_rxq_info_unreg_mem_model(&port->xdp_rxq); + xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL, + rx->page_pool); + } + return PTR_ERR_OR_ZERO(rx->page_pool); }
By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able to reuse pages on the TX side, when the XDP action XDP_TX it is required to update the memory model to PAGE_POOL. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> --- .../net/ethernet/microchip/lan966x/lan966x_fdma.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)