summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti/netcp_core.c
AgeCommit message (Expand)Author
2020-01-28Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-nextLinus Torvalds
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig
2019-12-12netdev: pass the stuck queue to the timeout handlerMichael S. Tsirkin
2019-07-30net: Use skb_frag_off accessorsJonathan Lemon
2019-05-07net: ethernet: support of_get_mac_address new ERR_PTR errorPetr Štetiar
2019-04-27net: ethernet: ti: convert to SPDX license identifiersGrygorii Strashko
2019-02-18net: netcp: Fix ethss driver probe issueMurali Karicheri
2018-08-29net: ethernet: Convert to using %pOFn instead of device_node.nameRob Herring
2018-07-09net: Add generic ndo_select_queue functionsAlexander Duyck
2018-06-23net: drivers/net: Convert random_ether_addr to eth_random_addrJoe Perches
2018-04-18net: netcp: add api to support set rx mode in netcp modulesWingMan Kwok
2018-04-18net: netcp: support probe deferralMurali Karicheri
2018-04-18Revert "net: netcp: remove dead code from the driver"Murali Karicheri
2018-01-17Net: ethernet: ti: netcp: Fix inbound ping crash if MTU size is greater than ...Rex Chang
2017-11-15Merge branch 'akpm' (patches from Andrew)Linus Torvalds
2017-11-15mm: remove __GFP_COLDMel Gorman
2017-11-08net_sch: mqprio: Change TC_SETUP_MQPRIO to TC_SETUP_QDISC_MQPRIONogah Frankel
2017-09-08net: ethernet: ti: netcp_core: no need in netif_napi_delIvan Khoronzhuk
2017-08-07net: sched: get rid of struct tc_to_netdevJiri Pirko
2017-08-07net: sched: change return value of ndo_setup_tc for driver supporting mqprio ...Jiri Pirko
2017-08-07net: sched: push cls related args into cls_common structureJiri Pirko
2017-08-07net: sched: make type an argument for ndo_setup_tcJiri Pirko
2017-06-08net: propagate tc filter chain index down the ndo_setup_tc callJiri Pirko
2017-05-11net: ethernet: ti: netcp_core: return error while dma channel open issueIvan Khoronzhuk
2017-04-25net: ethernet: ti: netcp_core: remove unused compl queue mappingIvan Khoronzhuk
2017-03-15mqprio: Modify mqprio to pass user parameters via ndo_setup_tc.Amritha Nambiar
2017-02-10net: ethernet: ti: netcp_core: remove netif_trans_updateIvan Khoronzhuk
2017-01-30drivers: net: generalize napi_complete_done()Eric Dumazet
2017-01-11net: netcp: correct netcp_get_stats function signatureKeerthy
2017-01-07net: netcp: use hw capability to remove FCS word from rx packetsKaricheri, Muralidharan
2017-01-07net: netcp: store network statistics in 64 bitsMichael Scherban
2017-01-07net: netcp: remove the redundant memmov()Karicheri, Muralidharan
2017-01-07net: netcp: extract eflag from desc for rx_hook handlingKaricheri, Muralidharan
2016-12-10net: ethernet: ti: netcp: add support of cptsWingMan Kwok
2016-11-16net: netcp: replace IS_ERR_OR_NULL by IS_ERRJulia Lawall
2016-10-26net: netcp: add missing of_node_put() in netcp_probe()Wei Yongjun
2016-10-26net: netcp: drop kfree for memory allocated with devm_kzallocWei Yongjun
2016-10-18ethernet: use core min/max MTU checkingJarod Wilson
2016-05-04treewide: replace dev->trans_start update with helperFlorian Westphal
2016-03-03net: relax setup_tc ndo op handle restrictionJohn Fastabend
2016-02-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller
2016-02-22netcp: use pointer to fix build failSudip Mukherjee
2016-02-21net: netcp: rework the code for get/set sw_data in dma descKaricheri, Muralidharan
2016-02-21soc: ti: knav_dma: rename pad in struct knav_dma_desc to sw_dataKaricheri, Muralidharan
2016-02-21net: ti: netcp: restore get/set_pad_info() functionalityKaricheri, Muralidharan
2016-02-17net: rework setup_tc ndo op to consume general tc operandJohn Fastabend
2016-02-17net: rework ndo tc op to consume additional qdisc handle parameterJohn Fastabend
2015-12-19netcp: fix regression in receive processingArnd Bergmann
2015-12-11netcp: add more __le32 annotationsArnd Bergmann
2015-12-11netcp: try to reduce type confusion in descriptorsArnd Bergmann
href='#n113'>113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
// Copyright 2019 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package hugolib

import (
	"bytes"
	"context"
	"fmt"
	"html/template"
	"runtime/debug"
	"strings"
	"sync"
	"unicode/utf8"

	"github.com/gohugoio/hugo/identity"

	"github.com/gohugoio/hugo/markup/converter/hooks"

	"github.com/gohugoio/hugo/markup/converter"

	"github.com/gohugoio/hugo/lazy"

	bp "github.com/gohugoio/hugo/bufferpool"
	"github.com/gohugoio/hugo/tpl"

	"github.com/gohugoio/hugo/helpers"
	"github.com/gohugoio/hugo/output"
	"github.com/gohugoio/hugo/resources/page"
	"github.com/gohugoio/hugo/resources/resource"
)

var (
	nopTargetPath    = targetPathsHolder{}
	nopPagePerOutput = struct {
		resource.ResourceLinksProvider
		page.ContentProvider
		page.PageRenderProvider
		page.PaginatorProvider
		page.TableOfContentsProvider
		page.AlternativeOutputFormatsProvider

		targetPather
	}{
		page.NopPage,
		page.NopPage,
		page.NopPage,
		page.NopPage,
		page.NopPage,
		page.NopPage,
		nopTargetPath,
	}
)

var pageContentOutputDependenciesID = identity.KeyValueIdentity{Key: "pageOutput", Value: "dependencies"}

func newPageContentOutput(p *pageState, po *pageOutput) (*pageContentOutput, error) {

	parent := p.init

	var dependencyTracker identity.Manager
	if p.s.running() {
		dependencyTracker = identity.NewManager(pageContentOutputDependenciesID)
	}

	cp := &pageContentOutput{
		dependencyTracker: dependencyTracker,
		p:                 p,
		f:                 po.f,
	}

	initContent := func() (err error) {
		if p.cmap == nil {
			// Nothing to do.
			return nil
		}
		defer func() {
			// See https://github.com/gohugoio/hugo/issues/6210
			if r := recover(); r != nil {
				err = fmt.Errorf("%s", r)
				p.s.Log.ERROR.Printf("[BUG] Got panic:\n%s\n%s", r, string(debug.Stack()))
			}
		}()

		if err := po.initRenderHooks(); err != nil {
			return err
		}

		var hasShortcodeVariants bool

		f := po.f
		cp.contentPlaceholders, hasShortcodeVariants, err = p.shortcodeState.renderShortcodesForPage(p, f)
		if err != nil {
			return err
		}

		enableReuse := !(hasShortcodeVariants || cp.renderHooksHaveVariants)

		if enableReuse {
			// Reuse this for the other output formats.
			// We may improve on this, but we really want to avoid re-rendering the content
			// to all output formats.
			// The current rule is that if you need output format-aware shortcodes or
			// content rendering hooks, create a output format-specific template, e.g.
			// myshortcode.amp.html.
			cp.enableReuse()
		}

		cp.workContent = p.contentToRender(cp.contentPlaceholders)

		isHTML := cp.p.m.markup == "html"

		if p.renderable {
			if !isHTML {
				r, err := cp.renderContent(cp.workContent, true)
				if err != nil {
					return err
				}

				cp.workContent = r.Bytes()

				if tocProvider, ok := r.(converter.TableOfContentsProvider); ok {
					cfg := p.s.ContentSpec.Converters.GetMarkupConfig()
					cp.tableOfContents = template.HTML(
						tocProvider.TableOfContents().ToHTML(
							cfg.TableOfContents.StartLevel,
							cfg.TableOfContents.EndLevel,
							cfg.TableOfContents.Ordered,
						),
					)
				} else {
					tmpContent, tmpTableOfContents := helpers.ExtractTOC(cp.workContent)
					cp.tableOfContents = helpers.BytesToHTML(tmpTableOfContents)
					cp.workContent = tmpContent
				}
			}

			if cp.placeholdersEnabled {
				// ToC was accessed via .Page.TableOfContents in the shortcode,
				// at a time when the ToC wasn't ready.
				cp.contentPlaceholders[tocShortcodePlaceholder] = string(cp.tableOfContents)
			}

			if p.cmap.hasNonMarkdownShortcode || cp.placeholdersEnabled {
				// There are one or more replacement tokens to be replaced.
				cp.workContent, err = replaceShortcodeTokens(cp.workContent, cp.contentPlaceholders)
				if err != nil {
					return err
				}
			}

			if cp.p.source.hasSummaryDivider {
				if isHTML {
					src := p.source.parsed.Input()

					// Use the summary sections as they are provided by the user.
					if p.source.posSummaryEnd != -1 {
						cp.summary = helpers.BytesToHTML(src[p.source.posMainContent:p.source.posSummaryEnd])
					}

					if cp.p.source.posBodyStart != -1 {
						cp.workContent = src[cp.p.source.posBodyStart:]
					}

				} else {
					summary, content, err := splitUserDefinedSummaryAndContent(cp.p.m.markup, cp.workContent)
					if err != nil {
						cp.p.s.Log.ERROR.Printf("Failed to set user defined summary for page %q: %s", cp.p.pathOrTitle(), err)
					} else {
						cp.workContent