strsubr.c (8aa5c309) strsubr.c (da14cebe)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 13 unchanged lines hidden (view full) ---

22/* All Rights Reserved */
23
24
25/*
26 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 13 unchanged lines hidden (view full) ---

22/* All Rights Reserved */
23
24
25/*
26 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30#pragma ident "%Z%%M% %I% %E% SMI"
31
32#include <sys/types.h>
33#include <sys/sysmacros.h>
34#include <sys/param.h>
35#include <sys/errno.h>
36#include <sys/signal.h>
37#include <sys/proc.h>
38#include <sys/conf.h>
39#include <sys/cred.h>

--- 8405 unchanged lines hidden (view full) ---

8445void
8446hcksum_retrieve(mblk_t *mp, multidata_t *mmd, pdesc_t *pd,
8447 uint32_t *start, uint32_t *stuff, uint32_t *end,
8448 uint32_t *value, uint32_t *flags)
8449{
8450 ASSERT(DB_TYPE(mp) == M_DATA || DB_TYPE(mp) == M_MULTIDATA);
8451 if (mp->b_datap->db_type == M_DATA) {
8452 if (flags != NULL) {
30#include <sys/types.h>
31#include <sys/sysmacros.h>
32#include <sys/param.h>
33#include <sys/errno.h>
34#include <sys/signal.h>
35#include <sys/proc.h>
36#include <sys/conf.h>
37#include <sys/cred.h>

--- 8405 unchanged lines hidden (view full) ---

8443void
8444hcksum_retrieve(mblk_t *mp, multidata_t *mmd, pdesc_t *pd,
8445 uint32_t *start, uint32_t *stuff, uint32_t *end,
8446 uint32_t *value, uint32_t *flags)
8447{
8448 ASSERT(DB_TYPE(mp) == M_DATA || DB_TYPE(mp) == M_MULTIDATA);
8449 if (mp->b_datap->db_type == M_DATA) {
8450 if (flags != NULL) {
8453 *flags = DB_CKSUMFLAGS(mp);
8454 if (*flags & HCK_PARTIALCKSUM) {
8455 if (start != NULL)
8456 *start = (uint32_t)DB_CKSUMSTART(mp);
8457 if (stuff != NULL)
8458 *stuff = (uint32_t)DB_CKSUMSTUFF(mp);
8459 if (end != NULL)
8460 *end = (uint32_t)DB_CKSUMEND(mp);
8451 *flags = DB_CKSUMFLAGS(mp) & (HCK_IPV4_HDRCKSUM |
8452 HCK_PARTIALCKSUM | HCK_FULLCKSUM |
8453 HCK_FULLCKSUM_OK);
8454 if ((*flags & (HCK_PARTIALCKSUM |
8455 HCK_FULLCKSUM)) != 0) {
8461 if (value != NULL)
8462 *value = (uint32_t)DB_CKSUM16(mp);
8456 if (value != NULL)
8457 *value = (uint32_t)DB_CKSUM16(mp);
8463 } else if ((*flags & HW_LSO) && (value != NULL))
8464 *value = (uint32_t)DB_LSOMSS(mp);
8458 if ((*flags & HCK_PARTIALCKSUM) != 0) {
8459 if (start != NULL)
8460 *start =
8461 (uint32_t)DB_CKSUMSTART(mp);
8462 if (stuff != NULL)
8463 *stuff =
8464 (uint32_t)DB_CKSUMSTUFF(mp);
8465 if (end != NULL)
8466 *end =
8467 (uint32_t)DB_CKSUMEND(mp);
8468 }
8469 }
8465 }
8466 } else {
8467 pattrinfo_t hck_attr = {PATTR_HCKSUM};
8468
8469 ASSERT(mmd != NULL);
8470
8471 /* get hardware checksum attribute */
8472 if (mmd_getpattr(mmd, pd, &hck_attr) != NULL) {

--- 10 unchanged lines hidden (view full) ---

8483 *end = hck->hcksum_end_offset;
8484 if (value != NULL)
8485 *value = (uint32_t)
8486 hck->hcksum_cksum_val.inet_cksum;
8487 }
8488 }
8489}
8490
8470 }
8471 } else {
8472 pattrinfo_t hck_attr = {PATTR_HCKSUM};
8473
8474 ASSERT(mmd != NULL);
8475
8476 /* get hardware checksum attribute */
8477 if (mmd_getpattr(mmd, pd, &hck_attr) != NULL) {

--- 10 unchanged lines hidden (view full) ---

8488 *end = hck->hcksum_end_offset;
8489 if (value != NULL)
8490 *value = (uint32_t)
8491 hck->hcksum_cksum_val.inet_cksum;
8492 }
8493 }
8494}
8495
8496void
8497lso_info_set(mblk_t *mp, uint32_t mss, uint32_t flags)
8498{
8499 ASSERT(DB_TYPE(mp) == M_DATA);
8500
8501 /* Set the flags */
8502 DB_LSOFLAGS(mp) |= flags;
8503 DB_LSOMSS(mp) = mss;
8504}
8505
8506void
8507lso_info_get(mblk_t *mp, uint32_t *mss, uint32_t *flags)
8508{
8509 ASSERT(DB_TYPE(mp) == M_DATA);
8510
8511 if (flags != NULL) {
8512 *flags = DB_CKSUMFLAGS(mp) & HW_LSO;
8513 if ((*flags != 0) && (mss != NULL))
8514 *mss = (uint32_t)DB_LSOMSS(mp);
8515 }
8516}
8517
8491/*
8492 * Checksum buffer *bp for len bytes with psum partial checksum,
8493 * or 0 if none, and return the 16 bit partial checksum.
8494 */
8495unsigned
8496bcksum(uchar_t *bp, int len, unsigned int psum)
8497{
8498 int odd = len & 1;

--- 227 unchanged lines hidden ---
8518/*
8519 * Checksum buffer *bp for len bytes with psum partial checksum,
8520 * or 0 if none, and return the 16 bit partial checksum.
8521 */
8522unsigned
8523bcksum(uchar_t *bp, int len, unsigned int psum)
8524{
8525 int odd = len & 1;

--- 227 unchanged lines hidden ---