Re: [PATCH] staging: ccree: Fix indentation in ssi_buffer_mgr.c
On Thu, Oct 26, 2017 at 06:53:42PM -0700, Stephen Brennan wrote: > In particular, fixes some over-indented if statement bodies as well as a > couple lines indented with spaces. checkpatch.pl now reports no warnings > on this file other than 80 character warnings. > > Signed-off-by: Stephen Brennan > --- > Hello again, hoping these indentation issues are a bit more actionable than > the > line length errors I was trying to fix in my previous patch. Again, thanks in > advance for taking the time to look! > > drivers/staging/ccree/ssi_buffer_mgr.c | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c > b/drivers/staging/ccree/ssi_buffer_mgr.c > index dca3ce84d043..7c62255128d5 100644 > --- a/drivers/staging/ccree/ssi_buffer_mgr.c > +++ b/drivers/staging/ccree/ssi_buffer_mgr.c > @@ -406,8 +406,8 @@ ssi_aead_handle_config_buf(struct device *dev, > sg_init_one(&areq_ctx->ccm_adata_sg, config_data, AES_BLOCK_SIZE + > areq_ctx->ccm_hdr_size); > if (unlikely(dma_map_sg(dev, &areq_ctx->ccm_adata_sg, 1, > DMA_TO_DEVICE) != 1)) { > - dev_err(dev, "dma_map_sg() config buffer failed\n"); > - return -ENOMEM; > + dev_err(dev, "dma_map_sg() config buffer failed\n"); > + return -ENOMEM; > } > dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK > offset=%u length=%u\n", > &sg_dma_address(&areq_ctx->ccm_adata_sg), > @@ -435,8 +435,8 @@ static inline int ssi_ahash_handle_curr_buf(struct device > *dev, > sg_init_one(areq_ctx->buff_sg, curr_buff, curr_buff_cnt); > if (unlikely(dma_map_sg(dev, areq_ctx->buff_sg, 1, > DMA_TO_DEVICE) != 1)) { > - dev_err(dev, "dma_map_sg() src buffer failed\n"); > - return -ENOMEM; > + dev_err(dev, "dma_map_sg() src buffer failed\n"); > + return -ENOMEM; So far so good. > } > dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK > offset=%u length=%u\n", > &sg_dma_address(areq_ctx->buff_sg), sg_page(areq_ctx->buff_sg), > @@ -1029,10 +1029,10 @@ static inline int > ssi_buffer_mgr_prepare_aead_data_mlli( >* verification is made by CPU compare in order to > simplify >* MAC verification upon request completion >*/ > - u32 size_to_skip = req->assoclen; > + u32 size_to_skip = req->assoclen; > > - if (areq_ctx->is_gcm4543) > - size_to_skip += crypto_aead_ivsize(tfm); > + if (areq_ctx->is_gcm4543) > + size_to_skip += crypto_aead_ivsize(tfm); > > ssi_buffer_mgr_copy_scatterlist_portion( > dev, areq_ctx->backup_mac, req->src, But then ssi_buffer_mgr_copy_scatterlist_portion() is still not indented correctly. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] staging: fsl-dpaa2/eth: Frame buffer work
This patchset does some refactoring in the frame buffer area, in order for it to be in line with firmware (MC) configuration. Patches 1 - 2 do some label cleanup and move the buffer layout setup to a dedicated function. Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to not account the software annotation area, since it's already accounted for by the firmware. Patch 4 updates the required alignment for Rx frame buffers, based on the accelerator hardware version. Patch 5 configures a headroom in the Rx frame buffers to prevent netstack reallocations in forwarding scenarios. Patchset sent against staging-next. Bogdan Purcareata (3): staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset staging: fsl-dpaa2/eth: Change RX buffer alignment staging: fsl-dpaa2/eth: Extra headroom in RX buffers Ioana Radulescu (2): staging: fsl-dpaa2/eth: Label cleanup staging: fsl-dpaa2/eth: Split function drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 170 ++--- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 44 +-- 2 files changed, 129 insertions(+), 85 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
When configuring the Tx buffer layout, the software annotation size is mentioned, and MC accounts for it when configuring the frame tx_data_offset. No need to handle it in the driver as well. Signed-off-by: Bogdan Purcareata --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 92faaaf..d68c1f5 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n", priv->tx_data_offset); - /* Accommodate software annotation space (SWA) */ - priv->tx_data_offset += DPAA2_ETH_SWA_SIZE; - return 0; close: -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] staging: fsl-dpaa2/eth: Label cleanup
From: Ioana Radulescu Clean up goto labels in a couple of functions, by removing/renaming redundant ones. Signed-off-by: Ioana Radulescu Signed-off-by: Bogdan Purcareata --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++--- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 9fbc0ee..5d2bd18 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct dpaa2_eth_priv *priv) err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, &dpcon->mc_handle); if (err) { dev_err(dev, "dpcon_open() failed\n"); - goto err_open; + goto free; } err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle); if (err) { dev_err(dev, "dpcon_reset() failed\n"); - goto err_reset; + goto close; } err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, &attrs); if (err) { dev_err(dev, "dpcon_get_attributes() failed\n"); - goto err_get_attr; + goto close; } err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle); if (err) { dev_err(dev, "dpcon_enable() failed\n"); - goto err_enable; + goto close; } return dpcon; -err_enable: -err_get_attr: -err_reset: +close: dpcon_close(priv->mc_io, 0, dpcon->mc_handle); -err_open: +free: fsl_mc_object_free(dpcon); return NULL; @@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, &priv->mc_token); if (err) { dev_err(dev, "dpni_open() failed\n"); - goto err_open; + return err; } ls_dev->mc_io = priv->mc_io; @@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) err = dpni_reset(priv->mc_io, 0, priv->mc_token); if (err) { dev_err(dev, "dpni_reset() failed\n"); - goto err_reset; + goto close; } err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token, &priv->dpni_attrs); if (err) { dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err); - goto err_get_attr; + goto close; } /* Configure buffer layouts */ @@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) DPNI_QUEUE_RX, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(RX) failed\n"); - goto err_buf_layout; + goto close; } /* tx buffer */ @@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) DPNI_QUEUE_TX, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(TX) failed\n"); - goto err_buf_layout; + goto close; } /* tx-confirm buffer */ @@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) DPNI_QUEUE_TX_CONFIRM, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n"); - goto err_buf_layout; + goto close; } /* Now that we've set our tx buffer layout, retrieve the minimum @@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) &priv->tx_data_offset); if (err) { dev_err(dev, "dpni_get_tx_data_offset() failed\n"); - goto err_data_offset; + goto close; } if ((priv->tx_data_offset % 64) != 0) @@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) return 0; -err_data_offset: -err_buf_layout: -err_get_attr: -err_reset: +close: dpni_close(priv->mc_io, 0, priv->mc_token); -err_open: + return err; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/5] staging: fsl-dpaa2/eth: Split function
From: Ioana Radulescu Since setup_dpni() became a bit too long, move the buffer layout configuration to a separate function. Signed-off-by: Ioana Radulescu Signed-off-by: Bogdan Purcareata --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++--- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 5d2bd18..92faaaf 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv) fsl_mc_object_free(priv->dpbp_dev); } -/* Configure the DPNI object this interface is associated with */ -static int setup_dpni(struct fsl_mc_device *ls_dev) +static int set_buffer_layout(struct dpaa2_eth_priv *priv) { - struct device *dev = &ls_dev->dev; - struct dpaa2_eth_priv *priv; - struct net_device *net_dev; + struct device *dev = priv->net_dev->dev.parent; struct dpni_buffer_layout buf_layout = {0}; int err; - net_dev = dev_get_drvdata(dev); - priv = netdev_priv(net_dev); - - /* get a handle for the DPNI object */ - err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, &priv->mc_token); - if (err) { - dev_err(dev, "dpni_open() failed\n"); - return err; - } - - ls_dev->mc_io = priv->mc_io; - ls_dev->mc_handle = priv->mc_token; - - err = dpni_reset(priv->mc_io, 0, priv->mc_token); - if (err) { - dev_err(dev, "dpni_reset() failed\n"); - goto close; - } - - err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token, - &priv->dpni_attrs); - if (err) { - dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err); - goto close; - } - - /* Configure buffer layouts */ /* rx buffer */ buf_layout.pass_parser_result = true; buf_layout.pass_frame_status = true; @@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) DPNI_QUEUE_RX, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(RX) failed\n"); - goto close; + return err; } /* tx buffer */ @@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) DPNI_QUEUE_TX, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(TX) failed\n"); - goto close; + return err; } /* tx-confirm buffer */ @@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) DPNI_QUEUE_TX_CONFIRM, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n"); + return err; + } + + return 0; +} + +/* Configure the DPNI object this interface is associated with */ +static int setup_dpni(struct fsl_mc_device *ls_dev) +{ + struct device *dev = &ls_dev->dev; + struct dpaa2_eth_priv *priv; + struct net_device *net_dev; + int err; + + net_dev = dev_get_drvdata(dev); + priv = netdev_priv(net_dev); + + /* get a handle for the DPNI object */ + err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, &priv->mc_token); + if (err) { + dev_err(dev, "dpni_open() failed\n"); + return err; + } + + ls_dev->mc_io = priv->mc_io; + ls_dev->mc_handle = priv->mc_token; + + err = dpni_reset(priv->mc_io, 0, priv->mc_token); + if (err) { + dev_err(dev, "dpni_reset() failed\n"); goto close; } + err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token, + &priv->dpni_attrs); + if (err) { + dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err); + goto close; + } + + err = set_buffer_layout(priv); + if (err) + goto close; + /* Now that we've set our tx buffer layout, retrieve the minimum * required tx data offset. */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
The WRIOP hardware block v1.0.0 (found on LS2080A board) requires data in RX buffers to be aligned to 256B, but newer revisions (e.g. on LS2088A, LS1088A) only require 64B alignment. Check WRIOP version and decide at runtime which alignment requirement to configure for ingress buffers. Signed-off-by: Bogdan Purcareata Signed-off-by: Ioana Radulescu --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 ++ drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 14 +++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index d68c1f5..29b4928 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid) /* Allocate buffer visible to WRIOP + skb shared info + * alignment padding */ - buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE); + buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE(priv)); if (unlikely(!buf)) goto err_alloc; - buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN); + buf = PTR_ALIGN(buf, priv->rx_buf_align); addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); @@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid) /* tracing point */ trace_dpaa2_eth_buf_seed(priv->net_dev, -buf, DPAA2_ETH_BUF_RAW_SIZE, +buf, DPAA2_ETH_BUF_RAW_SIZE(priv), addr, DPAA2_ETH_RX_BUF_SIZE, bpid); } @@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv) struct dpni_buffer_layout buf_layout = {0}; int err; + /* We need to check for WRIOP version 1.0.0, but depending on the MC +* version, this number is not always provided correctly on rev1. +* We need to check for both alternatives in this situation. +*/ + if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) || + priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0)) + priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1; + else + priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN; + /* rx buffer */ buf_layout.pass_parser_result = true; buf_layout.pass_frame_status = true; buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE; - buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN; + buf_layout.data_align = priv->rx_buf_align; buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE | diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index bfbabae..374a99a 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -45,6 +45,8 @@ #include "dpaa2-eth-trace.h" +#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0) + #define DPAA2_ETH_STORE_SIZE 16 /* Maximum number of scatter-gather entries in an ingress frame, @@ -85,7 +87,12 @@ */ #define DPAA2_ETH_RX_BUF_SIZE 2048 #define DPAA2_ETH_TX_BUF_ALIGN 64 -#define DPAA2_ETH_RX_BUF_ALIGN 256 +/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned + * to 256B. For newer revisions, the requirement is only for 64B alignment + */ +#define DPAA2_ETH_RX_BUF_ALIGN_REV1256 +#define DPAA2_ETH_RX_BUF_ALIGN 64 + #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \ ((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN) @@ -93,10 +100,10 @@ * buffers large enough to allow building an skb around them and also account * for alignment restrictions */ -#define DPAA2_ETH_BUF_RAW_SIZE \ +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \ (DPAA2_ETH_RX_BUF_SIZE + \ SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \ - DPAA2_ETH_RX_BUF_ALIGN) + (priv)->rx_buf_align) /* We are accommodating a skb backpointer and some S/G info * in the frame's software annotation. The hardware @@ -318,6 +325,7 @@ struct dpaa2_eth_priv { struct iommu_domain *iommu_domain; u16 tx_qdid; + u16 rx_buf_align; struct fsl_mc_io *mc_io; /* Cores which have an affine DPIO/DPCON. * This is the cpu set on which Rx and Tx conf frames are processed -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/l
[PATCH 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers
The needed headroom that we ask the stack to reserve for us in TX skbs is larger than the headroom available in RX frames, which leads to skb reallocations in forwarding scenarios involving two DPNI interfaces. Configure the hardware to reserve some extra space in the RX frame headroom to avoid this situation. The value is chosen based on the Tx frame data offset, the Rx buffer alignment value and the netdevice required headroom. The network stack will take care to reserve space for HH_DATA_MOD when building the skb, so there's no need to account for it in the netdevice needed headroom. Signed-off-by: Bogdan Purcareata Signed-off-by: Ioana Radulescu --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++--- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 32 +++ 2 files changed, 67 insertions(+), 44 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 29b4928..636beac 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct dpaa2_eth_priv *priv, ch->buf_count--; - skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE + - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))); + skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE); if (unlikely(!skb)) return NULL; @@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv, if (i == 0) { /* We build the skb around the first data buffer */ - skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE + - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))); + skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE); if (unlikely(!skb)) { /* Free the first SG entry now, since we already * unmapped it and obtained the virtual address @@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv) else priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN; - /* rx buffer */ - buf_layout.pass_parser_result = true; + /* tx buffer */ buf_layout.pass_frame_status = true; buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE; - buf_layout.data_align = priv->rx_buf_align; - buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | -DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | -DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE | -DPNI_BUF_LAYOUT_OPT_DATA_ALIGN; - err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token, -DPNI_QUEUE_RX, &buf_layout); - if (err) { - dev_err(dev, "dpni_set_buffer_layout(RX) failed\n"); - return err; - } - - /* tx buffer */ buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token, @@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv) return err; } + /* Now that we've set our tx buffer layout, retrieve the minimum +* required tx data offset. +*/ + err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token, + &priv->tx_data_offset); + if (err) { + dev_err(dev, "dpni_get_tx_data_offset() failed\n"); + return err; + } + + if ((priv->tx_data_offset % 64) != 0) + dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n", +priv->tx_data_offset); + + /* rx buffer */ + buf_layout.pass_parser_result = true; + buf_layout.data_align = priv->rx_buf_align; + buf_layout.data_head_room = DPAA2_ETH_RX_HEAD_ROOM(priv); + buf_layout.private_data_size = 0; + buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | +DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | +DPNI_BUF_LAYOUT_OPT_DATA_ALIGN | +DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM; + err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token, +DPNI_QUEUE_RX, &buf_layout); + if (err) { + dev_err(dev, "dpni_set_buffer_layout(RX) failed\n"); + return err; + } + return 0; } @@ -1868,19 +1882,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) if (err) goto close; - /* Now that we've set our tx buffer layout, retrieve the minimum -* required tx data offset. -*/ - err = dpni_get_tx_data_offset(priv->mc_io, 0
Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote: > When configuring the Tx buffer layout, the software annotation size is > mentioned, and MC accounts for it when configuring the frame > tx_data_offset. No need to handle it in the driver as well. > The impact is that we allocate slightly less memory right? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote: > @@ -93,10 +100,10 @@ > * buffers large enough to allow building an skb around them and also account > * for alignment restrictions > */ > -#define DPAA2_ETH_BUF_RAW_SIZE \ > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \ > (DPAA2_ETH_RX_BUF_SIZE + \ > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \ > - DPAA2_ETH_RX_BUF_ALIGN) > + (priv)->rx_buf_align) > Not related to this patch, but this macro is ugly. It would be better as function. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
On Fri, Oct 27, 2017 at 02:31:22PM +, Bogdan Purcareata wrote: > > -Original Message- > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > > Sent: Friday, October 27, 2017 5:27 PM > > To: Bogdan Purcareata > > Cc: Ruxandra Ioana Radulescu ; > > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > > de...@driverdev.osuosl.org > > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in > > tx_data_offset > > > > > > On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote: > > > When configuring the Tx buffer layout, the software annotation size is > > > mentioned, and MC accounts for it when configuring the frame > > > tx_data_offset. No need to handle it in the driver as well. > > > > > > > The impact is that we allocate slightly less memory right? > > Yes, 64B per frame. Ok. Cool. Please put this kind of stuff in the changelog. At first I thought it was maybe a buffer overflow just from reading what was in the email without looking at the code. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ccree: Fix indentation in ssi_buffer_mgr.c
On Fri, Oct 27, 2017 at 07:23:58AM -0700, Joe Perches wrote: > On Fri, 2017-10-27 at 11:32 +0300, Dan Carpenter wrote: > > But then ssi_buffer_mgr_copy_scatterlist_portion() is still not indented > > correctly. Yeah, I don't know how I missed it. I'll send a new version of the patch out momentarily. > The latest version of checkpatch should bleat something on the > ...scatterlist_portion( > line Strangely, my checkpatch doesn't complain about it, but I guess you can't always rely on tools for this stuff. For reference, I'm currently on the 10/18 linux-next branch. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Friday, October 27, 2017 5:34 PM > To: Bogdan Purcareata > Cc: Ruxandra Ioana Radulescu ; > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@driverdev.osuosl.org > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in > tx_data_offset > > On Fri, Oct 27, 2017 at 02:31:22PM +, Bogdan Purcareata wrote: > > > -Original Message- > > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > > > Sent: Friday, October 27, 2017 5:27 PM > > > To: Bogdan Purcareata > > > Cc: Ruxandra Ioana Radulescu ; > > > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > > > de...@driverdev.osuosl.org > > > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in > > > tx_data_offset > > > > > > > > > On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote: > > > > When configuring the Tx buffer layout, the software annotation size is > > > > mentioned, and MC accounts for it when configuring the frame > > > > tx_data_offset. No need to handle it in the driver as well. > > > > > > > > > > The impact is that we allocate slightly less memory right? > > > > Yes, 64B per frame. > > Ok. Cool. Please put this kind of stuff in the changelog. At first I > thought it was maybe a buffer overflow just from reading what was in the > email without looking at the code. Okay, will update in v2. Thank you! Bogdan P. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Friday, October 27, 2017 5:27 PM > To: Bogdan Purcareata > Cc: Ruxandra Ioana Radulescu ; > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@driverdev.osuosl.org > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in > tx_data_offset > > > On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote: > > When configuring the Tx buffer layout, the software annotation size is > > mentioned, and MC accounts for it when configuring the frame > > tx_data_offset. No need to handle it in the driver as well. > > > > The impact is that we allocate slightly less memory right? Yes, 64B per frame. Bogdan P. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: ccree: Fix indentation in ssi_buffer_mgr.c
In particular, fixes some over-indented if statement bodies as well as a couple lines indented with spaces. checkpatch.pl now reports no warnings on this file other than 80 character warnings. Signed-off-by: Stephen Brennan --- V2 also fixes an overlooked indentation error that checkpatch didn't catch. drivers/staging/ccree/ssi_buffer_mgr.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index dca3ce84d043..1f8a225530a8 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -406,8 +406,8 @@ ssi_aead_handle_config_buf(struct device *dev, sg_init_one(&areq_ctx->ccm_adata_sg, config_data, AES_BLOCK_SIZE + areq_ctx->ccm_hdr_size); if (unlikely(dma_map_sg(dev, &areq_ctx->ccm_adata_sg, 1, DMA_TO_DEVICE) != 1)) { - dev_err(dev, "dma_map_sg() config buffer failed\n"); - return -ENOMEM; + dev_err(dev, "dma_map_sg() config buffer failed\n"); + return -ENOMEM; } dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK offset=%u length=%u\n", &sg_dma_address(&areq_ctx->ccm_adata_sg), @@ -435,8 +435,8 @@ static inline int ssi_ahash_handle_curr_buf(struct device *dev, sg_init_one(areq_ctx->buff_sg, curr_buff, curr_buff_cnt); if (unlikely(dma_map_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE) != 1)) { - dev_err(dev, "dma_map_sg() src buffer failed\n"); - return -ENOMEM; + dev_err(dev, "dma_map_sg() src buffer failed\n"); + return -ENOMEM; } dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK offset=%u length=%u\n", &sg_dma_address(areq_ctx->buff_sg), sg_page(areq_ctx->buff_sg), @@ -1029,12 +1029,12 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( * verification is made by CPU compare in order to simplify * MAC verification upon request completion */ - u32 size_to_skip = req->assoclen; + u32 size_to_skip = req->assoclen; - if (areq_ctx->is_gcm4543) - size_to_skip += crypto_aead_ivsize(tfm); + if (areq_ctx->is_gcm4543) + size_to_skip += crypto_aead_ivsize(tfm); - ssi_buffer_mgr_copy_scatterlist_portion( + ssi_buffer_mgr_copy_scatterlist_portion( dev, areq_ctx->backup_mac, req->src, size_to_skip + req->cryptlen - areq_ctx->req_authsize, size_to_skip + req->cryptlen, SSI_SG_TO_BUF); -- 2.14.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Friday, October 27, 2017 5:30 PM > To: Bogdan Purcareata > Cc: Ruxandra Ioana Radulescu ; > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@driverdev.osuosl.org > Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment > > On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote: > > @@ -93,10 +100,10 @@ > > * buffers large enough to allow building an skb around them and also > account > > * for alignment restrictions > > */ > > -#define DPAA2_ETH_BUF_RAW_SIZE \ > > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \ > > (DPAA2_ETH_RX_BUF_SIZE + \ > > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \ > > - DPAA2_ETH_RX_BUF_ALIGN) > > + (priv)->rx_buf_align) > > > > Not related to this patch, but this macro is ugly. It would be better > as function. Okay, will change the macros to inline functions in v2, where applicable. Thank you! Bogdan P. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ccree: Fix indentation in ssi_buffer_mgr.c
On Fri, 2017-10-27 at 11:32 +0300, Dan Carpenter wrote: > On Thu, Oct 26, 2017 at 06:53:42PM -0700, Stephen Brennan wrote: > > In particular, fixes some over-indented if statement bodies as well as a > > couple lines indented with spaces. checkpatch.pl now reports no warnings > > on this file other than 80 character warnings. [] > > diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c > > b/drivers/staging/ccree/ssi_buffer_mgr.c [] > > @@ -1029,10 +1029,10 @@ static inline int > > ssi_buffer_mgr_prepare_aead_data_mlli( > > * verification is made by CPU compare in order to > > simplify > > * MAC verification upon request completion > > */ > > - u32 size_to_skip = req->assoclen; > > + u32 size_to_skip = req->assoclen; > > > > - if (areq_ctx->is_gcm4543) > > - size_to_skip += crypto_aead_ivsize(tfm); > > + if (areq_ctx->is_gcm4543) > > + size_to_skip += crypto_aead_ivsize(tfm); > > > > ssi_buffer_mgr_copy_scatterlist_portion( > > dev, areq_ctx->backup_mac, req->src, > > But then ssi_buffer_mgr_copy_scatterlist_portion() is still not indented > correctly. The latest version of checkpatch should bleat something on the ...scatterlist_portion( line ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192e: set priv->irq as 0 after the irq is freed
_rtl92e_init can fail here, we must set priv->irq as 0 after free_irq. Signed-off-by: Arvind Yadav --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index aca5265..1ea1142 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1095,6 +1095,7 @@ static short _rtl92e_init(struct net_device *dev) if (_rtl92e_pci_initdescring(dev) != 0) { netdev_err(dev, "Endopoints initialization failed"); free_irq(dev->irq, dev); + priv->irq = 0; return -1; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel