summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl_dpa_offload
diff options
context:
space:
mode:
authorMarian Chereji <marian.chereji@freescale.com>2014-08-06 19:06:08 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:39:29 (GMT)
commitc484a320889183f15306b13106f304c056b8f461 (patch)
treeb9e9c5987fb8bf2f3bd8743fb84a2350a1f034a3 /drivers/staging/fsl_dpa_offload
parent482408db7986470a56e3f0b21937343cec79eef0 (diff)
downloadlinux-fsl-qoriq-c484a320889183f15306b13106f304c056b8f461.tar.xz
dpa_offload: Fix update HM init failure when using IP frag only
Due to the recent aggregation that the dpa_classifier is performing for chained header manip nodes, a problem has occured in the update HM operation. This particular operation can consist of either one or two HM nodes, depending on what HM options the user is selecting in the parameters. This header manip operation can include an optional IP fragmentation. It can also consist ONLY of IP fragmentation at user's request. However, in this last case, the allocation of underlying HM nodes was incorrect and it was fixed. Signed-off-by: Marian Chereji <marian.chereji@freescale.com> Change-Id: Idb1ebe3cb518e1fd7a9d52fb0423e9e0e9b7900c Reviewed-on: http://git.am.freescale.net:8181/15621 Reviewed-by: Radu-Andrei Bulie <Radu.Bulie@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_dpa_offload')
-rw-r--r--drivers/staging/fsl_dpa_offload/dpa_classifier.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/drivers/staging/fsl_dpa_offload/dpa_classifier.c b/drivers/staging/fsl_dpa_offload/dpa_classifier.c
index 0899683..f9f43f6 100644
--- a/drivers/staging/fsl_dpa_offload/dpa_classifier.c
+++ b/drivers/staging/fsl_dpa_offload/dpa_classifier.c
@@ -6188,27 +6188,29 @@ static int update_hm_prepare_nodes(struct dpa_cls_hm *pupdate_hm,
pupdate_hm);
}
- hm_node = try_compatible_node(pupdate_hm);
- if ((pupdate_hm->update_params.ip_frag_params.mtu) ||
- (hm_node == NULL)) {
- /* Create a header manip node for this update: */
- hm_node = kzalloc(sizeof(*hm_node), GFP_KERNEL);
+ if (pupdate_hm->update_params.op_flags != DPA_CLS_HM_UPDATE_NONE) {
+ hm_node = try_compatible_node(pupdate_hm);
+ if ((pupdate_hm->update_params.ip_frag_params.mtu) ||
+ (hm_node == NULL)) {
+ /* Create a header manip node for this update: */
+ hm_node = kzalloc(sizeof(*hm_node), GFP_KERNEL);
+
+ dpa_cls_dbg(("DEBUG: dpa_classifier %s (%d): Created new hm_node = 0x%p\n",
+ __func__, __LINE__, hm_node));
+ if (!hm_node) {
+ log_err("No more memory for header manip nodes.\n");
+ return -ENOMEM;
+ }
- dpa_cls_dbg(("DEBUG: dpa_classifier %s (%d): Created new hm_node = 0x%p\n",
- __func__, __LINE__, hm_node));
- if (!hm_node) {
- log_err("No more memory for header manip nodes.\n");
- return -ENOMEM;
- }
+ INIT_LIST_HEAD(&hm_node->list_node);
- INIT_LIST_HEAD(&hm_node->list_node);
+ /* Initialize dontParseAfterManip to TRUE */
+ hm_node->params.u.hdr.dontParseAfterManip = TRUE;
+ }
- /* Initialize dontParseAfterManip to TRUE */
- hm_node->params.u.hdr.dontParseAfterManip = TRUE;
+ pupdate_hm->hm_node[0] = hm_node;
}
- pupdate_hm->hm_node[0] = hm_node;
-
if (pupdate_hm->update_params.ip_frag_params.mtu) {
/* IP fragmentation option is enabled */
/* Create a header manip node: */
@@ -6252,11 +6254,13 @@ static int update_hm_update_params(struct dpa_cls_hm *pupdate_hm)
hm_node = pupdate_hm->hm_node[0];
- hm_node->params.type = e_FM_PCD_MANIP_HDR;
-
if (pupdate_hm->update_params.op_flags & update_ops) {
+ hm_node->params.type = e_FM_PCD_MANIP_HDR;
hm_node->params.u.hdr.fieldUpdate = TRUE;
+ hm_node->params.u.hdr.dontParseAfterManip &=
+ (pupdate_hm->update_params.reparse) ? FALSE : TRUE;
+
if (pupdate_hm->update_params.op_flags &
DPA_CLS_HM_UPDATE_IPv4_UPDATE) {
hm_node->params.u.hdr.fieldUpdateParams.type =
@@ -6395,10 +6399,14 @@ static int update_hm_update_params(struct dpa_cls_hm *pupdate_hm)
}
if (pupdate_hm->update_params.op_flags & replace_ops) {
- hm_node->params.u.hdr.custom = TRUE;
- hm_node->params.u.hdr.customParams.type =
+ hm_node->params.type = e_FM_PCD_MANIP_HDR;
+ hm_node->params.u.hdr.custom = TRUE;
+ hm_node->params.u.hdr.customParams.type =
e_FM_PCD_MANIP_HDR_CUSTOM_IP_REPLACE;
+ hm_node->params.u.hdr.dontParseAfterManip &=
+ (pupdate_hm->update_params.reparse) ? FALSE : TRUE;
+
if (pupdate_hm->update_params.op_flags &
DPA_CLS_HM_REPLACE_IPv4_BY_IPv6) {
@@ -6436,9 +6444,6 @@ static int update_hm_update_params(struct dpa_cls_hm *pupdate_hm)
}
}
- hm_node->params.u.hdr.dontParseAfterManip &=
- (pupdate_hm->update_params.reparse) ? FALSE : TRUE;
-
hm_node = pupdate_hm->hm_node[1];
if (pupdate_hm->update_params.ip_frag_params.mtu) {